[Dart-dev] DART/branches Revision: 13104

dart at ucar.edu dart at ucar.edu
Wed Apr 10 09:20:58 MDT 2019


thoar at ucar.edu
2019-04-10 09:20:58 -0600 (Wed, 10 Apr 2019)
247
added error check to see if requested level is possible

For variables that only have a single level, it is plotted, regardless 
of the value of the level requested. This enables processing
all the variables in the file with a minimum of effort.




Modified: DART/branches/qc8diags/diagnostics/matlab/plot_evolution.m
===================================================================
--- DART/branches/qc8diags/diagnostics/matlab/plot_evolution.m	2019-04-09 20:46:23 UTC (rev 13103)
+++ DART/branches/qc8diags/diagnostics/matlab/plot_evolution.m	2019-04-10 15:20:58 UTC (rev 13104)
@@ -216,9 +216,18 @@
     else
         plotdat.level       = ncread(fname, dimnames{2});
         plotdat.level_units = nc_read_att(fname, dimnames{2}, 'units');
+        nlevels             = length(plotdat.level); 
+        if (p.Results.level < 0 )
+            % use all the levels
+        elseif (p.Results.level > 0 && p.Results.level < nlevels)
+            plotdat.level   = p.Results.level;
+        else
+            error('%d is not a valid level for %s',p.Results.level,plotdat.guessvar)
+        end
     end
-    plotdat.nlevels = length(plotdat.level);
     
+    % read the whole variable, subset it later
+    
     guess = ncread(fname, plotdat.guessvar);
     analy = local_ncread(fname, plotdat.analyvar);
     if ( isempty(analy) )
@@ -230,13 +239,7 @@
         has_posterior = true;
     end
     
-    if (p.Results.level < 0)
-        wantedlevels = 1:plotdat.nlevels;
-    else
-        wantedlevels = p.Results.level;
-    end
-    
-    for ilevel = wantedlevels
+    for ilevel = 1:length(plotdat.level)
         
         priorQCs = get_qc_values(fname, plotdat.guessvar, ...
             'levelindex', ilevel, ...
@@ -288,7 +291,7 @@
             myplot(plotdat);
             
             % create/append to the postscript file
-            print(gcf,'-dpsc','-append', psfname{iregion});
+            print(gcf, '-dpsc', '-append', psfname{iregion});
             
             % block to go slow and look at each one ...
             if (p.Results.pause)

Modified: DART/branches/qc8diags/diagnostics/matlab/plot_rmse_xxx_evolution.m
===================================================================
--- DART/branches/qc8diags/diagnostics/matlab/plot_rmse_xxx_evolution.m	2019-04-09 20:46:23 UTC (rev 13103)
+++ DART/branches/qc8diags/diagnostics/matlab/plot_rmse_xxx_evolution.m	2019-04-10 15:20:58 UTC (rev 13104)
@@ -80,12 +80,12 @@
 %
 % DART $Id$
 
-default_obsname = 'none';
-default_range = [NaN NaN];
-default_level = -1;
-default_verbosity = true;
+default_obsname    = 'none';
+default_verbosity  = true;
 default_markersize = 8;
-default_pause = false;
+default_pause      = false;
+default_range      = [NaN NaN];
+default_level      = -1;
 p = inputParser;
 
 addRequired(p,'fname', at ischar);
@@ -215,9 +215,18 @@
     else
         plotdat.level       = ncread(fname, dimnames{2});
         plotdat.level_units = nc_read_att(fname, dimnames{2}, 'units');
+        nlevels             = length(plotdat.level); 
+        if (p.Results.level < 0 )
+            % use all the levels
+        elseif (p.Results.level > 0 && p.Results.level < nlevels)
+            plotdat.level   = p.Results.level;
+        else
+            error('%d is not a valid level for %s',p.Results.level,plotdat.guessvar)
+        end
     end
-    plotdat.nlevels = length(plotdat.level);
     
+    % read the whole variable, subset it later
+    
     guess = ncread(fname, plotdat.guessvar);
     analy = local_ncread(fname, plotdat.analyvar);
     if ( isempty(analy) )
@@ -229,13 +238,7 @@
         has_posterior = true;
     end
     
-    if (p.Results.level < 0)
-        wantedlevels = 1:plotdat.nlevels;
-    else
-        wantedlevels = p.Results.level;
-    end
-    


More information about the Dart-dev mailing list