/[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.13 by enderton, Mon Sep 5 18:48:27 2005 UTC
# Line 53  if ~isequal(Grads,0) Line 53  if ~isequal(Grads,0)
53      if DiagDebug, disp(['  Debug -- Loading GRADS field.']); end      if DiagDebug, disp(['  Debug -- Loading GRADS field.']); end
54      [data,xax,yax,zax,months,time,dim] = ...      [data,xax,yax,zax,months,time,dim] = ...
55          DiagLoadGradsData(Grads,dad,fln,DiagDebug);          DiagLoadGradsData(Grads,dad,fln,DiagDebug);
56      if DiagDebug, disp(['  Debug -- ''data'' size after load:  ',mat2str(size(data))]); end      if DiagDebug, disp(['  Debug -- ''data'' size after load:  ',...
57                            mat2str(size(data))]); end
58      data = DiagAverage(data,fln,avg,months,ddf,dim);      data = DiagAverage(data,fln,avg,months,ddf,dim);
59      if DiagDebug, disp(['  Debug -- ''data'' size after averaging:  ',mat2str(size(data))]); end      if DiagDebug, disp(['  Debug -- ''data'' size after averaging:  ',...
60      if isequal(slc,'Sur')                           mat2str(size(data))]); end
61          data = data';      [data,xax,yax,pltslc] = ...
62          pltslc='lonlat';          DiagSliceGradsData(fln,flu,slc,data,xax,yax,zax);
63      else      if DiagDebug, disp(['  Debug -- ''data'' size after slicing:  ',...
64          error('Loading grads data only set to handle surface plots!');                           mat2str(size(data))]); end
     end  
65    
66  % Load monitor data.  % Load monitor data.
67  elseif isequal(dat(1:2),'Mn')  elseif isequal(dat(1:2),'Mn')
# Line 108  elseif ismember(fln,aimparameters) Line 108  elseif ismember(fln,aimparameters)
108                ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName);                ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName);
109    
110  % 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
111  % called either 'cplFld.*' (MDS) or 'cpl_tave.*' (MNC).  Variables within  % called either 'cplFldtave.*' (MDS) or 'cpl_tave.*' (MNC).  Variables within
112  % the MDS files given in 'DiagGenParam', accessed directly with MNC.  TX  % the MDS files given in 'DiagGenParam', accessed directly with MNC.  TX
113  % and TY (stress on ocean) must be converted to lat-lon grid.  % and TY (stress on ocean) must be converted to lat-lon grid.
114  elseif ismember(fln,cplparameters)  elseif ismember(fln,cplparameters)
# Line 311  elseif isequal(fln,'KEpri') Line 311  elseif isequal(fln,'KEpri')
311      UU = DiagLoad_Local('UU'  ,dat,dad,grd,itr,ddf,filesuffix,mnchandle);      UU = DiagLoad_Local('UU'  ,dat,dad,grd,itr,ddf,filesuffix,mnchandle);
312      VV = DiagLoad_Local('VV'  ,dat,dad,grd,itr,ddf,filesuffix,mnchandle);      VV = DiagLoad_Local('VV'  ,dat,dad,grd,itr,ddf,filesuffix,mnchandle);
313      if isequal(ddf,'MNC')      if isequal(ddf,'MNC')
314          U  = .5*(  U(2:end,:,:,:) +  U(1:end-1,:,:,:) );          U = U(1:end-1,:,:,:); UU = UU(1:end-1,:,:,:);
315          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,:,:) );  
316      end      end
317      U = DiagAverage(U,fln,avg,months,ddf,Dim);      U  = DiagAverage(U ,fln,avg,months,ddf,Dim);
318      V = DiagAverage(V,fln,avg,months,ddf,Dim);      V  = DiagAverage(V ,fln,avg,months,ddf,Dim);
319      UU = DiagAverage(UU,fln,avg,months,ddf,Dim);      UU = DiagAverage(UU,fln,avg,months,ddf,Dim);
320      VV = DiagAverage(VV,fln,avg,months,ddf,Dim);      VV = DiagAverage(VV,fln,avg,months,ddf,Dim);
321      data = sqrt(abs((U.*U + V.*V) - (UU + VV)));      data = sqrt(abs((U.*U + V.*V) - (UU + VV)));
# Line 372  else Line 370  else
370       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
371      else      else
372  % Sequence here for Vector = 0  % Sequence here for Vector = 0
373       if ~isequal(Index,0)       if ~isequal(Index,0) & isequal(size(Index),[1 1]) & isequal(sign(Index),1)
374          if     isequal(Dim,2), data = squeeze(data(:,:,Index,:));          if     isequal(Dim,2), data = squeeze(data(:,:,Index,:));
375          elseif isequal(Dim,3), data = squeeze(data(:,:,:,Index,:)); end          elseif isequal(Dim,3), data = squeeze(data(:,:,:,Index,:)); end
376         elseif isequal(size(Index),[1 1]) & ~isequal(sign(Index),1)
377            if     isequal(Dim,2), data = sign(Index(1)).*squeeze(data(:,:,abs(Index(1)),:));
378            elseif isequal(Dim,3), data = sign(Index(1)).*squeeze(data(:,:,:,abs(Index(1)),:)); end
379         elseif isequal(size(Index),[1 2])
380            if     isequal(Dim,2), data = sign(Index(1)).*squeeze(data(:,:,abs(Index(1)),:)) + sign(Index(2)).*squeeze(data(:,:,abs(Index(2)),:));
381            elseif isequal(Dim,3), data = sign(Index(1)).*squeeze(data(:,:,:,abs(Index(1)),:)) + sign(Index(2)).*squeeze(data(:,:,:,abs(Index(2)),:)); end
382       end       end
383       if DiagDebug, disp(['  Debug -- ''data'' size after indexing:  ',mat2str(size(data))]); end       if DiagDebug, disp(['  Debug -- ''data'' size after indexing:  ',mat2str(size(data))]); end
384       data = DiagAverage(data,fln,avg,months,ddf,Dim);       data = DiagAverage(data,fln,avg,months,ddf,Dim);
# Line 409  end Line 413  end
413  % Thus is merely a local function that calls the load data functions  % Thus is merely a local function that calls the load data functions
414  % according to the DataFormat for the data specified by dfm.  % according to the DataFormat for the data specified by dfm.
415  function data = DiagLoad_Local(fln,dat,dad,grd,itr,dfm,filesuffix,mnchandle)  function data = DiagLoad_Local(fln,dat,dad,grd,itr,dfm,filesuffix,mnchandle)
       
416          if isequal(dfm,'MDS')          if isequal(dfm,'MDS')
417          data = rdmds([dad,'/',fln,filesuffix],itr);          data = rdmds([dad,'/',fln,filesuffix],itr);
418          elseif isequal(dfm,'MNC')          elseif isequal(dfm,'MNC')
419          iter = rdmnc_mod([dad,mnchandle],'T');          data = rdmnc_mod2([dad,mnchandle],[fln,filesuffix],'iter','T',itr);
420          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  
421          eval(['data = data.',fln,filesuffix,';']);          eval(['data = data.',fln,filesuffix,';']);
422          else          else
423          error(['Unrecognized data type:  ',dfm]);          error(['Unrecognized data type:  ',dfm]);

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

  ViewVC Help
Powered by ViewVC 1.1.22