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

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

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


Revision 1.1 - (hide annotations) (download)
Thu Apr 14 23:37:11 2011 UTC (14 years, 3 months ago) by roquet
Branch: MAIN
New capability: extract madt from aviso opendap server at the position of profiles
and add it as a field prof_madt_aviso in the MITprof netcdf file.

1 roquet 1.1 function aviso_addinMITprof(ncfile)
2     % function aviso_addinMITprof(ncfile)
3     % add MADT (Maps of Absolute Dynamic Topography) interpolated on profile
4     % positions available in a MITprof netcdf file.
5     % Use OpenDap, through the loaddap function.
6     %
7     % fileIn: path (absolute or relative) to MITprof netcdf file
8     % model is a string used to select the model to be loaded
9     % 'OCCA' : ECCOv4 grid + OCCA atlas
10     % 'SOSE59' : SOSE59 grid + atlas
11    
12     % process file name
13     [pathstr, name, ext] = fileparts(ncfile);
14     if isempty(pathstr) | strcmp(pathstr,'.'), pathstr=pwd; end
15     if isempty(ext) | ~strcmp(ext,'.nc'), ext='.nc'; end
16     ncfile=[pathstr '/' name ext];
17    
18     if isempty(which('loaddap')),
19     error('loaddap toolbox must be installed');
20     end
21    
22     % load profiles
23     M=MITprof_load(ncfile,{'prof_date','prof_lat','prof_lon'});
24    
25     % load data
26     loc=[];
27     loc.lat=M.prof_lat;
28     loc.lon=M.prof_lon;
29     loc.time=M.prof_date;
30     grid_aviso=aviso_get_grid;
31     madt=aviso_get_madt(loc,grid_aviso);
32    
33     % add fields
34     fillval=double(-9999);
35     madt(isnan(madt))=fillval;
36     MITprof_addVar(ncfile,['prof_madt_aviso'],'double',{'iPROF'},madt);
37    
38     % add attributes
39     nc=ncopen(ncfile,'write');
40     ncaddAtt(nc,'prof_madt_aviso','long_name',['MADT AVISO']);
41     ncaddAtt(nc,'prof_madt_aviso','units','m');
42     ncaddAtt(nc,'prof_madt_aviso','missing_value',fillval);
43     ncaddAtt(nc,'prof_madt_aviso','_FillValue',fillval);
44     ncclose(nc);

  ViewVC Help
Powered by ViewVC 1.1.22