[Dart-dev] DART/branches Revision: 13118

dart at ucar.edu dart at ucar.edu
Sat Apr 20 09:11:51 MDT 2019


thoar at ucar.edu
2019-04-20 09:11:51 -0600 (Sat, 20 Apr 2019)
195
Can now specify form of date on X axis.

Specify the optional parameter/value pair:  'dateform','YY/dd HH:MM:SS'
for example.  see the help for 'datetick' to see examples of free-form dateform.




Modified: DART/branches/qc8diags/diagnostics/matlab/plot_evolution.m
===================================================================
--- DART/branches/qc8diags/diagnostics/matlab/plot_evolution.m	2019-04-18 14:19:56 UTC (rev 13117)
+++ DART/branches/qc8diags/diagnostics/matlab/plot_evolution.m	2019-04-20 15:11:51 UTC (rev 13118)
@@ -33,7 +33,7 @@
 %            Each observation type will be plotted in a separate graphic.
 %            Default is to plot all available observation types.
 %
-% level    :  'level' index. Default is to plot all levels.
+% level    : 'level' index. Default is to plot all levels.
 %
 % range    : 'range' of the value being plotted. Default is to
 %                automatically determine range based on the data values.
@@ -40,8 +40,12 @@
 %
 % verbose  : true/false to control amount of run-time output
 %
-% MarkerSize  : integer controlling the size of the symbols
+% MarkerSize : integer controlling the size of the symbols
 %
+% DateForm : Free-form character string controlling representation of the time axis.
+%            See 'help datetick' for discussion and valid values.
+%            Example ones are 'mm/dd' and 'dd HH:MM'.
+%
 % pause  : true/false to conrol pausing after each figure is created.
 %          true will require hitting any key to continue to next plot
 %
@@ -87,6 +91,7 @@
 default_pause      = false;
 default_range      = [NaN NaN];
 default_level      = -1;
+default_dateform   = 'default';
 p = inputParser;
 
 addRequired(p,'fname', at ischar);
@@ -98,6 +103,7 @@
     addParameter(p,'pause',      default_pause,      @islogical);
     addParameter(p,'range',      default_range,      @isnumeric);
     addParameter(p,'level',      default_level,      @isnumeric);
+    addParameter(p,'DateForm',   default_dateform,   @ischar);
 else
     addParamValue(p,'obsname',   default_obsname,    @ischar);    %#ok<NVREPL>
     addParamValue(p,'verbose',   default_verbosity,  @islogical); %#ok<NVREPL>
@@ -105,6 +111,7 @@
     addParamValue(p,'pause',     default_pause,      @islogical); %#ok<NVREPL>
     addParamValue(p,'range',     default_range,      @isnumeric); %#ok<NVREPL>
     addParamValue(p,'level',     default_level,      @isnumeric); %#ok<NVREPL>
+    addParamValue(p,'DateForm',  default_dateform,   @ischar);    %#ok<NVREPL>
 end
 p.parse(fname, copy, varargin{:});
 
@@ -147,6 +154,7 @@
 
 figuredata            = set_obsdiag_figure('landscape');
 figuredata.MarkerSize = p.Results.MarkerSize;
+figuredata.DateForm   = p.Results.DateForm;
 verbose               = p.Results.verbose;
 
 %%---------------------------------------------------------------------
@@ -332,19 +340,12 @@
 anl_Nused = squeeze(plotdat.anl_Nused(plotdat.region,:,:,:));
 anl_Ngood = sum(anl_Nused);
 
-if verbose
-    fprintf('region %d %s level %d nobs_poss %d prior %d poste %d\n', ...
-        plotdat.region, plotdat.myvarname, plotdat.mylevel, ...
-        sum(ges_Nposs), sum(ges_Nused), anl_Ngood)
-    fprintf('region %d %s level %d %s\n\n', ...
-        plotdat.region, plotdat.myvarname, plotdat.mylevel, prior_legstr)
-end
-
 if anl_Ngood
     [hposte, poste_legstr] = plot_quantity('posterior', plotdat);
     h = legend([hprior, hposte], prior_legstr, poste_legstr);
 else
     h = legend(hprior,prior_legstr);
+    poste_legstr = [];
 end
 
 set(h,'Interpreter','none','Box','off','FontSize',figuredata.fontsize)
@@ -357,6 +358,14 @@
     h.AutoUpdate = 'off';
 end
 
+if verbose
+    fprintf('region %d %s level %d nobs_poss %d prior %d poste %d\n', ...
+        plotdat.region, plotdat.myvarname, plotdat.mylevel, ...
+        sum(ges_Nposs), sum(ges_Nused), anl_Ngood)
+    fprintf('region %d %s level %d %s %s\n\n', ...
+        plotdat.region, plotdat.myvarname, plotdat.mylevel, prior_legstr, poste_legstr)
+end
+
 % Attempt to make plotting robust in the face of 'empty' bins.
 % The bincenters variable has all the temporal bins specified,
 % so we use that to determine the X axis limits.
@@ -374,20 +383,11 @@
         plotdat.ylabel = sprintf('%s',plotdat.copystring);
 end
 
-% hokey effort to decide to plot months/days vs. daynum vs.
-ttot = plotdat.bincenters(plotdat.Nbins) - plotdat.bincenters(1) + 1;


More information about the Dart-dev mailing list