1 |
function [data,xax,yax,pltslc] = ... |
function [data,xax,yax,pltslc] = ... |
2 |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,ddf,gdf,... |
DiagSlice(data,fln,trl,dat,dad,grd,itr,tst,flu,ddf,gdf,... |
3 |
avg,slc,pst,LoadGridData,GridSuffix,ZcordFile); |
avg,slc,pst,LoadGridData,GridSuffix,ZcordFile,Vector,FieldName); |
4 |
|
|
5 |
% Function: DiagSlice |
% Function: DiagSlice |
6 |
% Author: Daniel Enderton |
% Author: Daniel Enderton |
48 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
49 |
|
|
50 |
% All surface plots are direct cube sphere outputs, and therefore must have |
% All surface plots are direct cube sphere outputs, and therefore must have |
51 |
% the dimensions defined in 'hres' in 'DiagLoadGridData'. This is commonly |
% the dimensions of the cube grid data. If the 'pst' is 'Grd' or 'Int', |
52 |
% [192,32]. If the 'pst' is 'Grd' or 'Int', everything is already all set |
% everything is already all set since those handle the cubed sphere data. |
53 |
% since those handle the cubed sphere data. If the 'pst' is 'Con' or 'Cnf', |
% If the 'pst' is 'Con' or 'Cnf', convert data to a lat-lon grid so that it |
54 |
% convert data to a lat-lon grid so that it can easily be contours. |
% can easily be contoured. |
55 |
if isequal(slc,'Sur') |
if isequal(slc,'Sur') |
56 |
if ismember(fln,{'TX','TY','USTR','VSTR'}) |
if ismember(fln,{'TX','TY','USTR','VSTR'}) | ~isequal(Vector,0) |
57 |
data = data'; xax = XL; yax = YL; |
data = data'; xax = XL; yax = YL; |
58 |
elseif ~isequal(datasize,[faces*hres,hres]) |
elseif ~isequal(datasize,size(XC)) |
59 |
error('Incorrect dimensions for slc: ',slc); |
error('Incorrect dimensions for slc: ',slc); |
60 |
else |
else |
61 |
if ismember(pst,{'Grd','Int'}) |
if ismember(pst,{'Grd','Int'}) |
62 |
if isequal(pst,'Grd'), |
if isequal(pst,'Grd'), |
63 |
xax = XG(1:faces*hres,1:hres); |
xax = XG; |
64 |
yax = YG(1:faces*hres,1:hres); |
yax = YG; |
65 |
elseif isequal(pst,'Int'), |
elseif isequal(pst,'Int'), |
66 |
xax = XC(1:faces*hres,1:hres); |
xax = XC; |
67 |
yax = YC(1:faces*hres,1:hres); |
yax = YC; |
68 |
end |
end |
69 |
elseif ismember(pst,{'Con','Cnf'}) |
elseif ismember(pst,{'Con','Cnf'}) |
70 |
data = cube2latlon(XC,YC,data,XL,YL)'; |
data = cube2latlon(XC,YC,data,XL,YL)'; |
81 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
82 |
|
|
83 |
% When computing a zonal average, there are many different options for the |
% When computing a zonal average, there are many different options for the |
84 |
% initial data. If the data is cube-sphere, it could be of the size |
% initial data. If the data is cube-sphere, it could be the shape of XC, |
85 |
% [hres,z-axis length] or just [hres]. In either case, 'calc_ZonAv_CS' (a |
% possibly also with a vertical axis. In either case, 'calc_ZonAv_CS' (a |
86 |
% nifty zonally averaging script from JMC) is called to compute the zonal |
% nifty zonally averaging script from JMC) is called to compute the zonal |
87 |
% average for raw cube sphere data. For horizontal velocities, the data |
% average for raw cube sphere data. For horizontal velocities, the data |
88 |
% could be of the size [length(XL),length(YL),z-axis length], in which case |
% could be of the size [length(XL),length(YL),z-axis length], in which case |
89 |
% you just need to take the mean over the longitude axis (always 1). |
% you just need to take the mean over the longitude axis (always 1). |
90 |
elseif isequal(slc,'Zon') |
elseif isequal(slc,'Zon') |
91 |
if isequal(datasize(1:2),[faces*hres,hres]) |
if isequal(datasize(1:2),size(XC)) |
92 |
if isequal(flu,'O'), nBas = 0; end |
if isequal(flu,'O'), nBas = 0; end |
93 |
|
if isequal(flu,'A'), nBas = 0; end |
94 |
[data,dump1,dump2] = ... |
[data,dump1,dump2] = ... |
95 |
calc_ZonAv_CS(data,kpr,kwr,nBas,XC,YC,XG,YG,RAC,dad,HFacC); |
calc_ZonAv_CS(data,kpr,kwr,nBas,XC,YC,XG,YG,RAC,dad,HFacC); |
96 |
if isequal(avg,'Tse') |
if isequal(avg,'Tse') |
153 |
data = data'; xax = XL; yax = YL; |
data = data'; xax = XL; yax = YL; |
154 |
elseif ismember(pst,{'Grd','Int'}) |
elseif ismember(pst,{'Grd','Int'}) |
155 |
if isequal(pst,'Grd'), |
if isequal(pst,'Grd'), |
156 |
xax = XG(1:faces*hres,1:hres); |
xax = XG; |
157 |
yax = YG(1:faces*hres,1:hres); |
yax = YG; |
158 |
elseif isequal(pst,'Int'), |
elseif isequal(pst,'Int'), |
159 |
xax = XC(1:faces*hres,1:hres); |
xax = XC; |
160 |
yax = YC(1:faces*hres,1:hres); |
yax = YC; |
161 |
end |
end |
162 |
elseif ismember(pst,{'Con','Cnf'}) |
elseif ismember(pst,{'Con','Cnf'}) |
163 |
data = cube2latlon(XC,YC,data,XL,YL)'; xax = XL; yax = YL; |
data = cube2latlon(XC,YC,data,XL,YL)'; xax = XL; yax = YL; |