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

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

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

revision 1.1 by roquet, Thu Apr 14 23:37:11 2011 UTC revision 1.3 by gforget, Mon Jul 28 21:29:42 2014 UTC
# Line 9  function aviso_addinMITprof(ncfile) Line 9  function aviso_addinMITprof(ncfile)
9  %       'OCCA' : ECCOv4 grid + OCCA atlas  %       'OCCA' : ECCOv4 grid + OCCA atlas
10  %       'SOSE59' : SOSE59 grid + atlas  %       'SOSE59' : SOSE59 grid + atlas
11    
12    gcmfaces_global;
13    
14  % process file name  % process file name
15  [pathstr, name, ext] = fileparts(ncfile);  [pathstr, name, ext] = fileparts(ncfile);
16  if isempty(pathstr) | strcmp(pathstr,'.'), pathstr=pwd; end  if isempty(pathstr) | strcmp(pathstr,'.'), pathstr=pwd; end
# Line 20  if isempty(which('loaddap')), Line 22  if isempty(which('loaddap')),
22  end  end
23    
24  % load profiles  % load profiles
25  M=MITprof_load(ncfile,{'prof_date','prof_lat','prof_lon'});  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    
44  % load data  % load and write data
45    I=find(isnan(madt));
46  loc=[];  loc=[];
 loc.lat=M.prof_lat;  
 loc.lon=M.prof_lon;  
 loc.time=M.prof_date;  
 grid_aviso=aviso_get_grid;  
 madt=aviso_get_madt(loc,grid_aviso);  
   
 % add fields  
 fillval=double(-9999);  
 madt(isnan(madt))=fillval;  
 MITprof_addVar(ncfile,['prof_madt_aviso'],'double',{'iPROF'},madt);  
47    
48  % add attributes  buffer=1000;
49  nc=ncopen(ncfile,'write');  for kk=1:ceil(length(I)/buffer),
50  ncaddAtt(nc,'prof_madt_aviso','long_name',['MADT AVISO']);      
51  ncaddAtt(nc,'prof_madt_aviso','units','m');      if myenv.verbose;
52  ncaddAtt(nc,'prof_madt_aviso','missing_value',fillval);          disp([num2str(kk) ' out of ' num2str(length(I)/buffer)]);
53  ncaddAtt(nc,'prof_madt_aviso','_FillValue',fillval);      end
54  ncclose(nc);      
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    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22