| 40 | 
 % Loop over subplots and make plots. | 
 % Loop over subplots and make plots. | 
| 41 | 
 for inrow = 1:nrow | 
 for inrow = 1:nrow | 
| 42 | 
      | 
      | 
| 43 | 
     nexp = length(page{inrow}); if nexp ~= 1, nexp = nexp - 1; end | 
     ntrl = length(page{inrow}); if ntrl ~= 1, ntrl = ntrl - 1; end | 
| 44 | 
     if nexp == 1, cmp = 'Sep'; else, cmp = page{inrow}{end}; end | 
     if ntrl == 1, cmp = 'Sep'; else, cmp = page{inrow}{end}; end | 
| 45 | 
     if nexp == 1, ncol = 1; elseif cmp == 'Sbs', ncol = nexp; else ncol = 1; end | 
     if ntrl == 1, ncol = 1; elseif isequal(cmp,'Sbs'), ncol = ntrl; else ncol = 1; end | 
| 46 | 
      | 
      | 
| 47 | 
     dx = (1-dxl-dxr-(ncol-1)*dxm)/ncol; | 
     dx = (1-dxl-dxr-(ncol-1)*dxm)/ncol; | 
| 48 | 
     dy = (1-dyb-dyt-(nrow-1)*dym)/nrow; | 
     dy = (1-dyb-dyt-(nrow-1)*dym)/nrow; | 
| 49 | 
      | 
      | 
| 50 | 
     for incol = 1:ncol | 
     for incol = 1:ncol | 
| 51 | 
          | 
          | 
| 52 | 
         if size(data{inrow}{incol}) == [6*hres,hres], isCS = 1; else, isCS = 0; end | 
         % Very crude test to see if cube sphere, must be fixed! | 
| 53 | 
  | 
         test = size(data{inrow}{incol}); | 
| 54 | 
  | 
         if test(1)./test(2) == 6, isCS = 1; else, isCS = 0; end | 
| 55 | 
         fln = page{inrow}{incol}{ifln}; | 
         fln = page{inrow}{incol}{ifln}; | 
| 56 | 
         pst = page{inrow}{incol}{ipst}; | 
         pst = page{inrow}{incol}{ipst}; | 
| 57 | 
         flu = page{inrow}{incol}{iflu}; | 
         flu = page{inrow}{incol}{iflu}; | 
| 58 | 
          | 
          | 
| 59 | 
         % Set panel settings to default values, override with optional | 
         % Set panel settings to default values, override with optional | 
| 60 | 
         % settings. | 
         % settings. | 
| 61 | 
  | 
         DiagPlotDefaults; | 
| 62 | 
                 ExpInfo = page{inrow}{incol}; | 
                 ExpInfo = page{inrow}{incol}; | 
| 63 | 
                 for iarg = 14:2:length(ExpInfo) | 
                 for iarg = 14:2:length(ExpInfo) | 
| 64 | 
             if ~ismember(ExpInfo{iarg},diagrunparam) | 
             if ~ismember(ExpInfo{iarg},diagrunparam) | 
| 77 | 
               '; Cmp: ',cmp]); | 
               '; Cmp: ',cmp]); | 
| 78 | 
          | 
          | 
| 79 | 
         % Load contour intervals, units (loaded in 'DiagFieldParam[A,O]'). | 
         % Load contour intervals, units (loaded in 'DiagFieldParam[A,O]'). | 
| 80 | 
         try, contint; catch | 
         if ~isequal(cmp,'Dif') | 
| 81 | 
             try, eval(['contint = ',fln,'contour',flu,';']); | 
             try, contint; catch | 
| 82 | 
             catch, disp(['***Warning***  No contour information for ',fln]); | 
                 try, eval(['contint = ',fln,'contour',flu,';']); | 
| 83 | 
                    disp(['               Using 10 generic contour levels.']); | 
                 catch, disp(['***Warning***  No contour information for ',fln]); | 
| 84 | 
                    contint = 10; end, end | 
                        disp(['               Using 10 generic contour levels.']); | 
| 85 | 
  | 
                        contint = 10; end, end | 
| 86 | 
  | 
         end | 
| 87 | 
         try, units; catch | 
         try, units; catch | 
| 88 | 
             try, eval(['units = ',fln,'units',flu,';']); | 
             try, eval(['units = ',fln,'units',flu,';']); | 
| 89 | 
             catch, disp(['***Warning***  No unit information found for ',fln]); | 
             catch, disp(['***Warning***  No unit information found for ',fln]); | 
| 90 | 
                    disp(['               Using question mark.']); | 
                    disp(['               Using question mark.']); | 
| 91 | 
                    units = '?'; end, end | 
                    units = '?'; end, end | 
| 92 | 
        | 
          | 
| 93 | 
         xi = dxl + (incol-1)*(dx+dxm); | 
         xi = dxl + (incol-1)*(dx+dxm); | 
| 94 | 
         yi = 1-dyt-inrow*dy-(inrow-1)*dym; | 
         yi = 1-dyt-inrow*dy-(inrow-1)*dym; | 
| 95 | 
          | 
          | 
| 96 | 
         isp = (inrow-1)*ncol+incol; | 
         isp = (inrow-1)*ncol+incol; | 
| 97 | 
  | 
         if DiagDebug, disp(['  DiagDebug:  Subplot:  ',mat2str([nrow,ncol,isp])]); end | 
| 98 | 
  | 
         if DiagDebug, disp(['  DiagDebug:  SP Range: ',mat2str([xi,yi,dx,dy])]); end | 
| 99 | 
         subplot(nrow,ncol,isp); hold on; | 
         subplot(nrow,ncol,isp); hold on; | 
| 100 | 
         set(gca,'position',[xi,yi,dx,dy],'fontsize',fs_axis); | 
         set(gca,'position',[xi,yi,dx,dy],'fontsize',fs_axis); | 
| 101 | 
          | 
          | 
| 102 | 
  | 
         if Coast | 
| 103 | 
  | 
             fac = pi./180; | 
| 104 | 
  | 
             xax{inrow}{incol} = xax{inrow}{incol}.*fac; | 
| 105 | 
  | 
             yax{inrow}{incol} = yax{inrow}{incol}.*fac; | 
| 106 | 
  | 
         else, fac = 1; end | 
| 107 | 
  | 
          | 
| 108 | 
         % (Re)set axes and color axis -- Accounts for things like a possible | 
         % (Re)set axes and color axis -- Accounts for things like a possible | 
| 109 | 
         % colorbar, or trimming the axis in certain ways. | 
         % colorbar, or trimming the axis in certain ways. | 
| 110 | 
         % Apply desired colorbar, contour label, tick labels, box, grid, and | 
         % Apply desired colorbar, contour label, tick labels, box, grid, and | 
| 113 | 
         DiagPlotResetAxes; | 
         DiagPlotResetAxes; | 
| 114 | 
         DiagPlotMisc; | 
         DiagPlotMisc; | 
| 115 | 
         DiagPlotTitles; | 
         DiagPlotTitles; | 
| 116 | 
         clear contint units | 
         clear contint units crange | 
| 117 | 
     end | 
     end | 
| 118 | 
 end | 
 end | 
| 119 | 
  | 
  | 
| 124 | 
  | 
  | 
| 125 | 
 % Save plot as desired. | 
 % Save plot as desired. | 
| 126 | 
 if SavePlots | 
 if SavePlots | 
| 127 | 
     outputfile = [outputdir,'/',pagename,'.eps']; | 
     if isequal(outputdir,'') | 
| 128 | 
  | 
         outputfile = [pagename,'.eps']; | 
| 129 | 
  | 
     else | 
| 130 | 
  | 
         outputfile = [outputdir,'/',pagename,'.eps']; | 
| 131 | 
  | 
     end | 
| 132 | 
     print('-depsc2',outputfile); | 
     print('-depsc2',outputfile); | 
| 133 | 
 end | 
 end |