/[MITgcm]/MITgcm_contrib/enderton/Diagnostics/DiagLoad.m
ViewVC logotype

Diff of /MITgcm_contrib/enderton/Diagnostics/DiagLoad.m

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

revision 1.9 by molod, Tue Jul 5 18:57:48 2005 UTC revision 1.12 by molod, Thu Aug 18 15:50:24 2005 UTC
# Line 56  if ~isequal(Grads,0) Line 56  if ~isequal(Grads,0)
56      if DiagDebug, disp(['  Debug -- ''data'' size after load:  ',mat2str(size(data))]); end      if DiagDebug, disp(['  Debug -- ''data'' size after load:  ',mat2str(size(data))]); end
57      data = DiagAverage(data,fln,avg,months,ddf,dim);      data = DiagAverage(data,fln,avg,months,ddf,dim);
58      if DiagDebug, disp(['  Debug -- ''data'' size after averaging:  ',mat2str(size(data))]); end      if DiagDebug, disp(['  Debug -- ''data'' size after averaging:  ',mat2str(size(data))]); end
59      if isequal(slc,'Sur')  %   if isequal(slc,'Sur')
60          data = data';  %       data = data';
61          pltslc='lonlat';  %       pltslc='lonlat';
62      else  %   else
63          error('Loading grads data only set to handle surface plots!');  %       error('Loading grads data only set to handle surface plots!');
64      end  %   end
65        [data,xax,yax,pltslc] = ...
66            DiagSliceGradsData(fln,flu,slc,data,xax,yax,zax);
67    
68  % Load monitor data.  % Load monitor data.
69  elseif isequal(dat(1:2),'Mn')  elseif isequal(dat(1:2),'Mn')
# Line 108  elseif ismember(fln,aimparameters) Line 110  elseif ismember(fln,aimparameters)
110                ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName);                ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName);
111    
112  % Load coupled fields.  Like AIM, the data is all stuffed into one file  % Load coupled fields.  Like AIM, the data is all stuffed into one file
113  % called either 'cplFld.*' (MDS) or 'cpl_tave.*' (MNC).  Variables within  % called either 'cplFldtave.*' (MDS) or 'cpl_tave.*' (MNC).  Variables within
114  % the MDS files given in 'DiagGenParam', accessed directly with MNC.  TX  % the MDS files given in 'DiagGenParam', accessed directly with MNC.  TX
115  % and TY (stress on ocean) must be converted to lat-lon grid.  % and TY (stress on ocean) must be converted to lat-lon grid.
116  elseif ismember(fln,cplparameters)  elseif ismember(fln,cplparameters)
# Line 311  elseif isequal(fln,'KEpri') Line 313  elseif isequal(fln,'KEpri')
313      UU = DiagLoad_Local('UU'  ,dat,dad,grd,itr,ddf,filesuffix,mnchandle);      UU = DiagLoad_Local('UU'  ,dat,dad,grd,itr,ddf,filesuffix,mnchandle);
314      VV = DiagLoad_Local('VV'  ,dat,dad,grd,itr,ddf,filesuffix,mnchandle);      VV = DiagLoad_Local('VV'  ,dat,dad,grd,itr,ddf,filesuffix,mnchandle);
315      if isequal(ddf,'MNC')      if isequal(ddf,'MNC')
316          U  = .5*(  U(2:end,:,:,:) +  U(1:end-1,:,:,:) );          U = U(1:end-1,:,:,:); UU = UU(1:end-1,:,:,:);
317          V  = .5*(  V(:,2:end,:,:) +  V(:,1:end-1,:,:) );          V = V(:,1:end-1,:,:); VV = VV(:,1:end-1,:,:);
         %UU = .5*( UU(2:end,:,:,:) + UU(1:end-1,:,:,:) );  % UU and VV might be incorrect.  
         %VV = .5*( VV(:,2:end,:,:) + VV(:,1:end-1,:,:) );  
318      end      end
319      U = DiagAverage(U,fln,avg,months,ddf,Dim);      U  = DiagAverage(U ,fln,avg,months,ddf,Dim);
320      V = DiagAverage(V,fln,avg,months,ddf,Dim);      V  = DiagAverage(V ,fln,avg,months,ddf,Dim);
321      UU = DiagAverage(UU,fln,avg,months,ddf,Dim);      UU = DiagAverage(UU,fln,avg,months,ddf,Dim);
322      VV = DiagAverage(VV,fln,avg,months,ddf,Dim);      VV = DiagAverage(VV,fln,avg,months,ddf,Dim);
323      data = sqrt(abs((U.*U + V.*V) - (UU + VV)));      data = sqrt(abs((U.*U + V.*V) - (UU + VV)));
# Line 372  else Line 372  else
372       if DiagDebug, disp(['  Debug -- ''data'' size after vector manipulation:  ',mat2str(size(data))]); end       if DiagDebug, disp(['  Debug -- ''data'' size after vector manipulation:  ',mat2str(size(data))]); end
373      else      else
374  % Sequence here for Vector = 0  % Sequence here for Vector = 0
375       if ~isequal(Index,0)       if ~isequal(Index,0) & isequal(size(Index),[1 1]) & isequal(sign(Index),1)
376          if     isequal(Dim,2), data = squeeze(data(:,:,Index,:));          if     isequal(Dim,2), data = squeeze(data(:,:,Index,:));
377          elseif isequal(Dim,3), data = squeeze(data(:,:,:,Index,:)); end          elseif isequal(Dim,3), data = squeeze(data(:,:,:,Index,:)); end
378         elseif isequal(size(Index),[1 1]) & ~isequal(sign(Index),1)
379            if     isequal(Dim,2), data = sign(Index(1)).*squeeze(data(:,:,abs(Index(1)),:));
380            elseif isequal(Dim,3), data = sign(Index(1)).*squeeze(data(:,:,:,abs(Index(1)),:)); end
381         elseif isequal(size(Index),[1 2])
382            if     isequal(Dim,2), data = sign(Index(1)).*squeeze(data(:,:,abs(Index(1)),:)) + sign(Index(2)).*squeeze(data(:,:,abs(Index(2)),:));
383            elseif isequal(Dim,3), data = sign(Index(1)).*squeeze(data(:,:,:,abs(Index(1)),:)) + sign(Index(2)).*squeeze(data(:,:,:,abs(Index(2)),:)); end
384       end       end
385       if DiagDebug, disp(['  Debug -- ''data'' size after indexing:  ',mat2str(size(data))]); end       if DiagDebug, disp(['  Debug -- ''data'' size after indexing:  ',mat2str(size(data))]); end
386       data = DiagAverage(data,fln,avg,months,ddf,Dim);       data = DiagAverage(data,fln,avg,months,ddf,Dim);
# Line 409  end Line 415  end
415  % Thus is merely a local function that calls the load data functions  % Thus is merely a local function that calls the load data functions
416  % according to the DataFormat for the data specified by dfm.  % according to the DataFormat for the data specified by dfm.
417  function data = DiagLoad_Local(fln,dat,dad,grd,itr,dfm,filesuffix,mnchandle)  function data = DiagLoad_Local(fln,dat,dad,grd,itr,dfm,filesuffix,mnchandle)
       
418          if isequal(dfm,'MDS')          if isequal(dfm,'MDS')
419          data = rdmds([dad,'/',fln,filesuffix],itr);          data = rdmds([dad,'/',fln,filesuffix],itr);
420          elseif isequal(dfm,'MNC')          elseif isequal(dfm,'MNC')
421          iter = rdmnc_mod([dad,mnchandle],'T');          data = rdmnc_mod2([dad,mnchandle],[fln,filesuffix],'iter','T',itr);
422          iter = iter.T;          if ~isequal(itr,data.iter'), error('Missing iterations in data!'); end
         [dummy,indecies] = ismember(itr,iter);  
         data = rdmnc_mod([dad,mnchandle],[fln,filesuffix],'T',indecies);  
         iter = data.T;  
         if ~isequal(itr,iter'), error('Missing iterations in data!'); end  
423          eval(['data = data.',fln,filesuffix,';']);          eval(['data = data.',fln,filesuffix,';']);
424          else          else
425          error(['Unrecognized data type:  ',dfm]);          error(['Unrecognized data type:  ',dfm]);

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.22