/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_IO/prep2nctiles.m
ViewVC logotype

Diff of /MITgcm_contrib/gael/matlab_class/gcmfaces_IO/prep2nctiles.m

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

revision 1.3 by gforget, Tue Feb 3 14:02:01 2015 UTC revision 1.6 by gforget, Wed Feb 4 11:44:16 2015 UTC
# Line 41  end; Line 41  end;
41  %===============  %===============
42    
43  if choiceStruct==2;  if choiceStruct==2;
     budgName='budgHo'  
       
     structIn=[];  
     %  
     load release1/mat/diags_grid_parms.mat myparms;  
     dirMat=['release1/mat/diags_set_' budgName '/'];  
     fileMat=[budgName '_*.mat'];  
     structIn.vars=diags_read_from_mat(dirMat,fileMat);  
   
     %vector of time increment  
     [listTimes]=diags_list_times({'release1/diags/BUDG/'},{'budg2d_hflux_set1'});  
     structIn.vars.dt=diff(listTimes);  
     structIn.vars.dt=3600*structIn.vars.dt(1:end-1)';      
     %  
     specs=structIn.vars.specs(1);  
     if strcmp(specs.units,'W');  
         structIn.descr={'Heat budget in extensive form (in Watt, on C-Grid)'};  
     elseif strcmp(specs.units,'kg/s');  
         structIn.descr={'Mass budget in extensive form (in kg/s, on C-Grid)'};  
     elseif strcmp(specs.units,'g/s');  
         structIn.descr={'Salt budget in extensive form (in g/s, on C-Grid)'};  
     else;  
         error('unknown budget');  
     end;  
     structIn.descr={structIn.descr{:},'between',specs.top,'(top) and',specs.bottom,'(bottom)'};  
     %  
     vars=[]; nv=length(vars)+1;  
     vars(nv).fldName='tend'; vars(nv).longName='tendency term'; vars(nv).units=specs.units; nv=length(vars)+1;  
     vars(nv).fldName='trU'; vars(nv).longName='horizontal transport'; vars(nv).units=specs.units; nv=length(vars)+1;  
     vars(nv).fldName='trV'; vars(nv).longName='horizontal transport'; vars(nv).units=specs.units; nv=length(vars)+1;  
     vars(nv).fldName='trWtop'; vars(nv).longName='vertical transport'; vars(nv).units=specs.units; nv=length(vars)+1;  
     vars(nv).fldName='trWbot'; vars(nv).longName='vertical transport'; vars(nv).units=specs.units; nv=length(vars)+1;  
     vars(nv).fldName='dt'; vars(nv).longName='time increment'; vars(nv).units='s'; nv=length(vars)+1;  
     %  
     structIn.defs=vars;  
     %  
     struct2nctiles('release1/',budgName,structIn,[90 90]);  
44            
45  end;  end;
46    
# Line 85  end; Line 48  end;
48    
49  if choiceStruct==3;  if choiceStruct==3;
50    
51      budgName='budgHo';    %budgName='budgHo';
52      fldName='trU';  
53      if budgName(end)=='o'; listFlds={'tend','trU','trV','trWtop'};
54      else; listFlds={'tend','trU','trV','trWtop','trWbot'};
55      end;
56    
57      for ii=1:length(listFlds);
58        fldName=listFlds{ii};
59        %fldName='trWtop';
60      [budgName ' -- ' fldName]      [budgName ' -- ' fldName]
61    
62      %directories      %directories
# Line 109  if choiceStruct==3; Line 79  if choiceStruct==3;
79      structIn.vars.t1=3600*listTimes(2:end-1);      structIn.vars.t1=3600*listTimes(2:end-1);
80    
81      %rename trWtop as trW if adequate      %rename trWtop as trW if adequate
82      if strcmp(fldName,'trWtop');      if strcmp(fldName,'trWtop')&(budgName(end)=='o');
83        structIn.vars=setfield(structIn.vars,'trW',structIn.vars.trWtop);        structIn.vars=setfield(structIn.vars,'trW',structIn.vars.trWtop);
84        structIn.vars=rmfield(structIn.vars,'trWtop');        structIn.vars=rmfield(structIn.vars,'trWtop');
85        structIn.vars.listDiags={'trW'};        structIn.vars.listDiags={'trW'};
86        fldName='trW';        fldName='trW';
87      end;      end;
88    
89        %switch back to upward convention
90        if strcmp(fldName(1:3),'trW');
91          tmp1=getfield(structIn.vars,fldName);
92          structIn.vars=setfield(structIn.vars,fldName,-tmp1);
93        end;
94    
95      %general description      %general description
96      tmp1=diags_read_from_mat(dirMat,fileMat,'specs',1);      tmp1=diags_read_from_mat(dirMat,fileMat,'specs',1);
97      specs=tmp1.specs;      specs=tmp1.specs;
# Line 136  if choiceStruct==3; Line 112  if choiceStruct==3;
112      case 'tend'; vars(nv).longName='tendency term';      case 'tend'; vars(nv).longName='tendency term';
113      case 'trU'; vars(nv).longName='horizontal transport (U)';      case 'trU'; vars(nv).longName='horizontal transport (U)';
114      case 'trV'; vars(nv).longName='horizontal transport (V)';      case 'trV'; vars(nv).longName='horizontal transport (V)';
115      case 'trW'; vars(nv).longName='vertical transport (W)';      case 'trW'; vars(nv).longName='upward vertical transport (W)';
116        case 'trWtop'; vars(nv).longName='upward vertical transport (W)';
117        case 'trWbot'; vars(nv).longName='upward vertical transport (W)';
118      end;      end;
119      nv=length(vars)+1;      nv=length(vars)+1;
120      vars(nv).fldName='t0'; vars(nv).longName='initial time'; vars(nv).units='s'; nv=length(vars)+1;      vars(nv).fldName='t0'; vars(nv).longName='initial time'; vars(nv).units='s'; nv=length(vars)+1;
# Line 148  if choiceStruct==3; Line 126  if choiceStruct==3;
126      tic; struct2nctiles(dirIn,fldName,structIn,[90 90]); toc;      tic; struct2nctiles(dirIn,fldName,structIn,[90 90]); toc;
127      eval(['!mv ' pwd filesep dirIn filesep 'tmp_nctiles' filesep fldName ' ' pwd filesep dirOut]);      eval(['!mv ' pwd filesep dirIn filesep 'tmp_nctiles' filesep fldName ' ' pwd filesep dirOut]);
128    
129      end;%for fldName=listFlds;
130    
131  end;  end;
132    

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

  ViewVC Help
Powered by ViewVC 1.1.22