[Dart-dev] [7136] DART/trunk/DART_LAB/matlab: insignificant changes that make Matlab ' lint' m-lint happy.

nancy at ucar.edu nancy at ucar.edu
Fri Aug 22 15:39:54 MDT 2014


Revision: 7136
Author:   thoar
Date:     2014-08-22 15:39:54 -0600 (Fri, 22 Aug 2014)
Log Message:
-----------
insignificant changes that make Matlab 'lint' m-lint happy.
Some small syntax changes, that's all.

Modified Paths:
--------------
    DART/trunk/DART_LAB/matlab/g_prod_plot.m
    DART/trunk/DART_LAB/matlab/kurt.m
    DART/trunk/DART_LAB/matlab/norm_inv.m
    DART/trunk/DART_LAB/matlab/norm_pdf.m
    DART/trunk/DART_LAB/matlab/obs_increment_eakf.m
    DART/trunk/DART_LAB/matlab/obs_increment_enkf.m
    DART/trunk/DART_LAB/matlab/plot_gaussian.m
    DART/trunk/DART_LAB/matlab/product_of_gaussians.m
    DART/trunk/DART_LAB/matlab/run_template.m

-------------- next part --------------
Modified: DART/trunk/DART_LAB/matlab/g_prod_plot.m
===================================================================
--- DART/trunk/DART_LAB/matlab/g_prod_plot.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/g_prod_plot.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -17,7 +17,7 @@
 h_prior_mean = get(h.edit1);
 prior_mean = str2double(h_prior_mean.String);
 % The mean must be a number
-if(isnan(prior_mean)) 
+if(isnan(prior_mean))
    error_banner(h, 'Prior Mean must be a number');
    is_err = true;
    return
@@ -33,13 +33,13 @@
    return
 end
 
-% Prior sd must also be positive 
+% Prior sd must also be positive
 if(prior_sd <= 0)
    error_banner(h, 'Prior SD must be positive')
    is_err = true;
    return
 end
-   
+ 
 hold off
 prior_handle = plot_gaussian(prior_mean, prior_sd, 1);
 set(prior_handle, 'Color', [0 0.73 0], 'LineWidth', 2);
@@ -49,7 +49,7 @@
 obs_mean = str2double(h_obs_mean.String);
 
 % Obs value must be a number
-if(isnan(obs_mean)) 
+if(isnan(obs_mean))
    error_banner(h, 'Obs value must be a number');
    is_err = true;
    return
@@ -97,7 +97,7 @@
    set(h.text7, 'String', 'Posterior Mean = ');
    set(h.text8, 'String', 'Posterior SD = ');
    set(h.text9, 'String', 'Weight = ');
-   return; 
+   return;
 
 end
 

Modified: DART/trunk/DART_LAB/matlab/kurt.m
===================================================================
--- DART/trunk/DART_LAB/matlab/kurt.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/kurt.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -2,7 +2,7 @@
 % computes the kurtosis of the given input array
 %
 % based on the second formula on this web page:
-% http://www.ats.ucla.edu/stat/mult_pkg/faq/general/kurtosis.htm  
+% http://www.ats.ucla.edu/stat/mult_pkg/faq/general/kurtosis.htm
 
 %% DART software - Copyright 2004 - 2013 UCAR. This open source software is
 % provided by UCAR, "as is", without charge, subject to all terms of use at
@@ -10,20 +10,19 @@
 %
 % DART $Id$
 
-% count of items; array of diffs from mean
-nvals = numel(vals);
+% array of diffs from mean
 del = vals - mean(vals);
-    
+
 % compute the square and 4th power of the diffs from mean
 m2 = mean(del .^ 2);
 m4 = mean(del .^ 4);
 
-% compute the kurtosis value.  this is the version 
+% compute the kurtosis value.  this is the version
 % of the kurtosis formula that is not nonbiased and
 % does not subtract 3.0 from the result.
 k = (m4 ./ (m2 .^ 2));
 
-end 
+end
 
 % <next few lines under version control, do not edit>
 % $URL$

Modified: DART/trunk/DART_LAB/matlab/norm_inv.m
===================================================================
--- DART/trunk/DART_LAB/matlab/norm_inv.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/norm_inv.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -44,7 +44,7 @@
   q = sqrt(-2.0 * log(p));
   x = (((((c1*q + c2)*q + c3)*q + c4)*q + c5)*q + c6) / ...
        ((((d1*q + d2)*q + d3)*q + d4)*q + 1.0);
- elseif (p >= p_low) & (p <= p_high)
+ elseif (p >= p_low) && (p <= p_high)
   q = p - 0.5;
   r = q*q;
   x = (((((a1*r + a2)*r + a3)*r + a4)*r + a5)*r + a6)*q / ...

Modified: DART/trunk/DART_LAB/matlab/norm_pdf.m
===================================================================
--- DART/trunk/DART_LAB/matlab/norm_pdf.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/norm_pdf.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -1,11 +1,11 @@
 function [y] = norm_pdf(x, mu, sigma)
 %  computes a gaussian (normal) PDF
 %  for the points of X with a given mean (mu) and standard deviation (sigma)
-% 
+%
 % normal plot, y given x:
 %  y = (1 / (sigma * sqrt(2*pi))) * e ^ ((-1/2 * ((x-mu) / sigma)^2)
 % or
-%  g(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{ -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2 }. 
+%  g(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{ -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2 }.
 %
 % see: https://en.wikipedia.org/wiki/Probability_density_function
 
@@ -29,4 +29,4 @@
 % $URL$
 % $Revision$
 % $Date$
- 
+

Modified: DART/trunk/DART_LAB/matlab/obs_increment_eakf.m
===================================================================
--- DART/trunk/DART_LAB/matlab/obs_increment_eakf.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/obs_increment_eakf.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -30,7 +30,7 @@
    post_mean = observation;
    post_var = 0;
 else
-% Use product of gaussians 
+% Use product of gaussians
    % Compute the posterior variance
    post_var = 1 / (1 / prior_var + 1 / obs_error_var);
 

Modified: DART/trunk/DART_LAB/matlab/obs_increment_enkf.m
===================================================================
--- DART/trunk/DART_LAB/matlab/obs_increment_enkf.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/obs_increment_enkf.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -30,7 +30,7 @@
    post_mean = observation;
    post_var = 0;
 else
-% Use product of gaussians 
+% Use product of gaussians
    % Compute the posterior variance
    post_var = 1 / (1 / prior_var + 1 / obs_error_var);
 
@@ -38,7 +38,7 @@
    post_mean = post_var * (prior_mean / prior_var + observation / obs_error_var);
 end
 
-% Generate the perturbed observations by adding 
+% Generate the perturbed observations by adding
 % draw from Normal(0, obs_error_sd)
 temp_obs = observation + sqrt(obs_error_var) * randn(size(ensemble));
 

Modified: DART/trunk/DART_LAB/matlab/plot_gaussian.m
===================================================================
--- DART/trunk/DART_LAB/matlab/plot_gaussian.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/plot_gaussian.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -1,4 +1,4 @@
-function[plot_handle] = plot_gaussian(mean, sd, weight)
+function[plot_handle] = plot_gaussian(mymean, sd, weight)
 %% plot_gaussian Plot gaussian over 5 standard deviations
 
 %% DART software - Copyright 2004 - 2013 UCAR. This open source software is
@@ -7,15 +7,15 @@
 %
 % DART $Id$
 
-x_min = mean - 5*sd;
-x_max = mean + 5*sd;
+x_min = mymean - 5*sd;
+x_max = mymean + 5*sd;
 x_range = x_max - x_min;
 
 % Number of points is 1001
 num_points = 1001;
 interval = x_range / num_points;
 x = x_min:interval:x_max;
-y = weight * norm_pdf(x, mean, sd);
+y = weight * norm_pdf(x, mymean, sd);
 
 plot_handle = plot(x, y);
 

Modified: DART/trunk/DART_LAB/matlab/product_of_gaussians.m
===================================================================
--- DART/trunk/DART_LAB/matlab/product_of_gaussians.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/product_of_gaussians.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -1,5 +1,5 @@
-function [post_mean post_sd weight] = ...
-   product_of_gaussians(prior_mean, prior_sd, obs, obs_err_sd) 
+function [post_mean, post_sd, weight] = ...
+   product_of_gaussians(prior_mean, prior_sd, obs, obs_err_sd)
 %% product_of_gaussians Computes mean, variance and weight of the product of two unit gaussians given the mean and standard deviation of each.
 
 %% DART software - Copyright 2004 - 2013 UCAR. This open source software is

Modified: DART/trunk/DART_LAB/matlab/run_template.m
===================================================================
--- DART/trunk/DART_LAB/matlab/run_template.m	2014-08-22 16:33:18 UTC (rev 7135)
+++ DART/trunk/DART_LAB/matlab/run_template.m	2014-08-22 21:39:54 UTC (rev 7136)
@@ -48,14 +48,18 @@
 % End initialization code - DO NOT EDIT
 
 
-% --- Executes just before run_template is made visible.
-function run_template_OpeningFcn(hObject, eventdata, handles, varargin)
+
+%% --- Executes just before run_template is made visible.
+function run_template_OpeningFcn(hObject, ~, handles, varargin)
 % This function has no output args, see OutputFcn.
 % hObject    handle to figure
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
 % varargin   command line arguments to run_template (see VARARGIN)
 
+% set random number seed to same value to generate known sequences
+rng('default')
+
 % Choose default command line output for run_template
 handles.output = hObject;
 
@@ -69,8 +73,9 @@
 % uiwait(handles.figure1);
 
 
-% --- Outputs from this function are returned to the command line.
-function varargout = run_template_OutputFcn(hObject, eventdata, handles) 
+
+%% --- Outputs from this function are returned to the command line.
+function varargout = run_template_OutputFcn(~, ~, handles)
 % varargout  cell array for returning output args (see VARARGOUT);
 % hObject    handle to figure
 % eventdata  reserved - to be defined in a future version of MATLAB
@@ -79,8 +84,6 @@
 % Get default command line output from handles structure
 varargout{1} = handles.output;
 
-
-
 %%% SETTINGS REQUIRED FOR PUSHBUTTONS IN USE WITH THIS SCRIPT
 % The single_step pushbutton requires:
 % Busy action:   queue
@@ -95,8 +98,9 @@
 % Units:         normalized  (required for resizing)
 
 
-% --- Executes on button press in pushbutton_single_step.
-function pushbutton_single_step_Callback(hObject, eventdata, handles)
+
+%% --- Executes on button press in pushbutton_single_step.
+function pushbutton_single_step_Callback(hObject, ~, handles)
 % hObject    handle to pushbutton_single_step (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
@@ -106,8 +110,8 @@
 
 
 
-% --- Executes on button press in pushbutton_free_run.
-function pushbutton_free_run_Callback(hObject, eventdata, handles)
+%% --- Executes on button press in pushbutton_free_run.
+function pushbutton_free_run_Callback(hObject, ~, handles)
 % hObject    handle to pushbutton_free_run (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
@@ -125,7 +129,7 @@
 
    % Being told to stop; switch to not running status
    set(hObject, 'String', 'Start Free Run');
- 
+
    % Update the handles global structure
    guidata(hObject, handles);
 
@@ -149,8 +153,8 @@
          set(handles.pushbutton_single_step, 'Enable', 'On');
 
          % Very last, turn on the start free run button
-         set(hObject, 'Enable', 'On'); 
- 
+         set(hObject, 'Enable', 'On');
+
          return
       end
       % Do the next advance or assimilation step
@@ -164,7 +168,7 @@
 
 
 
-%----------- Moves the model ahead or assimilates next observations ------
+%%----------- Moves the model ahead or assimilates next observations ------
 function step_ahead(hObject, handles)
 
 % Test on semaphore, either advance or assimilate
@@ -193,7 +197,7 @@
 end
 
 % If using multiple windows might need to reset focus to the gui window here
-[gcbo_h, gcbo_fig] = gcbo;
+[~, gcbo_fig] = gcbo;
 figure(gcbo_fig);
 
 % Update the global storage and return


More information about the Dart-dev mailing list