--- MITgcm_contrib/enderton/Diagnostics/DiagLoad.m 2005/06/28 21:33:51 1.8 +++ MITgcm_contrib/enderton/Diagnostics/DiagLoad.m 2005/08/10 20:00:35 1.10 @@ -105,10 +105,10 @@ data = DiagAverage(data,fln,avg,months,ddf,Dim); [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... - ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); % Load coupled fields. Like AIM, the data is all stuffed into one file -% called either 'cplFld.*' (MDS) or 'cpl_tave.*' (MNC). Variables within +% called either 'cplFldtave.*' (MDS) or 'cpl_tave.*' (MNC). Variables within % the MDS files given in 'DiagGenParam', accessed directly with MNC. TX % and TY (stress on ocean) must be converted to lat-lon grid. elseif ismember(fln,cplparameters) @@ -138,7 +138,7 @@ data = DiagAverage(data,fln,avg,months,ddf,Dim); [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... - ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); % Load ice parameters. Note that as the ice variable names appear to be in % constant flux, this part quickly becomes out of date. @@ -153,7 +153,7 @@ data = DiagAverage(data,fln,avg,months,ddf,Dim); [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... - ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); % Load generic fields where no modifications are needed. elseif ismember(fln,{'S','T','Temp','aim_RH','phiHyd','Conv'}) @@ -161,7 +161,7 @@ data = DiagAverage(data,fln,avg,months,ddf,Dim); [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... - flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); % Read vertical velocities, eta. Convert from [P] to [hPa] in atmosphere. elseif ismember(fln,{'W','wVel','Eta','ETA'}) @@ -170,7 +170,7 @@ data = DiagAverage(data,fln,avg,months,ddf,Dim); [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... - flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); % Load horizontal velocities, convert to lat-lon grid. elseif ismember(fln,{'U','V','uVel','vVel','fizhi_U','fizhi_V'}) @@ -189,7 +189,7 @@ V = DiagAverage(V,fln,avg,months,ddf,Dim); [XC,XG,YC,YG,Ylat,ZC,ZG,RAC,drC,drF,HFacC,HFacW,HFacS,dxG,dyG,dxC,dyC] = ... DiagLoadGridData(LoadGridData,grd,gdf,flu,GridSuffix,ZcordFile); - [U,V]=uvcube2latlon(XC,YC,U,V,XL,YL); + %[U,V]=uvcube2latlon(XC,YC,U,V,XL,YL); if ismember(fln,{'U','uVel','fizhi_U'}) data = U; elseif ismember(fln,{'V','vVel','fizhi_V'}) @@ -197,7 +197,7 @@ end [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... - flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); % Meridional overturning. elseif ismember(fln,{'Bol','Psi','Res'}) @@ -280,7 +280,7 @@ end [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,ddf,gdf,... - avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); % Read in variabilities. Here we must make some simple calculations. For @@ -296,7 +296,7 @@ data = DiagAverage(data,fln,avg,months,ddf,Dim); [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... - flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); elseif isequal(fln,'Tstd') T = DiagLoad_Local('T' ,dat,dad,grd,itr,ddf,filesuffix,mnchandle); TT = DiagLoad_Local('TT',dat,dad,grd,itr,ddf,filesuffix,mnchandle); @@ -304,26 +304,24 @@ data = DiagAverage(data,fln,avg,months,ddf,Dim); [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... - flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); elseif isequal(fln,'KEpri') U = DiagLoad_Local('uVel',dat,dad,grd,itr,ddf,filesuffix,mnchandle); V = DiagLoad_Local('vVel',dat,dad,grd,itr,ddf,filesuffix,mnchandle); UU = DiagLoad_Local('UU' ,dat,dad,grd,itr,ddf,filesuffix,mnchandle); VV = DiagLoad_Local('VV' ,dat,dad,grd,itr,ddf,filesuffix,mnchandle); if isequal(ddf,'MNC') - U = .5*( U(2:end,:,:,:) + U(1:end-1,:,:,:) ); - V = .5*( V(:,2:end,:,:) + V(:,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,:,:) ); + U = U(1:end-1,:,:,:); UU = UU(1:end-1,:,:,:); + V = V(:,1:end-1,:,:); VV = VV(:,1:end-1,:,:); end - U = DiagAverage(U,fln,avg,months,ddf,Dim); - V = DiagAverage(V,fln,avg,months,ddf,Dim); + U = DiagAverage(U ,fln,avg,months,ddf,Dim); + V = DiagAverage(V ,fln,avg,months,ddf,Dim); UU = DiagAverage(UU,fln,avg,months,ddf,Dim); VV = DiagAverage(VV,fln,avg,months,ddf,Dim); data = sqrt(abs((U.*U + V.*V) - (UU + VV))); [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... - flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); % If the field is not recognized, try best to try and open it. else @@ -394,7 +392,7 @@ if ~isequal(Vector,3) [data,xax,yax,pltslc] = ... DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... - flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); + flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); if DiagDebug, disp([' Debug -- ''data'' size after slice: ',mat2str(size(data))]); end if DiagDebug, disp([' Debug -- ''xax'' size: ',mat2str(size(xax))]); end if DiagDebug, disp([' Debug -- ''yax'' size: ',mat2str(size(yax))]); end @@ -409,16 +407,11 @@ % Thus is merely a local function that calls the load data functions % according to the DataFormat for the data specified by dfm. function data = DiagLoad_Local(fln,dat,dad,grd,itr,dfm,filesuffix,mnchandle) - if isequal(dfm,'MDS') data = rdmds([dad,'/',fln,filesuffix],itr); elseif isequal(dfm,'MNC') - iter = rdmnc_mod([dad,mnchandle],'T'); - iter = iter.T; - [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 + data = rdmnc_mod2([dad,mnchandle],[fln,filesuffix],'iter','T',itr); + if ~isequal(itr,data.iter'), error('Missing iterations in data!'); end eval(['data = data.',fln,filesuffix,';']); else error(['Unrecognized data type: ',dfm]);