--- MITgcm_contrib/enderton/Diagnostics/DiagSlice.m 2005/06/28 21:33:52 1.4 +++ MITgcm_contrib/enderton/Diagnostics/DiagSlice.m 2005/08/10 20:17:17 1.6 @@ -1,6 +1,6 @@ function [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); % Function: DiagSlice % Author: Daniel Enderton @@ -48,23 +48,23 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % All surface plots are direct cube sphere outputs, and therefore must have -% the dimensions defined in 'hres' in 'DiagLoadGridData'. This is commonly -% [192,32]. If the 'pst' is 'Grd' or 'Int', everything is already all set -% since those handle the cubed sphere data. If the 'pst' is 'Con' or 'Cnf', -% convert data to a lat-lon grid so that it can easily be contours. +% the dimensions of the cube grid data. If the 'pst' is 'Grd' or 'Int', +% everything is already all set since those handle the cubed sphere data. +% If the 'pst' is 'Con' or 'Cnf', convert data to a lat-lon grid so that it +% can easily be contoured. if isequal(slc,'Sur') - if ismember(fln,{'TX','TY','USTR','VSTR'}) + if ismember(fln,{'TX','TY','USTR','VSTR'}) | ~isequal(Vector,0) data = data'; xax = XL; yax = YL; - elseif ~isequal(datasize,[faces*hres,hres]) + elseif ~isequal(datasize,size(XC)) error('Incorrect dimensions for slc: ',slc); else if ismember(pst,{'Grd','Int'}) if isequal(pst,'Grd'), - xax = XG(1:faces*hres,1:hres); - yax = YG(1:faces*hres,1:hres); + xax = XG; + yax = YG; elseif isequal(pst,'Int'), - xax = XC(1:faces*hres,1:hres); - yax = YC(1:faces*hres,1:hres); + xax = XC; + yax = YC; end elseif ismember(pst,{'Con','Cnf'}) data = cube2latlon(XC,YC,data,XL,YL)'; @@ -81,15 +81,16 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % When computing a zonal average, there are many different options for the -% initial data. If the data is cube-sphere, it could be of the size -% [hres,z-axis length] or just [hres]. In either case, 'calc_ZonAv_CS' (a +% initial data. If the data is cube-sphere, it could be the shape of XC, +% possibly also with a vertical axis. In either case, 'calc_ZonAv_CS' (a % nifty zonally averaging script from JMC) is called to compute the zonal % average for raw cube sphere data. For horizontal velocities, the data % could be of the size [length(XL),length(YL),z-axis length], in which case % you just need to take the mean over the longitude axis (always 1). elseif isequal(slc,'Zon') - if isequal(datasize(1:2),[faces*hres,hres]) + if isequal(datasize(1:2),size(XC)) if isequal(flu,'O'), nBas = 0; end + if isequal(flu,'A'), nBas = 0; end [data,dump1,dump2] = ... calc_ZonAv_CS(data,kpr,kwr,nBas,XC,YC,XG,YG,RAC,dad,HFacC); if isequal(avg,'Tse') @@ -152,11 +153,11 @@ data = data'; xax = XL; yax = YL; elseif ismember(pst,{'Grd','Int'}) if isequal(pst,'Grd'), - xax = XG(1:faces*hres,1:hres); - yax = YG(1:faces*hres,1:hres); + xax = XG; + yax = YG; elseif isequal(pst,'Int'), - xax = XC(1:faces*hres,1:hres); - yax = YC(1:faces*hres,1:hres); + xax = XC; + yax = YC; end elseif ismember(pst,{'Con','Cnf'}) data = cube2latlon(XC,YC,data,XL,YL)'; xax = XL; yax = YL;