| 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') |
| 107 |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
| 108 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 109 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... |
| 110 |
ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
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) |
| 140 |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
| 141 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 142 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... |
| 143 |
ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 144 |
|
|
| 145 |
% Load ice parameters. Note that as the ice variable names appear to be in |
% Load ice parameters. Note that as the ice variable names appear to be in |
| 146 |
% constant flux, this part quickly becomes out of date. |
% constant flux, this part quickly becomes out of date. |
| 155 |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
| 156 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 157 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,... |
| 158 |
ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 159 |
|
|
| 160 |
% Load generic fields where no modifications are needed. |
% Load generic fields where no modifications are needed. |
| 161 |
elseif ismember(fln,{'S','T','Temp','aim_RH','phiHyd','Conv'}) |
elseif ismember(fln,{'S','T','Temp','aim_RH','phiHyd','Conv'}) |
| 163 |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
| 164 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 165 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
| 166 |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 167 |
|
|
| 168 |
% Read vertical velocities, eta. Convert from [P] to [hPa] in atmosphere. |
% Read vertical velocities, eta. Convert from [P] to [hPa] in atmosphere. |
| 169 |
elseif ismember(fln,{'W','wVel','Eta','ETA'}) |
elseif ismember(fln,{'W','wVel','Eta','ETA'}) |
| 172 |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
| 173 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 174 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
| 175 |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 176 |
|
|
| 177 |
% Load horizontal velocities, convert to lat-lon grid. |
% Load horizontal velocities, convert to lat-lon grid. |
| 178 |
elseif ismember(fln,{'U','V','uVel','vVel','fizhi_U','fizhi_V'}) |
elseif ismember(fln,{'U','V','uVel','vVel','fizhi_U','fizhi_V'}) |
| 199 |
end |
end |
| 200 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 201 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
| 202 |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 203 |
|
|
| 204 |
% Meridional overturning. |
% Meridional overturning. |
| 205 |
elseif ismember(fln,{'Bol','Psi','Res'}) |
elseif ismember(fln,{'Bol','Psi','Res'}) |
| 282 |
end |
end |
| 283 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 284 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,ddf,gdf,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,ddf,gdf,... |
| 285 |
avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 286 |
|
|
| 287 |
|
|
| 288 |
% Read in variabilities. Here we must make some simple calculations. For |
% Read in variabilities. Here we must make some simple calculations. For |
| 298 |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
| 299 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 300 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
| 301 |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 302 |
elseif isequal(fln,'Tstd') |
elseif isequal(fln,'Tstd') |
| 303 |
T = DiagLoad_Local('T' ,dat,dad,grd,itr,ddf,filesuffix,mnchandle); |
T = DiagLoad_Local('T' ,dat,dad,grd,itr,ddf,filesuffix,mnchandle); |
| 304 |
TT = DiagLoad_Local('TT',dat,dad,grd,itr,ddf,filesuffix,mnchandle); |
TT = DiagLoad_Local('TT',dat,dad,grd,itr,ddf,filesuffix,mnchandle); |
| 306 |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
data = DiagAverage(data,fln,avg,months,ddf,Dim); |
| 307 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 308 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
| 309 |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 310 |
elseif isequal(fln,'KEpri') |
elseif isequal(fln,'KEpri') |
| 311 |
U = DiagLoad_Local('uVel',dat,dad,grd,itr,ddf,filesuffix,mnchandle); |
U = DiagLoad_Local('uVel',dat,dad,grd,itr,ddf,filesuffix,mnchandle); |
| 312 |
V = DiagLoad_Local('vVel',dat,dad,grd,itr,ddf,filesuffix,mnchandle); |
V = DiagLoad_Local('vVel',dat,dad,grd,itr,ddf,filesuffix,mnchandle); |
| 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))); |
| 324 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 325 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
| 326 |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 327 |
|
|
| 328 |
% If the field is not recognized, try best to try and open it. |
% If the field is not recognized, try best to try and open it. |
| 329 |
else |
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); |
| 400 |
if ~isequal(Vector,3) |
if ~isequal(Vector,3) |
| 401 |
[data,xax,yax,pltslc] = ... |
[data,xax,yax,pltslc] = ... |
| 402 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,... |
| 403 |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
flu,ddf,gdf,avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
| 404 |
if DiagDebug, disp([' Debug -- ''data'' size after slice: ',mat2str(size(data))]); end |
if DiagDebug, disp([' Debug -- ''data'' size after slice: ',mat2str(size(data))]); end |
| 405 |
if DiagDebug, disp([' Debug -- ''xax'' size: ',mat2str(size(xax))]); end |
if DiagDebug, disp([' Debug -- ''xax'' size: ',mat2str(size(xax))]); end |
| 406 |
if DiagDebug, disp([' Debug -- ''yax'' size: ',mat2str(size(yax))]); end |
if DiagDebug, disp([' Debug -- ''yax'' size: ',mat2str(size(yax))]); 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]); |