/[MITgcm]/MITgcm_contrib/gael/profilesMatlabProcessing/netcdf_ecco_GenericgridMat2Nc.m
ViewVC logotype

Contents of /MITgcm_contrib/gael/profilesMatlabProcessing/netcdf_ecco_GenericgridMat2Nc.m

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


Revision 1.2 - (show annotations) (download)
Thu May 13 19:42:33 2010 UTC (15 years, 2 months ago) by gforget
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
moving to profiles_genericgrid directory

1 %function: netcdf_ecco_GenericgridMat2Nc
2 %object: complete an "ECCO format" data set with interpolation information
3 %author: Gael Forget (gforget@mit.edu)
4 %date: June 12th, 2007
5 %
6 %inputs: an "ECCO format" data set and associated mat files generated by netcdf_ecco_GenericgridMatFirstStep
7 %output: an "ECCO format" data set specific to a chosen grid
8 function []=netcdf_ecco_GenericgridMat2Nc(file_data,rep_data,rep_mat,rep_out);
9
10
11 [depth,myvars,prof_descr,mystruct,mystruct1D]=netcdf_ecco_read(rep_data,file_data);
12
13 tmp_name=findstr(file_data,'.nc'); tmp_name=file_data(1:tmp_name(end)-1);
14
15 eval(['files_list=ls('' -1 ' rep_mat tmp_name '_4mygrid.*.mat '');']);
16 tmp1=files_list; tmp2=strfind(files_list,rep_mat)+length(rep_mat);
17 tmp3=strfind(files_list,'.mat')+3;
18 files_list='';
19 for tmp4=1:length(tmp2);
20 files_list=strvcat(files_list, tmp1(tmp2(tmp4):tmp3(tmp4)) );
21 end
22
23 for icur=1:size(files_list,1)
24 eval(['load ' rep_mat deblank(files_list(icur,:)) ';']);
25 if icur==1;
26 prof_interp_XC11_all=prof_interp_XC11; prof_interp_YC11_all=prof_interp_YC11;
27 prof_interp_XCNINJ_all=prof_interp_XCNINJ; prof_interp_YCNINJ_all=prof_interp_YCNINJ;
28 prof_interp_i_all=prof_interp_i;
29 prof_interp_j_all=prof_interp_j;
30 prof_interp_lon_all=prof_interp_lon;
31 prof_interp_lat_all=prof_interp_lat;
32 prof_interp_weights_all=prof_interp_weights;
33 else
34 tmp1=find(~isnan(prof_interp_XC11));
35 prof_interp_XC11_all(tmp1)=prof_interp_XC11(tmp1); prof_interp_YC11_all(tmp1)=prof_interp_YC11(tmp1);
36 prof_interp_XCNINJ_all(tmp1)=prof_interp_XCNINJ(tmp1); prof_interp_YCNINJ_all(tmp1)=prof_interp_YCNINJ(tmp1);
37 prof_interp_i_all(tmp1,:)=prof_interp_i(tmp1,:);
38 prof_interp_j_all(tmp1,:)=prof_interp_j(tmp1,:);
39 prof_interp_lon_all(tmp1,:)=prof_interp_lon(tmp1,:);
40 prof_interp_lat_all(tmp1,:)=prof_interp_lat(tmp1,:);
41 prof_interp_weights_all(tmp1,:)=prof_interp_weights(tmp1,:);
42 end
43 end
44
45 tmp1=length(find(~isnan(prof_interp_XC11_all))); tmp2=length(prof_interp_XC11_all);
46 fprintf([' \n\n => coeffs defined for ' num2str(tmp1) ' profiles out of ' num2str(tmp2) ' \n']);
47
48 tmp3=find(isnan(prof_interp_XC11_all));
49 prof_interp_XC11_all(tmp3)=-9999; prof_interp_YC11_all(tmp3)=-9999;
50 prof_interp_XCNINJ_all(tmp3)=-9999; prof_interp_YCNINJ_all(tmp3)=-9999;
51 prof_interp_i_all(tmp3,:)=-9999; prof_interp_j_all(tmp3,:)=-9999;
52 prof_interp_lon_all(tmp3,:)=-9999; prof_interp_lat_all(tmp3,:)=-9999;
53 prof_interp_weights_all(tmp3,:)=-9999;
54
55
56 mystruct1D=struct('prof_YYYYMMDD',mystruct1D.prof_YYYYMMDD,'prof_HHMMSS',mystruct1D.prof_HHMMSS,...
57 'prof_lon',mystruct1D.prof_lon,'prof_lat',mystruct1D.prof_lat,...
58 'prof_interp_XC11',prof_interp_XC11_all,'prof_interp_YC11',prof_interp_YC11_all,...
59 'prof_interp_XCNINJ',prof_interp_XCNINJ_all,'prof_interp_YCNINJ',prof_interp_YCNINJ_all...
60 );
61
62
63 mystruct4mygrid=struct('prof_interp_i',prof_interp_i_all,...
64 'prof_interp_j',prof_interp_j_all,...
65 'prof_interp_lon',prof_interp_lon_all,...
66 'prof_interp_lat',prof_interp_lat_all,...
67 'prof_interp_weights',prof_interp_weights_all);
68
69 file_characteristics=[length(mystruct1D.prof_lon) 0 size(prof_descr,2) -9999];
70
71 netcdf_ecco_create([rep_out tmp_name '_4mygrid.nc'], file_characteristics, depth, ...
72 prof_descr, mystruct, mystruct1D,mystruct4mygrid);
73
74 fprintf([rep_out tmp_name '_4mygrid.nc written \n']);
75
76

  ViewVC Help
Powered by ViewVC 1.1.22