[Dart-dev] [3641] DART/trunk/diagnostics/matlab: Fixed logic that was causing Stripes to bomb with an even number of levels ,

nancy at ucar.edu nancy at ucar.edu
Mon Nov 3 14:55:11 MST 2008


An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20081103/c46e2781/attachment.html
-------------- next part --------------
Modified: DART/trunk/diagnostics/matlab/plot_bias_xxx_profile.m
===================================================================
--- DART/trunk/diagnostics/matlab/plot_bias_xxx_profile.m	2008-11-03 16:55:23 UTC (rev 3640)
+++ DART/trunk/diagnostics/matlab/plot_bias_xxx_profile.m	2008-11-03 21:55:10 UTC (rev 3641)
@@ -39,21 +39,9 @@
 
 plotdat.fname         = fname;
 plotdat.copystring    = copystring;
-plotdat.bincenters    = getnc(fname,'time');
-plotdat.binedges      = getnc(fname,'time_bounds');
-plotdat.mlevel        = getnc(fname,'mlevel');
-plotdat.plevel        = getnc(fname,'plevel');
-plotdat.plevel_edges  = getnc(fname,'plevel_edges');
-plotdat.hlevel        = getnc(fname,'hlevel');
-plotdat.hlevel_edges  = getnc(fname,'hlevel_edges');
-plotdat.nregions      = length(getnc(fname,'region'));
-plotdat.region_names  = getnc(fname,'region_names');
 
-if (plotdat.nregions == 1)
-   plotdat.region_names = deblank(plotdat.region_names');
-end
+f = netcdf(fname,'nowrite');
 
-f = netcdf(fname,'nowrite');
 plotdat.binseparation      = f.bin_separation(:);
 plotdat.binwidth           = f.bin_width(:);
 time_to_skip               = f.time_to_skip(:);
@@ -65,6 +53,20 @@
 plotdat.latlim2            = f.latlim2(:);
 plotdat.biasconv           = f.bias_convention(:);
 
+plotdat.bincenters         = f{'time',        1}(:);
+plotdat.binedges           = f{'time_bounds', 1}(:);
+plotdat.mlevel             = f{'mlevel',      1}(:);
+plotdat.plevel             = f{'plevel',      1}(:);
+plotdat.plevel_edges       = f{'plevel_edges',1}(:);
+plotdat.hlevel             = f{'hlevel',      1}(:);
+plotdat.hlevel_edges       = f{'hlevel_edges',1}(:);
+plotdat.nregions           = length(f{'region'});
+plotdat.region_names       = char(f{'region_names',1}(:));
+
+if (plotdat.nregions == 1)
+   plotdat.region_names = deblank(plotdat.region_names');
+end
+
 % Coordinate between time types and dates
 
 timeunits    = f{'time'}.units(:);
@@ -125,11 +127,11 @@
       disp(sprintf('%s has no vertical definition.',plotdat.guessvar))
       error('Cannot display this field this way.')
    else
-      plotdat.level_org     = getnc(fname, guessdims{2});
+      plotdat.level_org     = f{guessdims{2}}(:);
       plotdat.level_units   = f{guessdims{2}}.units(:);
       plotdat.nlevels       = length(f{guessdims{2}});
       edgename              = sprintf('%s_edges',guessdims{2});
-      plotdat.level_edges   = getnc(fname,edgename);
+      plotdat.level_edges   = f{edgename}(:);
       plotdat.Yrange        = [min(plotdat.level_edges) max(plotdat.level_edges)];
    end
 
@@ -150,7 +152,10 @@
    
    guess = getnc(fname, plotdat.guessvar,-1,-1,-1,-1,-1,-1,0);  
    analy = getnc(fname, plotdat.analyvar,-1,-1,-1,-1,-1,-1,0); 
-   
+  
+   % guess2 = f{plotdat.guessvar,1}(:); Does not reflect _FillValue
+   % analy2 = f{plotdat.analyvar,1}(:); Does not reflect _FillValue
+ 
    % Check for one region ... if the last dimension is a singleton 
    % dimension, it is auto-squeezed  - which is bad.
    % We want these things to be 3D.
@@ -312,7 +317,7 @@
    set(ax2,'YTick',get(ax1,'YTick'),'YTicklabel',[], ...
            'XTick',          xticks,'XTicklabel',num2str(nicexticks))
        
-   set(get(ax2,'Xlabel'),'String','# of obs (dashed) o=poss, +=used')
+   set(get(ax2,'Xlabel'),'String','# of obs (o=poss, +=used)')
    set(get(ax1,'Xlabel'),'String',plotdat.xlabel)
    set(ax1,'Position',get(ax2,'Position'))
    grid
@@ -426,7 +431,7 @@
 xc = [ x(1) x(2) x(2) x(1) x(1) ];
 
 hold on;
-for i = 1:2:length(edges)
+for i = 1:2:(length(edges)-1)
   yc = [ edges(i) edges(i) edges(i+1) edges(i+1) edges(i) ];
   h = fill(xc,yc,[0.8 0.8 0.8], ...
   'EraseMode','background','EdgeColor','none');

Modified: DART/trunk/diagnostics/matlab/plot_profile.m
===================================================================
--- DART/trunk/diagnostics/matlab/plot_profile.m	2008-11-03 16:55:23 UTC (rev 3640)
+++ DART/trunk/diagnostics/matlab/plot_profile.m	2008-11-03 21:55:10 UTC (rev 3641)
@@ -39,21 +39,9 @@
 
 plotdat.fname         = fname;
 plotdat.copystring    = copystring;
-plotdat.bincenters    = getnc(fname,'time');
-plotdat.binedges      = getnc(fname,'time_bounds');
-plotdat.mlevel        = getnc(fname,'mlevel');
-plotdat.plevel        = getnc(fname,'plevel');
-plotdat.plevel_edges  = getnc(fname,'plevel_edges');
-plotdat.hlevel        = getnc(fname,'hlevel');
-plotdat.hlevel_edges  = getnc(fname,'hlevel_edges');
-plotdat.nregions      = length(getnc(fname,'region'));
-plotdat.region_names  = getnc(fname,'region_names');
 
-if (plotdat.nregions == 1)
-   plotdat.region_names = deblank(plotdat.region_names');
-end
+f = netcdf(fname,'nowrite');
 
-f = netcdf(fname,'nowrite');
 plotdat.binseparation      = f.bin_separation(:);
 plotdat.binwidth           = f.bin_width(:);
 time_to_skip               = f.time_to_skip(:);
@@ -65,6 +53,20 @@
 plotdat.latlim2            = f.latlim2(:);
 plotdat.biasconv           = f.bias_convention(:);
 
+plotdat.bincenters         = f{'time',        1}(:);
+plotdat.binedges           = f{'time_bounds', 1}(:);
+plotdat.mlevel             = f{'mlevel',      1}(:);
+plotdat.plevel             = f{'plevel',      1}(:);
+plotdat.plevel_edges       = f{'plevel_edges',1}(:);
+plotdat.hlevel             = f{'hlevel',      1}(:);
+plotdat.hlevel_edges       = f{'hlevel_edges',1}(:);
+plotdat.nregions           = length(f{'region'});
+plotdat.region_names       = char(f{'region_names',1}(:));
+
+if (plotdat.nregions == 1)
+   plotdat.region_names = deblank(plotdat.region_names');
+end
+
 % Coordinate between time types and dates
 
 timeunits    = f{'time'}.units(:);
@@ -124,11 +126,11 @@
       disp(sprintf('%s has no vertical definition.',plotdat.guessvar))
       error('Cannot display this field this way.')
    else
-      plotdat.level_org     = getnc(fname, guessdims{2});
+      plotdat.level_org     = f{guessdims{2}}(:);
       plotdat.level_units   = f{guessdims{2}}.units(:);
       plotdat.nlevels       = length(f{guessdims{2}});
       edgename              = sprintf('%s_edges',guessdims{2});
-      plotdat.level_edges   = getnc(fname,edgename);
+      plotdat.level_edges   = f{edgename}(:);
       plotdat.Yrange        = [min(plotdat.level_edges) max(plotdat.level_edges)];
    end
 
@@ -149,7 +151,10 @@
    
    guess = getnc(fname, plotdat.guessvar,-1,-1,-1,-1,-1,-1,0);  
    analy = getnc(fname, plotdat.analyvar,-1,-1,-1,-1,-1,-1,0); 
-   
+  
+   % guess2 = f{plotdat.guessvar,1}(:); Does not reflect _FillValue
+   % analy2 = f{plotdat.analyvar,1}(:); Does not reflect _FillValue
+ 
    % Check for one region ... if the last dimension is a singleton 
    % dimension, it is auto-squeezed  - which is bad.
    % We want these things to be 3D.
@@ -306,7 +311,7 @@
    set(ax2,'YTick',get(ax1,'YTick'),'YTicklabel',[], ...
            'XTick',          xticks,'XTicklabel',num2str(nicexticks))
        
-   set(get(ax2,'Xlabel'),'String','# of obs (dashed) o=poss, +=used')
+   set(get(ax2,'Xlabel'),'String','# of obs (o=poss, +=used)')
    set(get(ax1,'Xlabel'),'String',plotdat.xlabel)
    set(ax1,'Position',get(ax2,'Position'))
    grid
@@ -420,7 +425,7 @@
 xc = [ x(1) x(2) x(2) x(1) x(1) ];
 
 hold on;
-for i = 1:2:length(edges)
+for i = 1:2:(length(edges)-1)
   yc = [ edges(i) edges(i) edges(i+1) edges(i+1) edges(i) ];
   h = fill(xc,yc,[0.8 0.8 0.8], ...
   'EraseMode','background','EdgeColor','none');

Modified: DART/trunk/diagnostics/matlab/plot_rmse_xxx_profile.m
===================================================================
--- DART/trunk/diagnostics/matlab/plot_rmse_xxx_profile.m	2008-11-03 16:55:23 UTC (rev 3640)
+++ DART/trunk/diagnostics/matlab/plot_rmse_xxx_profile.m	2008-11-03 21:55:10 UTC (rev 3641)
@@ -39,21 +39,9 @@
 
 plotdat.fname         = fname;
 plotdat.copystring    = copystring;
-plotdat.bincenters    = getnc(fname,'time');
-plotdat.binedges      = getnc(fname,'time_bounds');
-plotdat.mlevel        = getnc(fname,'mlevel');
-plotdat.plevel        = getnc(fname,'plevel');
-plotdat.plevel_edges  = getnc(fname,'plevel_edges');
-plotdat.hlevel        = getnc(fname,'hlevel');
-plotdat.hlevel_edges  = getnc(fname,'hlevel_edges');
-plotdat.nregions      = length(getnc(fname,'region'));
-plotdat.region_names  = getnc(fname,'region_names');
 
-if (plotdat.nregions == 1)
-   plotdat.region_names = deblank(plotdat.region_names');
-end
+f = netcdf(fname,'nowrite');
 
-f = netcdf(fname,'nowrite');
 plotdat.binseparation      = f.bin_separation(:);
 plotdat.binwidth           = f.bin_width(:);
 time_to_skip               = f.time_to_skip(:);
@@ -63,8 +51,22 @@
 plotdat.lonlim2            = f.lonlim2(:);
 plotdat.latlim1            = f.latlim1(:);
 plotdat.latlim2            = f.latlim2(:);
-plotdat.rmseconv           = f.rmse_convention(:);
+plotdat.biasconv           = f.bias_convention(:);
 
+plotdat.bincenters         = f{'time',        1}(:);
+plotdat.binedges           = f{'time_bounds', 1}(:);
+plotdat.mlevel             = f{'mlevel',      1}(:);
+plotdat.plevel             = f{'plevel',      1}(:);
+plotdat.plevel_edges       = f{'plevel_edges',1}(:);
+plotdat.hlevel             = f{'hlevel',      1}(:);
+plotdat.hlevel_edges       = f{'hlevel_edges',1}(:);
+plotdat.nregions           = length(f{'region'});
+plotdat.region_names       = char(f{'region_names',1}(:));
+
+if (plotdat.nregions == 1)
+   plotdat.region_names = deblank(plotdat.region_names');
+end
+
 % Coordinate between time types and dates
 
 timeunits    = f{'time'}.units(:);
@@ -125,11 +127,11 @@
       disp(sprintf('%s has no vertical definition.',plotdat.guessvar))
       error('Cannot display this field this way.')
    else
-      plotdat.level_org     = getnc(fname, guessdims{2});
+      plotdat.level_org     = f{guessdims{2}}(:);
       plotdat.level_units   = f{guessdims{2}}.units(:);
       plotdat.nlevels       = length(f{guessdims{2}});
       edgename              = sprintf('%s_edges',guessdims{2});
-      plotdat.level_edges   = getnc(fname,edgename);
+      plotdat.level_edges   = f{edgename}(:);
       plotdat.Yrange        = [min(plotdat.level_edges) max(plotdat.level_edges)];
    end
 
@@ -150,7 +152,10 @@
    
    guess = getnc(fname, plotdat.guessvar,-1,-1,-1,-1,-1,-1,0);  
    analy = getnc(fname, plotdat.analyvar,-1,-1,-1,-1,-1,-1,0); 
-   
+  
+   % guess2 = f{plotdat.guessvar,1}(:); Does not reflect _FillValue
+   % analy2 = f{plotdat.analyvar,1}(:); Does not reflect _FillValue
+ 
    % Check for one region ... if the last dimension is a singleton 
    % dimension, it is auto-squeezed  - which is bad.
    % We want these things to be 3D.
@@ -315,7 +320,7 @@
    set(ax2,'YTick',get(ax1,'YTick'),'YTicklabel',[], ...
            'XTick',          xticks,'XTicklabel',num2str(nicexticks))
        
-   set(get(ax2,'Xlabel'),'String','# of obs (dashed) o=poss, +=used')
+   set(get(ax2,'Xlabel'),'String','# of obs (o=poss, +=used)')
    set(get(ax1,'Xlabel'),'String',plotdat.xlabel)
    set(ax1,'Position',get(ax2,'Position'))
    grid
@@ -429,7 +434,7 @@
 xc = [ x(1) x(2) x(2) x(1) x(1) ];
 
 hold on;
-for i = 1:2:length(edges)
+for i = 1:2:(length(edges)-1)
   yc = [ edges(i) edges(i) edges(i+1) edges(i+1) edges(i) ];
   h = fill(xc,yc,[0.8 0.8 0.8], ...
   'EraseMode','background','EdgeColor','none');


More information about the Dart-dev mailing list