% rep_out='/raid2/gforget/exps_myoptim5daily/EDWpaper/ARGOdata/'; rep_out='/net/altix3700/raid4/gforget/ARGO/ifremer/ECCOformat/'; fill_value_output=-9999; suff_cur='EDWCHECK'; %suff_cur='EDW'; nbfiles=0; sizefiles=[]; for icur=1:16 tmp_list=dir([rep_out 'PART' num2str(icur) '/*' suff_cur '.nc']); for jcur=1:length(tmp_list) eval(['ncload ' rep_out 'PART' num2str(icur) '/' tmp_list(jcur).name ' prof_lon depth;']); nbfiles=nbfiles+1; sizefiles(nbfiles)=length(prof_lon); end end %create the new file: fcdf=netcdf([rep_out 'ARGOifremer' suff_cur '.nc'], 'clobber'); nb_lev=55; nb_char=30; nb_prof=sum(sizefiles); fcdf('iPROF') = nb_prof; fcdf('iDEPTH') = nb_lev; fcdf('lTXT') = nb_char; fcdf{'depth'} = ncdouble('iDEPTH'); fcdf{'depth'}.units='meters'; fcdf{'prof_YYYYMMDD'} = ncdouble('iPROF'); fcdf{'prof_YYYYMMDD'}.missing_value=fill_value_output; fcdf{'prof_YYYYMMDD'}.long_name='year (4 digits), month (2 digits), day (2 digits)'; fcdf{'prof_HHMMSS'} = ncdouble('iPROF'); fcdf{'prof_HHMMSS'}.missing_value=fill_value_output; fcdf{'prof_HHMMSS'}.long_name='hour (2 digits), minute (2 digits), seconde (2 digits)'; fcdf{'prof_dir'} = ncdouble('iPROF'); fcdf{'prof_dir'}.missing_value=0; fcdf{'prof_dir'}.long_name='profile direction 1=asc 2=desc'; fcdf{'prof_lon'} = ncdouble('iPROF'); fcdf{'prof_lon'}.units='(degree E)'; fcdf{'prof_lon'}.missing_value=fill_value_output; fcdf{'prof_lat'} = ncdouble('iPROF'); fcdf{'prof_lat'}.units='(degree N)'; fcdf{'prof_lat'}.missing_value=fill_value_output; fcdf{'prof_T'} = ncdouble('iPROF','iDEPTH'); fcdf{'prof_T'}.long_name='potential temperature'; fcdf{'prof_T'}.units='degree Celsius'; fcdf{'prof_T'}.missing_value=fill_value_output; fcdf{'prof_Tweight'} = ncdouble('iPROF','iDEPTH'); fcdf{'prof_Tweight'}.long_name='weights'; fcdf{'prof_Tweight'}.units='(degree Celsius)^-2'; fcdf{'prof_Tweight'}.missing_value=0; fcdf{'prof_Ttest'} = ncdouble('iPROF','iDEPTH'); fcdf{'prof_Ttest'}.long_name='temperature flag'; fcdf{'prof_Ttest'}.units='(no units)'; fcdf{'prof_Ttest'}.missing_value=0; fcdf{'prof_S'} = ncdouble('iPROF','iDEPTH'); fcdf{'prof_S'}.long_name='salinity'; fcdf{'prof_S'}.units='(no units)'; fcdf{'prof_S'}.missing_value=fill_value_output; fcdf{'prof_Sweight'} = ncdouble('iPROF','iDEPTH'); fcdf{'prof_Sweight'}.long_name='weights'; fcdf{'prof_Sweight'}.units='(no units)^-2'; fcdf{'prof_Sweight'}.missing_value=0; fcdf{'prof_Stest'} = ncdouble('iPROF','iDEPTH'); fcdf{'prof_Stest'}.long_name='salinity flag'; fcdf{'prof_Stest'}.units='(no units)'; fcdf{'prof_Stest'}.missing_value=0; fcdf{'prof_descr'} = ncchar('iPROF','lTXT'); fcdf{'prof_descr'}.long_name='profile description'; fcdf{'depth'}(1:nb_lev)=depth; %fill the new file: aa=[]; cur_prof_interv=[0 0]; for icur=1:16 tmp_list=dir([rep_out 'PART' num2str(icur) '/*' suff_cur '.nc']); for jcur=1:length(tmp_list) eval(['ncload ' rep_out 'PART' num2str(icur) '/' tmp_list(jcur).name ';']); cur_prof_interv=[cur_prof_interv(2)+1 cur_prof_interv(2)+length(prof_lon)]; tmp1=sum(prof_Tweight,2); tmp2=find(tmp1==0); aa=[aa;[length(tmp1) length(tmp2)]]; %fill the date and position vectors : fcdf{'prof_YYYYMMDD'}(cur_prof_interv(1):cur_prof_interv(2))=prof_YYYYMMDD; fcdf{'prof_HHMMSS'}(cur_prof_interv(1):cur_prof_interv(2))=prof_HHMMSS; fcdf{'prof_dir'}(cur_prof_interv(1):cur_prof_interv(2))=prof_dir; fcdf{'prof_lon'}(cur_prof_interv(1):cur_prof_interv(2))=prof_lon; fcdf{'prof_lat'}(cur_prof_interv(1):cur_prof_interv(2))=prof_lat; %fill the data matrices : fcdf{'prof_T'}(cur_prof_interv(1):cur_prof_interv(2),1:nb_lev)=prof_T; fcdf{'prof_Tweight'}(cur_prof_interv(1):cur_prof_interv(2),1:nb_lev)=prof_Tweight; fcdf{'prof_Ttest'}(cur_prof_interv(1):cur_prof_interv(2),1:nb_lev)=prof_Ttest; fcdf{'prof_S'}(cur_prof_interv(1):cur_prof_interv(2),1:nb_lev)=prof_S; fcdf{'prof_Sweight'}(cur_prof_interv(1):cur_prof_interv(2),1:nb_lev)=prof_Sweight; fcdf{'prof_Stest'}(cur_prof_interv(1):cur_prof_interv(2),1:nb_lev)=prof_Stest; %fill the field describing the instruments : fcdf{'prof_descr'}(cur_prof_interv(1):cur_prof_interv(2),1:30)=prof_descr(:,1:30); end end fcdf=close(fcdf); %to check the numbers: eval(['ncload ' rep_out 'ARGOifremer' suff_cur '.nc']); tmp1=sum(prof_Tweight,2); [length(find(tmp1==0)) length(find(tmp1>0)) length(find(prof_Tweight>0&prof_T<-1000)) length(find(prof_Tweight==0&prof_T>-1000)) length(find(isnan(prof_T.*prof_Tweight.*prof_Ttest)))] tmp1=sum(prof_Sweight,2); [length(find(tmp1==0)) length(find(tmp1>0)) length(find(prof_Sweight>0&prof_S<-1000)) length(find(prof_Sweight==0&prof_S>-1000)) length(find(isnan(prof_S.*prof_Sweight.*prof_Stest)))]