[Dart-dev] [8056] DART/trunk/diagnostics/matlab: Better reporting for how many 'good' observations to plot,

nancy at ucar.edu nancy at ucar.edu
Fri Jun 12 10:40:20 MDT 2015


Revision: 8056
Author:   thoar
Date:     2015-06-12 10:40:19 -0600 (Fri, 12 Jun 2015)
Log Message:
-----------
Better reporting for how many 'good' observations to plot,
how many 'bad' observations to plot.

Fixed a bug that occurrs when there are no good observations to
plot, but there are bad observations to plot. Must set the 
nanobs.string in this case - was not happening before.

Modified Paths:
--------------
    DART/trunk/diagnostics/matlab/plot_obs_netcdf.m
    DART/trunk/diagnostics/matlab/read_obs_netcdf.m

-------------- next part --------------
Modified: DART/trunk/diagnostics/matlab/plot_obs_netcdf.m
===================================================================
--- DART/trunk/diagnostics/matlab/plot_obs_netcdf.m	2015-06-11 22:50:23 UTC (rev 8055)
+++ DART/trunk/diagnostics/matlab/plot_obs_netcdf.m	2015-06-12 16:40:19 UTC (rev 8056)
@@ -83,9 +83,10 @@
 if ( (~ isempty(obsstruct.qc)) && (~ isempty(maxQC)) )
 
    inds = find(obsstruct.qc > maxQC);
-
    obsstruct.numflagged = length(inds);
-
+   fprintf('%d obs have a %s value greater than %f (i.e. "bad")\n', ...
+                obsstruct.numflagged, QCString, maxQC)
+            
    if (~isempty(inds))
        flaggedobs.lons = obsstruct.lons(inds);
        flaggedobs.lats = obsstruct.lats(inds);
@@ -95,10 +96,10 @@
        flaggedobs.qc   = obsstruct.qc(  inds);
    end
 
-   fprintf('%d obs have a %s value greater than %f\n', ...
-                length(inds), QCString, maxQC)
-
    inds = find(obsstruct.qc <= maxQC);
+   obsstruct.numgood = length(inds);
+   fprintf('%d obs have a %s value less than or equal to %f (i.e. "good")\n', ...
+                obsstruct.numgood, QCString, maxQC)
 
    bob = obsstruct.lons(inds); obsstruct.lons = bob;
    bob = obsstruct.lats(inds); obsstruct.lats = bob;
@@ -114,12 +115,13 @@
 %  the entire plot gets wiped out when the continents get plotted.
 %  The locations with NaN values will be plotted with separate symbols.
 
-ntotal = length(obsstruct.obs);
+numobs = length(obsstruct.obs);
 ngood  = sum(isfinite(obsstruct.obs));
 
-if ntotal == ngood
+if numobs == ngood
 
    nanobs.numflagged = 0;
+   nanobs.string     = 'No "good" observations with "NaN" values.';
 
 else
 
@@ -171,9 +173,9 @@
 subplot('position',positions(1,:))
 
 if ( length(obsstruct.obs) < 1 )
-   fprintf('There are no ''good'' observations to plot\n')
+   fprintf('There are no ''good'' observations to plot.\n')
    % may still want to plot the obs with bad qc values.
-   str1 = sprintf('There are no ''good'' observations to plot\n');
+   str1 = sprintf('There are no ''good'' observations to plot.\n');
    text(0.5,0.67,str1,'HorizontalAlignment','center')
    text(0.5,0.33,nanobs.string,'HorizontalAlignment','center')
    title( {pstruct.str1, obsstruct.CopyString, pstruct.str3}, 'Interpreter','none','FontSize',14);
@@ -242,7 +244,7 @@
 if (obsstruct.numflagged > 0 ) % if there are flagged observation to plot ... carry on.
 
    if (twoup <= 0)
-      figure(gcf+1); clf
+      figure; clf
    end
 
    subplot('position',positions(2,:))

Modified: DART/trunk/diagnostics/matlab/read_obs_netcdf.m
===================================================================
--- DART/trunk/diagnostics/matlab/read_obs_netcdf.m	2015-06-11 22:50:23 UTC (rev 8055)
+++ DART/trunk/diagnostics/matlab/read_obs_netcdf.m	2015-06-12 16:40:19 UTC (rev 8056)
@@ -165,6 +165,7 @@
 
 inds = locations_in_region(mylocs,region);
 
+obsstruct.numobs = length(inds);
 obsstruct.lons = mylocs(inds,1);
 obsstruct.lats = mylocs(inds,2);
 obsstruct.z    = mylocs(inds,3);


More information about the Dart-dev mailing list