[Dart-dev] DART/branches Revision: 11302
dart at ucar.edu
dart at ucar.edu
Mon Mar 13 15:03:07 MDT 2017
thoar at ucar.edu
2017-03-13 15:03:06 -0600 (Mon, 13 Mar 2017)
139
Turn all scripts into functions so the Matlab 'private' functions
will work. scripts cannot call 'private' functions - but functions can.
Modified: DART/branches/rma_trunk/diagnostics/matlab/localization_visualizer.m
===================================================================
--- DART/branches/rma_trunk/diagnostics/matlab/localization_visualizer.m 2017-03-13 16:07:24 UTC (rev 11301)
+++ DART/branches/rma_trunk/diagnostics/matlab/localization_visualizer.m 2017-03-13 21:03:06 UTC (rev 11302)
@@ -1,4 +1,3 @@
-
function localization_visualizer
% localization_visualizer helps explore the localization impact for a given cutoff value.
% You can change projections, resolutions, location, etc.
Modified: DART/branches/rma_trunk/diagnostics/matlab/plot_bins.m
===================================================================
--- DART/branches/rma_trunk/diagnostics/matlab/plot_bins.m 2017-03-13 16:07:24 UTC (rev 11301)
+++ DART/branches/rma_trunk/diagnostics/matlab/plot_bins.m 2017-03-13 21:03:06 UTC (rev 11302)
@@ -1,3 +1,4 @@
+function plot_bins(truth_file, diagn_file)
%% DART:plot_bins Plots ensemble rank histograms
%
% plot_bins interactively queries for the information needed to create
@@ -17,11 +18,13 @@
% postassim.nc ---> [posterior inflation] --->
% filter_output.nc
%
-% Example (for low-order models)
+% Example 1 (Prompt for filenames. Defaults are 'perfect_output.nc' and 'preassim.nc')
+% plot_bins
%
+% Example 2
% truth_file = 'perfect_output.nc';
% diagn_file = 'preassim.nc';
-% plot_bins
+% plot_bins(truth_file,diagn_file)
%% DART software - Copyright UCAR. This open source software is provided
% by UCAR, "as is", without charge, subject to all terms of use at
@@ -33,22 +36,23 @@
% exist('bob') == 1 means the variable exists.
% the value of the variable is checked later.
-if (exist('truth_file','var') ~= 1)
- disp('Input name of true model trajectory file:')
- truth_file = input('<cr> for perfect_output.nc\n','s');
- if isempty(truth_file)
- truth_file = 'perfect_output.nc';
- end
+if (nargin == 0)
+ disp('Input name of true model trajectory file:')
+ truth_file = input('<cr> for perfect_output.nc\n','s');
+ if isempty(truth_file)
+ truth_file = 'perfect_output.nc';
+ end
+ disp('Input name of ensemble trajectory file:')
+ diagn_file = input('<cr> for preassim.nc\n','s');
+ if isempty(diagn_file)
+ diagn_file = 'preassim.nc';
+ end
+elseif (nargin == 2)
+ % all good - nothing to do
+else
+ error('Must supply either two filenames or none.')
end
-if (exist('diagn_file','var') ~=1)
- disp('Input name of ensemble trajectory file:')
- diagn_file = input('<cr> for preassim.nc\n','s');
- if isempty(diagn_file)
- diagn_file = 'preassim.nc';
- end
-end
-
if ( exist(truth_file,'file') ~= 2 ), error('%s does not exist.',truth_file); end
if ( exist(diagn_file,'file') ~= 2 ), error('%s does not exist.',diagn_file); end
Modified: DART/branches/rma_trunk/diagnostics/matlab/plot_correl.m
===================================================================
--- DART/branches/rma_trunk/diagnostics/matlab/plot_correl.m 2017-03-13 16:07:24 UTC (rev 11301)
+++ DART/branches/rma_trunk/diagnostics/matlab/plot_correl.m 2017-03-13 21:03:06 UTC (rev 11302)
@@ -1,3 +1,4 @@
+function plot_correl(diagn_file)
%% DART:plot_correl Plots space-time series of correlation between a given variable
% at a given time and other variables at all times in an
% ensemble time sequence.
@@ -17,6 +18,12 @@
% postassim.nc ---> [posterior inflation] --->
% filter_output.nc
%
+% Example 1 (prompts you for a filename - default is 'preassim.nc')
+% plot_correl
+%
+% Example 2
+% fname = 'filter_output.nc';
+% plot_correl(fname)
%% DART software - Copyright UCAR. This open source software is provided
% by UCAR, "as is", without charge, subject to all terms of use at
@@ -24,12 +31,16 @@
%
% DART $Id$
-if (exist('diagn_file','var') ~=1)
More information about the Dart-dev
mailing list