/[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.3 - (hide annotations) (download)
Mon Jul 28 21:29:42 2014 UTC (10 years, 11 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.2: +2 -2 lines
- remove MITprof_verbose and use gcmfaces myenv.verbose instead

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 gforget 1.3 gcmfaces_global;
13 roquet 1.2
14 roquet 1.1 % process file name
15     [pathstr, name, ext] = fileparts(ncfile);
16     if isempty(pathstr) | strcmp(pathstr,'.'), pathstr=pwd; end
17     if isempty(ext) | ~strcmp(ext,'.nc'), ext='.nc'; end
18     ncfile=[pathstr '/' name ext];
19    
20     if isempty(which('loaddap')),
21     error('loaddap toolbox must be installed');
22     end
23    
24     % load profiles
25 roquet 1.2 nc=ncopen(ncfile,'write');
26     vars=ncvars(nc);
27     ncclose(nc);
28     if ismember('prof_madt_aviso',vars)
29     M=MITprof_load(ncfile,{'prof_date','prof_lat','prof_lon','prof_madt_aviso'});
30     madt=M.prof_madt_aviso;
31     else
32     fillval=double(-9999);
33     nc=ncopen(ncfile,'write');
34     ncaddVar(nc,'prof_madt_aviso','double',{'iPROF'});
35     ncaddAtt(nc,'prof_madt_aviso','long_name',['MADT AVISO']);
36     ncaddAtt(nc,'prof_madt_aviso','units','m');
37     ncaddAtt(nc,'prof_madt_aviso','missing_value',fillval);
38     ncaddAtt(nc,'prof_madt_aviso','_FillValue',fillval);
39     ncclose(nc);
40     M=MITprof_load(ncfile,{'prof_date','prof_lat','prof_lon'});
41     madt=M.prof_lat*NaN;
42     end
43 roquet 1.1
44 roquet 1.2 % load and write data
45     I=find(isnan(madt));
46 roquet 1.1 loc=[];
47    
48 roquet 1.2 buffer=1000;
49     for kk=1:ceil(length(I)/buffer),
50    
51 gforget 1.3 if myenv.verbose;
52 roquet 1.2 disp([num2str(kk) ' out of ' num2str(length(I)/buffer)]);
53     end
54    
55     % extract data
56     J=I((kk-1)*buffer+1:min([length(I),kk*buffer]));
57     loc.lat=M.prof_lat(J);
58     loc.lon=M.prof_lon(J);
59     loc.time=M.prof_date(J);
60     grid_aviso=aviso_get_grid;
61     madt_temp=aviso_get_madt(loc,grid_aviso);
62    
63     % write fields
64     madt(J)=madt_temp;
65     M.prof_madt_aviso=madt;
66     MITprof_write(ncfile,M,{'prof_madt_aviso'});
67    
68     end
69    

  ViewVC Help
Powered by ViewVC 1.1.22