function [XC,XG,YC,YG,Ylat,ZC,ZF,RAC,drC,drF,HFacC,HFacW,HFacS,dxG,dyG,dxC,dyC] = ... DiagLoadGridData(LoadGridData,grd,gdf,flu,GridSuffix,ZcordFile) % Load grid data. % If LoadGridData is turned on, load grid data from the model output files. % If it is turned off, load it from the data file where saved from a % previous loading of the raw data. The file name (and path) of this file % is set in the DiagGenParam file. if LoadGridData % Load y-axis for CS zonal average calculation. load('ZonAvgLat'); if isequal(gdf,'MDS') XC = rdmds([grd,'/','XC' ]); YC = rdmds([grd,'/','YC' ]); XG = rdmds([grd,'/','XG' ]); YG = rdmds([grd,'/','YG' ]); dxC = rdmds([grd,'/','DXC']); dyC = rdmds([grd,'/','DYC']); dxG = rdmds([grd,'/','DXG']); dyG = rdmds([grd,'/','DYG']); RAC = rdmds([grd,'/','RAC']); HFacC = rdmds([grd,'/','hFacC']); HFacS = rdmds([grd,'/','hFacS']); HFacW = rdmds([grd,'/','hFacW']); % Information for z-axis. if isequal(ZcordFile,'') load(['Zcord',flu,GridSuffix,'.mat']); else load(ZcordFile); end elseif isequal(gdf,'MNC') data = rdmnc_mod([grd,'grid.*']); XC = data.XC; % [192x32 double] YC = data.YC; % [192x32 double] XG = data.XG; XG = XG(1:end-1,1:end-1); % [193x33 double] -> [192x32 double] YG = data.YG; YG = YG(1:end-1,1:end-1); % [193x33 double] -> [192x32 double] dxC = data.dxC; % [192x32 double] dyC = data.dyC; % [192x32 double] dxG = data.dxG; % [192x32 double] dyG = data.dyG; % [192x32 double] RAC = data.rA; % [192x32 double] HFacC = data.HFacC; % [192x32x15 double] HFacW = data.HFacW; % [192x32x15 double] HFacS = data.HFacS; % [192x32x15 double] ZC = data.RC; ZF = data.RF; drC = data.drC; drF = data.drF; end save(['GridData',flu,GridSuffix,'.mat'],... 'XC','XG','YC','YG','Ylat','ZC','ZF','RAC','drC','drF',... 'HFacC','HFacW','HFacS','dxG','dyG','dxC','dyC'); % If LoadGridData is turned off, load it from the data file where saved % from a previous loading of the raw data. The file name (and path) of % this file is set in the DiagGenParam file. else load(['GridData',flu,GridSuffix,'.mat']) end