/[MITgcm]/MITgcm_contrib/gael/comm/course-idma2016/matlab/idma_box_subset.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/comm/course-idma2016/matlab/idma_box_subset.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Fri Jan 8 22:06:26 2016 UTC (10 years, 7 months ago) by gforget
Branch: MAIN
Changes since 1.1: +9 -9 lines
- fix directory names

1 gforget 1.1
2     %%add MITprof routines to matlab path:
3 gforget 1.2 dir_MITprof=[pwd filesep 'MITprof' filesep];
4 gforget 1.1 p = genpath(dir_MITprof); addpath(p);%TBE
5    
6     %%demo: load a netcdf file
7 gforget 1.2 dir_nc='release1/MITprof_release1/';
8     ncload([dir_nc 'argo_feb2013_1992_to_2007_model.nc']);%TBE
9 gforget 1.1 clear;
10    
11     %%set box location
12     box_l=[-180 -140]; box_L=[-10 10]-30; box_D=[0 300];%TBE
13     fprintf('\n box definition: \n');
14     fprintf(' longitude range: %d %d \n',box_l);
15     fprintf(' latitude range: %d %d \n',box_L);
16     fprintf(' depth range: %d %d \n\n',box_D);
17    
18     %%demo: MITprof_load and MITprof_subset
19 gforget 1.2 dir_nc='release1/MITprof_release1/';
20     tmp1=MITprof_load([dir_nc 'argo_feb2013_1992_to_2007_model.nc']);%TBE
21 gforget 1.1
22     tmp2=MITprof_subset(tmp1,'lon',box_l,'lat',box_L,'depth',box_D);%TBE
23     figure; set(gca,'FontSize',12);
24     plot(tmp1.prof_lon,tmp1.prof_lat,'.');
25     hold on; plot(tmp2.prof_lon,tmp2.prof_lat,'r.');
26     axis([-180 180 -90 90]); title('selected profile locations');
27     xlabel('longitude'); ylabel('latitude')
28     clear tmp*;
29    
30     %%load complete data set for select variables
31 gforget 1.2 dir_nc='release1/MITprof_release1/';
32     list_nc={'argo_feb2013_1992_to_2007_model.nc','argo_feb2013_2008_to_2010_model.nc','argo_feb2013_2011_to_2012_model.nc',...
33     'climode_feb2013_model.nc','itp_feb2013_model.nc','seals_feb2013_model.nc'};
34     %note: ctd_feb2013_model.nc and xbt_feb2013_model.nc are left out here for simplicity
35 gforget 1.1 %note: it takes a couple minutes to load all of the data
36    
37     list_var={'prof_T','prof_Testim','prof_Tweight',...
38     'prof_S','prof_Sestim','prof_Sweight'};%TBE
39    
40     for vv=1:length(list_var);
41     tmp1=MITprof_stats_load(dir_nc,list_nc,'',list_var{vv});%TBE
42     tmp1=MITprof_subset(tmp1,'lon',box_l,'lat',box_L,'depth',box_D);%TBE
43     eval([list_var{vv} '=tmp1;']);%TBE
44     end;
45    
46     clear tmp1 vv;
47    

  ViewVC Help
Powered by ViewVC 1.1.22