function [prof_T,prof_Testim,prof_Tweight,... prof_S,prof_Sestim,prof_Sweight]=idma_box_subset(box_l,box_L,box_D); % % IDMA_BOX_SUBSET extracts profiles located in a region defined % by ranges of longitude (box_l), latitude (box_L), and % depth (box_D) accross data collections. Reurns % observed profiles (prof_T and prof_S) and ECCO v4 % profiles (prof_Testim and prof_Sestim) in MITprof format; % % Example: box_l=[-180 -140]; box_L=[-10 10]-30; box_D=[0 300]; % [prof_T,prof_Testim,prof_S,prof_Sestim]=idma_box_subset(box_l,box_L,box_D); demoIO=1;%set this to one to activate additional demonstration of IO %%add MITprof routines to matlab path: dir_MITprof=[pwd filesep 'MITprof' filesep]; p = genpath(dir_MITprof); addpath(p);%TBE %%set box location fprintf('\n box definition: \n'); fprintf(' longitude range: %d %d \n',box_l); fprintf(' latitude range: %d %d \n',box_L); fprintf(' depth range: %d %d \n\n',box_D); %%demo: load a netcdf file if demoIO; dir_nc='release1/MITprof_release1/'; ncload([dir_nc 'argo_feb2013_1992_to_2007_model.nc']);%TBE clear prof_*; end; %%demo: MITprof_load and MITprof_subset if demoIO; dir_nc='release1/MITprof_release1/'; tmp1=MITprof_load([dir_nc 'argo_feb2013_1992_to_2007_model.nc']);%TBE tmp2=MITprof_subset(tmp1,'lon',box_l,'lat',box_L,'depth',box_D);%TBE figure; set(gca,'FontSize',12); plot(tmp1.prof_lon,tmp1.prof_lat,'.'); hold on; plot(tmp2.prof_lon,tmp2.prof_lat,'r.'); axis([-180 180 -90 90]); title('selected profile locations'); xlabel('longitude'); ylabel('latitude') clear tmp*; end; %%load complete data set for select variables dir_nc='release1/MITprof_release1/'; list_nc={'argo_feb2013_1992_to_2007_model.nc','argo_feb2013_2008_to_2010_model.nc','argo_feb2013_2011_to_2012_model.nc',... 'climode_feb2013_model.nc','itp_feb2013_model.nc','seals_feb2013_model.nc'}; %note: ctd_feb2013_model.nc and xbt_feb2013_model.nc are left out here for simplicity %note: it takes a couple minutes to load all of the data list_var={'prof_T','prof_Testim','prof_Tweight',... 'prof_S','prof_Sestim','prof_Sweight'};%TBE for vv=1:length(list_var); tmp1=MITprof_stats_load(dir_nc,list_nc,'',list_var{vv});%TBE tmp1=MITprof_subset(tmp1,'lon',box_l,'lat',box_L,'depth',box_D);%TBE eval([list_var{vv} '=tmp1;']);%TBE end; clear tmp1 vv;