| 1 |
function [XC,XG,YC,YG,Ylat,ZC,ZF,RAC,drC,drF,HFacC,HFacW,HFacS,dxG,dyG,dxC,dyC] = ... |
| 2 |
DiagLoadGridData(LoadGridData,grd,gdf,flu,GridSuffix,ZcordFile) |
| 3 |
|
| 4 |
% Load grid data. |
| 5 |
|
| 6 |
% If LoadGridData is turned on, load grid data from the model output files. |
| 7 |
% If it is turned off, load it from the data file where saved from a |
| 8 |
% previous loading of the raw data. The file name (and path) of this file |
| 9 |
% is set in the DiagGenParam file. |
| 10 |
if LoadGridData |
| 11 |
|
| 12 |
% Load y-axis for CS zonal average calculation. |
| 13 |
load('ZonAvgLat'); |
| 14 |
|
| 15 |
if isequal(gdf,'MDS') |
| 16 |
XC = rdmds([grd,'/','XC' ]); |
| 17 |
YC = rdmds([grd,'/','YC' ]); |
| 18 |
XG = rdmds([grd,'/','XG' ]); |
| 19 |
YG = rdmds([grd,'/','YG' ]); |
| 20 |
dxC = rdmds([grd,'/','DXC']); |
| 21 |
dyC = rdmds([grd,'/','DYC']); |
| 22 |
dxG = rdmds([grd,'/','DXG']); |
| 23 |
dyG = rdmds([grd,'/','DYG']); |
| 24 |
RAC = rdmds([grd,'/','RAC']); |
| 25 |
HFacC = rdmds([grd,'/','hFacC']); |
| 26 |
HFacS = rdmds([grd,'/','hFacS']); |
| 27 |
HFacW = rdmds([grd,'/','hFacW']); |
| 28 |
|
| 29 |
% Information for z-axis. |
| 30 |
if isequal(ZcordFile,'') |
| 31 |
load(['Zcord',flu,GridSuffix,'.mat']); |
| 32 |
else |
| 33 |
load(ZcordFile); |
| 34 |
end |
| 35 |
|
| 36 |
elseif isequal(gdf,'MNC') |
| 37 |
data = rdmnc_mod([grd,'grid.*']); |
| 38 |
XC = data.XC; % [192x32 double] |
| 39 |
YC = data.YC; % [192x32 double] |
| 40 |
XG = data.XG; XG = XG(1:end-1,1:end-1); % [193x33 double] -> [192x32 double] |
| 41 |
YG = data.YG; YG = YG(1:end-1,1:end-1); % [193x33 double] -> [192x32 double] |
| 42 |
dxC = data.dxC; % [192x32 double] |
| 43 |
dyC = data.dyC; % [192x32 double] |
| 44 |
dxG = data.dxG; % [192x32 double] |
| 45 |
dyG = data.dyG; % [192x32 double] |
| 46 |
RAC = data.rA; % [192x32 double] |
| 47 |
HFacC = data.HFacC; % [192x32x15 double] |
| 48 |
HFacW = data.HFacW; % [192x32x15 double] |
| 49 |
HFacS = data.HFacS; % [192x32x15 double] |
| 50 |
ZC = data.RC; |
| 51 |
ZF = data.RF; |
| 52 |
drC = data.drC; |
| 53 |
drF = data.drF; |
| 54 |
end |
| 55 |
|
| 56 |
save(['GridData',flu,GridSuffix,'.mat'],... |
| 57 |
'XC','XG','YC','YG','Ylat','ZC','ZF','RAC','drC','drF',... |
| 58 |
'HFacC','HFacW','HFacS','dxG','dyG','dxC','dyC'); |
| 59 |
|
| 60 |
% If LoadGridData is turned off, load it from the data file where saved |
| 61 |
% from a previous loading of the raw data. The file name (and path) of |
| 62 |
% this file is set in the DiagGenParam file. |
| 63 |
else |
| 64 |
load(['GridData',flu,GridSuffix,'.mat']) |
| 65 |
end |