/[MITgcm]/MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/model_addinMITprof.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/model_addinMITprof.m

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


Revision 1.1 - (hide annotations) (download)
Wed Apr 13 21:16:01 2011 UTC (14 years, 3 months ago) by roquet
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
new capability: interpolation and storage of collocated model profiles
in a MITprof netcdf file. Successfully tested with an annual T/S climatology of SOSE59.

1 roquet 1.1 function model_addinMITprof(ncfile,model,varargin)
2     % function model_addinMITprof(ncfile,model)
3     % add hydrographic profiles from a model interpolated on profile
4     % positions available in a MITprof netcdf file.
5     %
6     % fileIn: path (absolute or relative) to MITprof netcdf file
7     % model is a string used to select the model to be loaded
8     % 'OCCA' : ECCOv4 grid + OCCA atlas
9     % 'SOSE59' : SOSE59 grid + atlas
10    
11     % process file name
12     [pathstr, name, ext] = fileparts(ncfile);
13     if isempty(pathstr) | strcmp(pathstr,'.'), pathstr=pwd; end
14     if isempty(ext) | ~strcmp(ext,'.nc'), ext='.nc'; end
15     ncfile=[pathstr '/' name ext];
16    
17     % load profiles
18     M=MITprof_load(ncfile);
19    
20     % interpolate model
21     M=model_interp(M,model);
22    
23     % add fields
24     fillval=double(-9999);
25     T=getfield(M,['prof_T_' model])'; T(isnan(T))=fillval;
26     MITprof_addVar(ncfile,['prof_T_' model],'double',{'iDEPTH','iPROF'},T);
27     S=getfield(M,['prof_S_' model])'; S(isnan(S))=fillval;
28     MITprof_addVar(ncfile,['prof_S_' model],'double',{'iDEPTH','iPROF'},S);
29    
30     % add attributes
31     nc=ncopen(ncfile,'write');
32     ncaddAtt(nc,['prof_T_' model],'long_name',['pot. temp. model ' model]);
33     ncaddAtt(nc,['prof_T_' model],'units','degree C');
34     ncaddAtt(nc,['prof_T_' model],'missing_value',fillval);
35     ncaddAtt(nc,['prof_T_' model],'_FillValue',fillval);
36     ncaddAtt(nc,['prof_S_' model],'long_name',['salinity model ' model]);
37     ncaddAtt(nc,['prof_S_' model],'units','psu');
38     ncaddAtt(nc,['prof_S_' model],'missing_value',fillval);
39     ncaddAtt(nc,['prof_S_' model],'_FillValue',fillval);
40     ncclose(nc);

  ViewVC Help
Powered by ViewVC 1.1.22