--- MITgcm_contrib/enderton/Diagnostics/DiagPlot.m 2005/08/10 19:58:03 1.6 +++ MITgcm_contrib/enderton/Diagnostics/DiagPlot.m 2005/09/13 19:32:03 1.7 @@ -49,71 +49,75 @@ for incol = 1:ncol - % Very crude test to see if cube sphere, must be fixed! - test = size(data{inrow}{incol}); - if test(1)./test(2) == 6, isCS = 1; else, isCS = 0; end - fln = page{inrow}{incol}{ifln}; - pst = page{inrow}{incol}{ipst}; - flu = page{inrow}{incol}{iflu}; + if ~isequal(data{inrow}{incol},'Empty') - % Set panel settings to default values, override with optional - % settings. - DiagPlotDefaults; - ExpInfo = page{inrow}{incol}; - for iarg = 14:2:length(ExpInfo) - if ~ismember(ExpInfo{iarg},diagrunparam) - ivalue=ExpInfo{iarg+1}; - if isstr(ivalue), fvalue=['''',ivalue,'''']; - elseif prod(size(ivalue))>1, fvalue=mat2str(ivalue); - else fvalue=num2str(ivalue); end - evalexpr = [ExpInfo{iarg},'=',fvalue,';']; - if DiagDebug, disp([' Optional plot parameter evaluation: ',evalexpr]); end - eval(evalexpr); - end - end - - disp([' Row: ',num2str(inrow),'/',num2str(nrow),... - '; Col: ',num2str(incol),'/',num2str(ncol),... - '; Cmp: ',cmp]); - - % Load contour intervals, units (loaded in 'DiagFieldParam[A,O]'). - if ~isequal(cmp,'Dif') - try, contint; catch - try, eval(['contint = ',fln,'contour',flu,';']); - catch, disp(['***Warning*** No contour information for ',fln]); - disp([' Using 10 generic contour levels.']); - contint = 10; end, end + % Very crude test to see if cube sphere, must be fixed! + test = size(data{inrow}{incol}); + if test(1)./test(2) == 6, isCS = 1; else, isCS = 0; end + fln = page{inrow}{incol}{ifln}; + pst = page{inrow}{incol}{ipst}; + flu = page{inrow}{incol}{iflu}; + + % Set panel settings to default values, override with optional + % settings. + DiagPlotDefaults; + ExpInfo = page{inrow}{incol}; + for iarg = 14:2:length(ExpInfo) + if ~ismember(ExpInfo{iarg},diagrunparam) + ivalue=ExpInfo{iarg+1}; + if isstr(ivalue), fvalue=['''',ivalue,'''']; + elseif prod(size(ivalue))>1, fvalue=mat2str(ivalue); + else fvalue=num2str(ivalue); end + evalexpr = [ExpInfo{iarg},'=',fvalue,';']; + if DiagDebug, disp([' Optional plot parameter evaluation: ',evalexpr]); end + eval(evalexpr); + end + end + + disp([' Row: ',num2str(inrow),'/',num2str(nrow),... + '; Col: ',num2str(incol),'/',num2str(ncol),... + '; Cmp: ',cmp]); + + % Load contour intervals, units (loaded in + % 'DiagFieldParam[A,O]'). + if ~isequal(cmp,'Dif') + try, contint; catch + try, eval(['contint = ',fln,'contour',flu,';']); + catch, disp(['***Warning*** No contour information for ',fln]); + disp([' Using 10 generic contour levels.']); + contint = 10; end, end + else, try, contint; catch, contint = 10; end, end + try, units; catch + try, eval(['units = ',fln,'units',flu,';']); + catch, disp(['***Warning*** No unit information found for ',fln]); + disp([' Using question mark.']); + units = '?'; end, end + + xi = dxl + (incol-1)*(dx+dxm); + yi = 1-dyt-inrow*dy-(inrow-1)*dym; + + isp = (inrow-1)*ncol+incol; + if DiagDebug, disp([' DiagDebug: Subplot: ',mat2str([nrow,ncol,isp])]); end + if DiagDebug, disp([' DiagDebug: SP Range: ',mat2str([xi,yi,dx,dy])]); end + subplot(nrow,ncol,isp); hold on; + set(gca,'position',[xi,yi,dx,dy],'fontsize',fs_axis); + + if Coast + fac = pi./180; + xax{inrow}{incol} = xax{inrow}{incol}.*fac; + yax{inrow}{incol} = yax{inrow}{incol}.*fac; + else, fac = 1; end + + % (Re)set axes and color axis -- Accounts for things like a possible + % colorbar, or trimming the axis in certain ways. + % Apply desired colorbar, contour label, tick labels, box, grid, and + % other such odds and ends. + DiagPlotMakePlot; + DiagPlotResetAxes; + DiagPlotMisc; + DiagPlotTitles; + clear contint units crange end - try, units; catch - try, eval(['units = ',fln,'units',flu,';']); - catch, disp(['***Warning*** No unit information found for ',fln]); - disp([' Using question mark.']); - units = '?'; end, end - - xi = dxl + (incol-1)*(dx+dxm); - yi = 1-dyt-inrow*dy-(inrow-1)*dym; - - isp = (inrow-1)*ncol+incol; - if DiagDebug, disp([' DiagDebug: Subplot: ',mat2str([nrow,ncol,isp])]); end - if DiagDebug, disp([' DiagDebug: SP Range: ',mat2str([xi,yi,dx,dy])]); end - subplot(nrow,ncol,isp); hold on; - set(gca,'position',[xi,yi,dx,dy],'fontsize',fs_axis); - - if Coast - fac = pi./180; - xax{inrow}{incol} = xax{inrow}{incol}.*fac; - yax{inrow}{incol} = yax{inrow}{incol}.*fac; - else, fac = 1; end - - % (Re)set axes and color axis -- Accounts for things like a possible - % colorbar, or trimming the axis in certain ways. - % Apply desired colorbar, contour label, tick labels, box, grid, and - % other such odds and ends. - DiagPlotMakePlot; - DiagPlotResetAxes; - DiagPlotMisc; - DiagPlotTitles; - clear contint units crange end end