[Dart-dev] [4001] DART/trunk/diagnostics/matlab: These functions were deprecated a long time ago.
nancy at ucar.edu
nancy at ucar.edu
Wed Aug 12 09:41:27 MDT 2009
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090812/6c6adb0f/attachment-0001.html
-------------- next part --------------
Deleted: DART/trunk/diagnostics/matlab/fit_ens_bias_vertical.m
===================================================================
--- DART/trunk/diagnostics/matlab/fit_ens_bias_vertical.m 2009-08-11 16:29:29 UTC (rev 4000)
+++ DART/trunk/diagnostics/matlab/fit_ens_bias_vertical.m 2009-08-12 15:41:26 UTC (rev 4001)
@@ -1,245 +0,0 @@
-function fit_ens_bias_vertical(ddir)
-% fit_ens_bias_vertical(ddir)
-%
-% Plots the RMS bias as a function of height for several regions.
-% The bias is averaged over a time period. The bias and averaging
-% is done by 'obs_diag' - which generates data files that are
-% used by this plotting routine.
-%
-% the input data files are of the form *ges_ver_ave_bias.dat,
-% where the 'ave' refers to averaging over time. The first part of
-% the file name is the name of the variable contained in the file.
-%
-% 'obs_diag' also produces a matlab-compatible file of plotting attributes:
-% ObsDiagAtts.m which specifies the run-time configuration of obs_diag.
-%
-% ddir is an optional argument specifying the directory containing
-% the data files as preprocessed by the support routines.
-%
-% USAGE:
-%
-% fit_ens_bias_vertical('plot')
-%
-% Remember you can click and drag the legends ...
-
-% Data Assimilation Research Testbed -- DART
-% Copyright 2004-2007, Data Assimilation Research Section
-% University Corporation for Atmospheric Research
-% Licensed under the GPL -- www.gpl.org/licenses/gpl.html
-%
-% <next few lines under version control, do not edit>
-% $URL$
-% $Id$
-% $Revision$
-% $Date$
-
-% Ensures the specified directory is searched first.
-if ( nargin > 0 )
- startpath = addpath(ddir);
-else
- startpath = path;
-end
-
-datafile = 'ObsDiagAtts';
-ptypes = {'gs-','bd-','ro-','k+-'}; % for each region
-
-%----------------------------------------------------------------------
-% Get plotting metadata from obs_diag run.
-%----------------------------------------------------------------------
-
-if ( exist(datafile) == 2 )
-
- eval(datafile)
-
- if ( exist('plevel','var') == 0 )
- disp(sprintf('%s does not have multiple levels.', datafile))
- disp('It cannot be plotted with fit_ens_bias_vertical.')
- return
- end
-
-else
- error(sprintf('%s cannot be found.', datafile))
-end
-
-% set up a structure with all static plotting components
-skip_seconds = time_to_skip(4)*3600 + time_to_skip(5)*60 + time_to_skip(6);
-iskip = time_to_skip(3) + skip_seconds/86400;
-
-plotdat.bin1 = datenum(first_bin_center); % a known date in matlab's time units
-plotdat.toff = plotdat.bin1 - t1; % determine temporal offset (calendar base)
-plotdat.day1 = datestr(t1+plotdat.toff+iskip,'yyyy-mm-dd HH');
-plotdat.dayN = datestr(tN+plotdat.toff,'yyyy-mm-dd HH');
-plotdat.linewidth = 2.0;
-
-
-%----------------------------------------------------------------------
-% Loop around observation types
-%----------------------------------------------------------------------
-
-for ivar = 1:length(All_Level_Varnames),
-
- % set up a structure with all the plotting components
-
- plotdat.varname = All_Level_Varnames{ivar};
-
- switch obs_select
- case 1,
- string1 = sprintf('%s Ens Mean (all data)', plotdat.varname);
- case 2,
- string1 = sprintf('%s Ens Mean (RaObs)', plotdat.varname);
- otherwise,
- string1 = sprintf('%s Ens Mean (ACARS,SATWND)', plotdat.varname);
- end
-
- switch All_Level_Varnames{ivar}
- case{'RADIOSONDE_TEMPERATURE'}
- plotdat.xlabel = 'bias (degrees C)';
- case{'RADIOSONDE_V_WIND_COMPONENT'}
- plotdat.xlabel = 'bias (m/s)';
- otherwise
- plotdat.xlabel = 'bias';
- end
-
- plotdat.ges = sprintf('%s_ges_ver_ave_bias.dat',All_Level_Varnames{ivar});
- plotdat.anl = sprintf('%s_anl_ver_ave_bias.dat',All_Level_Varnames{ivar});
- plotdat.main = sprintf('%s %sZ -- %sZ',string1,plotdat.day1,plotdat.dayN);
- plotdat = SetLevels(plotdat);
-
- % plot by region
-
- figure(ivar); orient landscape; clf; wysiwyg
-
- for iregion = 1:length(Regions),
- plotdat.title = Regions{iregion};
- plotdat.region = iregion;
- myplot(plotdat);
- end
-
- CenterAnnotation(plotdat.main)
- BottomAnnotation(plotdat.ges)
-
- psfname = sprintf('%s_bias.ps',plotdat.varname);
- print(ivar,'-dpsc',psfname);
-
-end
-
-path(startpath); % restore MATLABPATH to original setting
-
-%----------------------------------------------------------------------
-% 'Helper' functions
-%----------------------------------------------------------------------
-
-function myplot(plotdat)
-regionindex = 2 + 2*(plotdat.region - 1);
-pv = load(plotdat.ges);
-av = load(plotdat.anl);
-p_v = SqueezeMissing(pv);
-a_v = SqueezeMissing(av);
-guessX = p_v(:,regionindex);
-analyX = a_v(:,regionindex);
-levels = plotdat.levels;
-
-% Try to figure out intelligent axis limits
-indmax = size(p_v,2);
-xdatarr = [p_v(:,2:2:indmax) a_v(:,2:2:indmax)]; % concatenate all data
-xlims = [min(xdatarr(:)) max(xdatarr(:))]; % limits of all data
-axlims = [floor(xlims(1)) ceil(xlims(2)) min(plotdat.ylims) max(plotdat.ylims)];
-
-% sometimes there is no valid data, must patch axis limits
-if (~isfinite(axlims(1)))
- axlims(1) = -1;
-end
-if (~isfinite(axlims(2)))
- axlims(2) = 1;
-end
-
-subplot(2,2,plotdat.region)
- plot(guessX,levels,'k+-',analyX,levels,'ro-','LineWidth',plotdat.linewidth)
- axis(axlims)
- grid
- set(gca,'YDir', plotdat.ydir)
- hold on; plot([0 0],[axlims(3) axlims(4)],'k-')
- title( plotdat.title, 'Interpreter','none','FontSize', 12, 'FontWeight', 'bold' )
- ylabel(plotdat.ylabel, 'FontSize', 10)
- xlabel(plotdat.xlabel, 'FontSize', 10)
- h = legend('guess', 'analysis','Location','best');
- legend(h,'boxoff')
-
-
-
-function y = SqueezeMissing(x)
-
-missing = find(x < -98); % 'missing' is coded as -99
-
-if isempty(missing)
- y = x;
-else
- y = x;
- y(missing) = NaN;
-end
-
-
-
-function CenterAnnotation(main)
-subplot('position',[0.48 0.48 0.04 0.04])
-axis off
-h = text(0.5,0.5,main);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','bottom', ...
- 'Interpreter','none', ...
- 'FontSize',12, ...
- 'FontWeight','bold')
-
-
-
-function BottomAnnotation(main)
-% annotates the directory containing the data being plotted
-subplot('position',[0.48 0.01 0.04 0.04])
-axis off
-bob = which(main);
-[pathstr,name,ext,versn] = fileparts(bob);
-h = text(0.0,0.5,pathstr);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','middle',...
- 'Interpreter','none',...
- 'FontSize',8)
-
-
-
-function plotstruct = SetLevels(plotdat)
-
-if ( exist(plotdat.ges,'file') ~= 2 )
- error(sprintf('%s does not seem to exist.',plotdat.ges))
-end
-if ( exist(plotdat.anl,'file') ~= 2 )
- error(sprintf('%s does not seem to exist.',plotdat.anl))
-end
-
-datmat = load(plotdat.ges);
-guess = datmat(:,1);
-
-datmat = load(plotdat.anl);
-anl = datmat(:,1);
-
-if (sum(abs(guess-anl)) > 0)
- str1 = sprintf('levels in %s and %s do not match',plotdat.ges, plotdat.anl)
- error(str1)
-end
-
-levels = guess; clear guess anl
-
-plotstruct = plotdat;
-plotstruct.levels = levels;
-plotstruct.top = levels(1);
-plotstruct.surface = levels(length(levels));
-
-if ( plotstruct.top > plotstruct.surface )
- plotstruct.ylabel = 'height(m)';
- plotstruct.ydir = 'normal';
- plotstruct.ylims = [plotstruct.surface plotstruct.top];
-else
- plotstruct.ylabel = 'Pressure (hPa)';
- plotstruct.ydir = 'reverse';
- plotstruct.ylims = [plotstruct.surface plotstruct.top];
-end
-
Deleted: DART/trunk/diagnostics/matlab/fit_ens_mean_time.m
===================================================================
--- DART/trunk/diagnostics/matlab/fit_ens_mean_time.m 2009-08-11 16:29:29 UTC (rev 4000)
+++ DART/trunk/diagnostics/matlab/fit_ens_mean_time.m 2009-08-12 15:41:26 UTC (rev 4001)
@@ -1,221 +0,0 @@
-function fit_ens_mean_time(ddir)
-% fit_ens_mean_time(ddir)
-%
-% Part of the observation-space diagnostics routines.
-%
-% Plots the spatial mean RMSE of the ensemble mean as a function of
-% time for both the 'guess' and the 'analysis' at a single level.
-% Several regions are plotted. This function simply plots the
-% data in *ges_times.dat using metadata in ObsDiagAtts.m - both
-% created by the executable 'obs_diag'.
-%
-% 'obs_diag' also produces a matlab-compatible file of plotting attributes:
-% ObsDiagAtts.m which specifies the run-time configuration of obs_diag.
-%
-% ddir is an optional argument specifying the directory containing
-% the data files as preprocessed by the support routines.
-%
-% USAGE: if the preprocessed data files are in a directory called 'plot'
-%
-% ddir = 'plot';
-% fit_ens_mean_time(ddir)
-%
-% USAGE: if the preprocessed data files are in the current directory
-%
-% fit_ens_mean_time
-
-% Data Assimilation Research Testbed -- DART
-% Copyright 2004-2007, Data Assimilation Research Section
-% University Corporation for Atmospheric Research
-% Licensed under the GPL -- www.gpl.org/licenses/gpl.html
-%
-% <next few lines under version control, do not edit>
-% $URL$
-% $Id$
-% $Revision$
-% $Date$
-
-% Ensures the specified directory is searched first.
-if ( nargin > 0 )
- startpath = addpath(ddir);
-else
- startpath = path;
-end
-
-%----------------------------------------------------------------------
-% Defaults
-%----------------------------------------------------------------------
-
-datafile = 'ObsDiagAtts';
-ptypes = {'gs-','bd-','ro-','k+-'}; % for each region
-
-%----------------------------------------------------------------------
-% Get plotting metadata from obs_diag run.
-%----------------------------------------------------------------------
-
-if ( exist(datafile) == 2 )
-
- eval(datafile)
-
- if ( exist('plevel','var') == 0 )
- plevel = 1;
- iskip = iskip_days;
- plotdat.toff = 0;
- plotdat.bin1 = datenum(t1);
- else % high dimensional models
- % Coordinate between time types and dates
- skip_seconds = time_to_skip(4)*3600 + time_to_skip(5)*60 + time_to_skip(6);
- iskip = time_to_skip(3) + skip_seconds/86400;
- plotdat.bin1 = datenum(first_bin_center); % a known date in matlab's time units
- plotdat.toff = plotdat.bin1 - t1;
- end
-
-else
- error(sprintf('%s cannot be found.', datafile))
-end
-
-% Set up a structure with all the plotting components
-plotdat.day1 = datestr(t1+plotdat.toff+iskip,'yyyy-mm-dd HH');
-plotdat.dayN = datestr(tN+plotdat.toff,'yyyy-mm-dd HH');
-plotdat.level = plevel;
-plotdat.ylabel = 'RMSE';
-plotdat.nregions = length(Regions);
-plotdat.nvars = length(One_Level_Varnames);
-plotdat.flavor = 'Ens Mean';
-
-%----------------------------------------------------------------------
-% Loop around observation types
-%----------------------------------------------------------------------
-
-for ivar = 1:plotdat.nvars,
-
- plotdat.varname = One_Level_Varnames{ivar};
-
- switch obs_select
- case 1,
- string1 = sprintf('%s (all data)', plotdat.varname);
- case 2,
- string1 = sprintf('%s (RaObs)', plotdat.varname);
- otherwise,
- string1 = sprintf('%s (ACARS,SATWND)', plotdat.varname);
- end
-
-% switch One_Level_Varnames{ivar}
-% case{'P'}
- ges = sprintf('%s_ges_times.dat',One_Level_Varnames{ivar});
- anl = sprintf('%s_anl_times.dat',One_Level_Varnames{ivar});
- main = sprintf('%s %s',plotdat.flavor,string1);
-% otherwise
-% ges = sprintf('%s_ges_times_%04dmb.dat',One_Level_Varnames{ivar});
-% anl = sprintf('%s_anl_times_%04dmb.dat',One_Level_Varnames{ivar});
-% main = sprintf('%s %s %d hPa',plotdat.flavor,string1,plotdat.level);
-% end
-
- plotdat.ges = ges;
- plotdat.anl = anl;
-
- % plot each region
-
- figure(ivar); orient tall; clf; wysiwyg
-
- for iregion = 1:length(Regions),
- plotdat.title = Regions{iregion};
- plotdat.region = iregion;
- myplot(plotdat);
- end
-
- CenterAnnotation(main); % One title in the middle
- BottomAnnotation(ges); % annotate filename at bottom
-
- % create a postscript file
-
- psfname = sprintf('%s_ens_mean_time.ps',plotdat.varname);
- print(ivar,'-dpsc',psfname);
-
-end
-
-path(startpath); % restore MATLABPATH to original setting
-
-%----------------------------------------------------------------------
-% 'Helper' functions
-%----------------------------------------------------------------------
-
-function myplot(plotdat)
-p1 = load(plotdat.ges); p = SqueezeMissing(p1);
-a1 = load(plotdat.anl); a = SqueezeMissing(a1);
-
-% Make x axis plotting arrays in units of 'days'
-xp = p(:,1) + p(:,2)/86400 + plotdat.toff;
-xa = a(:,1) + a(:,2)/86400 + plotdat.toff;
-
-offset = 3; % columns 1,2 are time, 3=mean, 4=spread, 5=numobs
-
-count = offset+(plotdat.region-1)*3;
-yp = p(:,count);
-ya = a(:,count);
-
-gmean = mean(yp(isfinite(yp))); gstring = sprintf('guess; mean=%.3f',gmean);
-amean = mean(ya(isfinite(ya))); astring = sprintf('analysis; mean=%.3f',amean);
-
-subplot(plotdat.nregions,1,plotdat.region)
-
- plot(xp,yp,'k+-',xa,ya,'ro-','LineWidth',1.5)
- grid
- ax = axis; ax(3) = 0.0; axis(ax);
- ylabel(plotdat.ylabel, 'fontsize', 10);
- title(plotdat.title, 'Interpreter','none','fontsize', 12,'FontWeight','bold')
- h = legend(gstring, astring);
- legend(h,'boxoff')
-
- % a slightly better way to annotate dates, etc.
- ttot = max(xp) - min(xp) + 1;
- if ((plotdat.bin1 > 1000) && (ttot > 32));
- datetick('x',6,'keeplimits','keepticks');
- monstr = datestr(xp(1),28);
- xlabel(sprintf('month/day - %s start',monstr))
- elseif (plotdat.bin1 > 1000);
- datetick('x',7);
- monstr = datestr(xp(1),28);
- xlabel(sprintf('day of month - %s start',monstr))
- else
- xlabel('days')
- end
-
-
-
-function y = SqueezeMissing(x)
-
-missing = find(x < -98); % 'missing' is coded as -99
-
-if isempty(missing)
- y = x;
-else
- y = x;
- y(missing) = NaN;
-end
-
-
-
-function CenterAnnotation(main)
-subplot('position',[0.48 0.48 0.04 0.04])
-axis off
-h = text(0.5,0.5,main);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','bottom', ...
- 'Interpreter','none', ...
- 'FontSize',12, ...
- 'FontWeight','bold')
-
-
-
-function BottomAnnotation(main)
-% annotates the directory containing the data being plotted
-subplot('position',[0.48 0.01 0.04 0.04])
-axis off
-bob = which(main);
-[pathstr,name,ext,versn] = fileparts(bob);
-h = text(0.0,0.5,pathstr);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','middle',...
- 'Interpreter','none',...
- 'FontSize',8)
Deleted: DART/trunk/diagnostics/matlab/fit_ens_mean_vertical.m
===================================================================
--- DART/trunk/diagnostics/matlab/fit_ens_mean_vertical.m 2009-08-11 16:29:29 UTC (rev 4000)
+++ DART/trunk/diagnostics/matlab/fit_ens_mean_vertical.m 2009-08-12 15:41:26 UTC (rev 4001)
@@ -1,243 +0,0 @@
-function fit_ens_mean_vertical(ddir)
-% fit_ens_mean_vertical(ddir)
-%
-% Plots the RMS of the ensemble mean as a function of height for
-% several regions. The ensemble mean is averaged over a time period.
-% The calculations are done by 'obs_diag' - which generates data files
-% that are used by this plotting routine.
-%
-% the input data files are of the form *ges_ver_ave.dat,
-% where the 'ave' refers to averaging over time. The first part of
-% the file name is the name of the variable contained in the file.
-%
-% 'obs_diag' also produces a matlab-compatible file of plotting attributes:
-% ObsDiagAtts.m which specifies the run-time configuration of obs_diag.
-%
-% ddir is an optional argument specifying the directory containing
-% the data files as preprocessed by the support routines.
-%
-% USAGE: if the preprocessed data files are in a directory called 'plot'
-%
-% ddir = 'plot';
-% fit_ens_mean_vertical(ddir)
-
-% Data Assimilation Research Testbed -- DART
-% Copyright 2004-2007, Data Assimilation Research Section
-% University Corporation for Atmospheric Research
-% Licensed under the GPL -- www.gpl.org/licenses/gpl.html
-%
-% <next few lines under version control, do not edit>
-% $URL$
-% $Id$
-% $Revision$
-% $Date$
-
-% Ensures the specified directory is searched first.
-if ( nargin > 0 )
- startpath = addpath(ddir);
-else
- startpath = path;
-end
-
-%----------------------------------------------------------------------
-% Defaults
-%----------------------------------------------------------------------
-
-datafile = 'ObsDiagAtts';
-ptypes = {'gs-','bd-','ro-','k+-'}; % for each region
-
-%----------------------------------------------------------------------
-% Get plotting metadata from obs_diag run.
-%----------------------------------------------------------------------
-
-if ( exist(datafile) == 2 )
-
- eval(datafile)
-
- if ( exist('plevel','var') == 0 )
- disp(sprintf('%s does not have multiple levels.', datafile))
- disp('It cannot be plotted with fit_ens_mean_vertical.')
- return
- end
-
-else
- error(sprintf('%s cannot be found.', datafile))
-end
-
-% set up a structure with all static plotting components
-skip_seconds = time_to_skip(4)*3600 + time_to_skip(5)*60 + time_to_skip(6);
-iskip = time_to_skip(3) + skip_seconds/86400;
-
-plotdat.bin1 = datenum(first_bin_center); % a known date in matlab's time units
-plotdat.toff = plotdat.bin1 - t1; % determine temporal offset (calendar base)
-plotdat.day1 = datestr(t1+plotdat.toff+iskip,'yyyy-mm-dd HH');
-plotdat.dayN = datestr(tN+plotdat.toff,'yyyy-mm-dd HH');
-plotdat.xlabel = 'RMSE';
-plotdat.linewidth = 2.0;
-
-main = sprintf('Ensemble Mean %s - %s',plotdat.day1,plotdat.dayN);
-
-%----------------------------------------------------------------------
-% Loop around observation types
-%----------------------------------------------------------------------
-
-for ivar = 1:length(All_Level_Varnames),
-
- % set up a structure with all the plotting components
-
- plotdat.varname = All_Level_Varnames{ivar};
-
- switch obs_select
- case 1,
- string1 = sprintf('%s Ens Mean (all data)', plotdat.varname);
- case 2,
- string1 = sprintf('%s Ens Mean (RaObs)', plotdat.varname);
- otherwise,
- string1 = sprintf('%s Ens Mean (ACARS,SATWND)', plotdat.varname);
- end
-
- plotdat.ges = sprintf('%s_ges_ver_ave.dat',All_Level_Varnames{ivar});
- plotdat.anl = sprintf('%s_anl_ver_ave.dat',All_Level_Varnames{ivar});
- plotdat.main = sprintf('%s %sZ -- %sZ',string1,plotdat.day1,plotdat.dayN);
- plotdat = SetLevels(plotdat);
-
- % plot by region
-
- figure(ivar); orient landscape; clf; wysiwyg
-
- for iregion = 1:length(Regions),
- plotdat.title = Regions{iregion};
- plotdat.region = iregion;
- myplot(plotdat);
- end
-
- CenterAnnotation(plotdat.main)
- BottomAnnotation(plotdat.ges)
-
- % create a postscript file
-
- psfname = sprintf('%s_vertical.ps',plotdat.varname);
- print(ivar,'-dpsc',psfname);
-
-end
-
-path(startpath); % restore MATLABPATH to original setting
-
-%----------------------------------------------------------------------
-% 'Helper' functions
-%----------------------------------------------------------------------
-
-function myplot(plotdat)
-regionindex = 2 + 2*(plotdat.region - 1);
-pv = load(plotdat.ges);
-av = load(plotdat.anl);
-p_v = SqueezeMissing(pv);
-a_v = SqueezeMissing(av);
-guessX = p_v(:,regionindex);
-analyX = a_v(:,regionindex);
-levels = plotdat.levels;
-
-% Try to figure out intelligent axis limits
-indmax = size(p_v,2);
-xdatarr = [p_v(:,2:2:indmax) a_v(:,2:2:indmax)]; % concatenate all data
-xlims = [0.0 max(xdatarr(:))]; % limits of all data
-axlims = [floor(xlims(1)) ceil(xlims(2)) min(plotdat.ylims) max(plotdat.ylims)];
-
-% sometimes there is no valid data, must patch axis limits
-if (~isfinite(axlims(2)))
- axlims(2) = 1;
-end
-
-subplot(2,2,plotdat.region)
- plot(guessX,levels,'k+-',analyX,levels,'ro-','LineWidth',plotdat.linewidth)
- axis(axlims)
- grid
- set(gca,'YDir', plotdat.ydir)
- title( plotdat.title, 'Interpreter', 'none', 'FontSize', 12, 'FontWeight', 'bold' )
- ylabel(plotdat.ylabel, 'FontSize', 10)
- xlabel(plotdat.xlabel, 'FontSize', 10)
- if isempty(strfind(lower(plotdat.varname),'w'))
- h = legend('guess', 'analysis','Location','East');
- else
- h = legend('guess', 'analysis','Location','SouthEast');
- end
- legend(h,'boxoff');
-
-
-
-function y = SqueezeMissing(x)
-
-missing = find(x < -98); % 'missing' is coded as -99
-
-if isempty(missing)
- y = x;
-else
- y = x;
- y(missing) = NaN;
-end
-
-
-
-function CenterAnnotation(main)
-subplot('position',[0.48 0.48 0.04 0.04])
-axis off
-h = text(0.5,0.5,main);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','bottom', ...
- 'Interpreter','none', ...
- 'FontSize',12, ...
- 'FontWeight','bold')
-
-
-
-function BottomAnnotation(main)
-% annotates the directory containing the data being plotted
-subplot('position',[0.48 0.01 0.04 0.04])
-axis off
-bob = which(main);
-[pathstr,name,ext,versn] = fileparts(bob);
-h = text(0.0,0.5,pathstr);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','middle',...
- 'Interpreter','none',...
- 'FontSize',8)
-
-
-
-function plotstruct = SetLevels(plotdat)
-
-if ( exist(plotdat.ges,'file') ~= 2 )
- error(sprintf('%s does not seem to exist.',plotdat.ges))
-end
-if ( exist(plotdat.anl,'file') ~= 2 )
- error(sprintf('%s does not seem to exist.',plotdat.anl))
-end
-
-datmat = load(plotdat.ges);
-guess = datmat(:,1);
-
-datmat = load(plotdat.anl);
-anl = datmat(:,1);
-
-if (sum(abs(guess-anl)) > 0)
- str1 = sprintf('levels in %s and %s do not match',plotdat.ges, plotdat.anl)
- error(str1)
-end
-
-levels = guess; clear guess anl
-
-plotstruct = plotdat;
-plotstruct.levels = levels;
-plotstruct.top = levels(1);
-plotstruct.surface = levels(length(levels));
-
-if ( plotstruct.top > plotstruct.surface )
- plotstruct.ylabel = 'height(m)';
- plotstruct.ydir = 'normal';
- plotstruct.ylims = [plotstruct.surface plotstruct.top];
-else
- plotstruct.ylabel = 'Pressure (hPa)';
- plotstruct.ydir = 'reverse';
- plotstruct.ylims = [plotstruct.surface plotstruct.top];
-end
-
Deleted: DART/trunk/diagnostics/matlab/fit_ens_spread_time.m
===================================================================
--- DART/trunk/diagnostics/matlab/fit_ens_spread_time.m 2009-08-11 16:29:29 UTC (rev 4000)
+++ DART/trunk/diagnostics/matlab/fit_ens_spread_time.m 2009-08-12 15:41:26 UTC (rev 4001)
@@ -1,230 +0,0 @@
-function fit_ens_spread_time(ddir)
-% fit_ens_spread_time(ddir)
-%
-% Part of the observation-space diagnostics routines.
-%
-% Plots the spatial mean RMS of the spread of the ensemble as a function
-% of time for both the 'guess' and the 'analysis' at a single level.
-% Several regions are plotted. This function simply plots the
-% data in *ges_times.dat using metadata in ObsDiagAtts.m - both
-% created by the executable 'obs_diag'.
-%
-% 'obs_diag' also produces a matlab-compatible file of plotting attributes:
-% ObsDiagAtts.m which specifies the run-time configuration of obs_diag.
-%
-% The figures are automatically saved as postscript files.
-%
-% ddir is an optional argument specifying the directory containing
-% the data files as preprocessed by the support routines.
-%
-% USAGE: if the preprocessed data files are in a directory called 'plot'
-%
-% fit_ens_spread_time('plot')
-%
-% USAGE: if the preprocessed data files are in the current directory
-%
-% fit_ens_spread_time
-
-% Data Assimilation Research Testbed -- DART
-% Copyright 2004-2007, Data Assimilation Research Section
-% University Corporation for Atmospheric Research
-% Licensed under the GPL -- www.gpl.org/licenses/gpl.html
-%
-% <next few lines under version control, do not edit>
-% $URL$
-% $Id$
-% $Revision$
-% $Date$
-
-% Ensures the specified directory is searched first.
-if ( nargin > 0 )
- startpath = addpath(ddir);
-else
- startpath = path;
-end
-
-%----------------------------------------------------------------------
-% Defaults
-%----------------------------------------------------------------------
-
-datafile = 'ObsDiagAtts';
-ptypes = {'gs-','bd-','ro-','k+-'}; % for each region
-
-%----------------------------------------------------------------------
-% Get plotting metadata from obs_diag run.
-%----------------------------------------------------------------------
-
-if ( exist(datafile) == 2 )
-
- eval(datafile)
-
- if ( exist('plevel','var') == 0 )
- plevel = 1;
- iskip = iskip_days;
- plotdat.toff = 0;
- plotdat.bin1 = datenum(t1);
- else % high dimensional models
- % set up a structure with all static plotting components
- % Coordinate between time types and dates
- skip_seconds = time_to_skip(4)*3600 + time_to_skip(5)*60 + time_to_skip(6);
- iskip = time_to_skip(3) + skip_seconds/86400;
- plotdat.bin1 = datenum(first_bin_center); % a known date in matlab's time units
- plotdat.toff = plotdat.bin1 - t1; % determine temporal offset (calendar base)
- end
-
-else
- error(sprintf('%s cannot be found.', datafile))
-end
-
-% set up a structure with all static plotting components
-plotdat.day1 = datestr(t1+plotdat.toff+iskip,'yyyy-mm-dd HH');
-plotdat.dayN = datestr(tN+plotdat.toff,'yyyy-mm-dd HH');
-plotdat.level = plevel;
-plotdat.ylabel = 'RMS';
-plotdat.nregions = length(Regions);
-plotdat.nvars = length(One_Level_Varnames);
-plotdat.flavor = 'Ens Spread';
-plotdat.linewidth = 2.0;
-
-%----------------------------------------------------------------------
-% Loop around observation types
-%----------------------------------------------------------------------
-
-for ivar = 1:plotdat.nvars,
-
- plotdat.varname = One_Level_Varnames{ivar};
-
- switch obs_select
- case 1,
- obsstring = sprintf('%s (all data)', plotdat.varname);
- case 2,
- obsstring = sprintf('%s (RaObs)', plotdat.varname);
- otherwise,
- obsstring = sprintf('%s (ACARS,SATWND)', plotdat.varname);
- end
-
-% switch One_Level_Varnames{ivar}
-% case{'P'}
- ges = sprintf('%s_ges_times.dat',One_Level_Varnames{ivar});
- anl = sprintf('%s_anl_times.dat',One_Level_Varnames{ivar});
- main = sprintf('%s %s',plotdat.flavor,obsstring);
-% otherwise
-% ges = sprintf('%s_ges_times_%04dmb.dat',One_Level_Varnames{ivar},plotdat.level);
-% anl = sprintf('%s_anl_times_%04dmb.dat',One_Level_Varnames{ivar},plotdat.level);
-% main = sprintf('%s %s %d hPa',plotdat.flavor,obsstring,plotdat.level);
-% end
-
- plotdat.ges = ges;
- plotdat.anl = anl;
-
- % plot each region
-
- figure(ivar); orient tall; clf; wysiwyg
-
- for iregion = 1:length(Regions),
- plotdat.title = Regions{iregion};
- plotdat.region = iregion;
- Myplot(plotdat)
- end
-
- CenterAnnotation(main); % One title in the middle
- BottomAnnotation(ges); % directory in middle, bottom
-
- % create a postscript file
-
- psfname = sprintf('%s_ens_spread_time.ps',plotdat.varname);
- print(ivar,'-dpsc',psfname);
-
-end
-
-path(startpath); % restore MATLABPATH to original setting
-
-%----------------------------------------------------------------------
-% 'Helper' functions
-%----------------------------------------------------------------------
-
-
-function Myplot(plotdat)
-%
-% After the first column, each set of 3 columns
-% represents a different region.
-% Depends on the format written by obs_diag.f90
-%
-p1 = load(plotdat.ges); p = SqueezeMissing(p1);
-a1 = load(plotdat.anl); a = SqueezeMissing(a1);
-
-xp = p(:,1) + p(:,2)./86400 + plotdat.toff;
-xa = a(:,1) + a(:,2)./86400 + plotdat.toff;
-
-offset = 4; % columns 1,2 are time, 3=mean, 4=spread, 5=numobs
-
-count = offset+(plotdat.region-1)*3;
-yp_spread = p(:,count);
-ya_spread = a(:,count);
-
-gmean = mean(yp_spread(isfinite(yp_spread))); gstring = sprintf('guess; mean=%.3f',gmean);
-amean = mean(ya_spread(isfinite(ya_spread))); astring = sprintf('analysis; mean=%.3f',amean);
-
-subplot(plotdat.nregions,1,plotdat.region)
-
- plot(xp, yp_spread, 'k+-', xa, ya_spread, 'ro-', 'LineWidth', 1.5)
- grid
- ax = axis; ax(3) = 0.0; axis(ax)
- ylabel(plotdat.ylabel, 'fontsize', 10)
- title(plotdat.title,'Interpreter', 'none', 'fontsize', 12, 'FontWeight', 'bold')
- h = legend(gstring, astring);
- legend(h,'boxoff')
-
- % a slightly better way to annotate dates, etc.
- ttot = max(xp) - min(xp) + 1;
- if ((plotdat.bin1 > 1000) && (ttot > 32));
- datetick('x',6,'keeplimits','keepticks');
- monstr = datestr(xp(1),28);
- xlabel(sprintf('month/day - %s start',monstr))
- elseif (plotdat.bin1 > 1000);
- datetick('x',7);
- monstr = datestr(xp(1),28);
- xlabel(sprintf('day of month - %s start',monstr))
- else
- xlabel('days')
- end
-
-
-
-
-function y = SqueezeMissing(x)
-
-missing = find(x < -98); % 'missing' is coded as -99
-
-if isempty(missing)
- y = x;
-else
- y = x;
- y(missing) = NaN;
-end
-
-
-
-function CenterAnnotation(main)
-subplot('position',[0.48 0.48 0.04 0.04])
-axis off
-h = text(0.5,0.5,main);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','bottom', ...
- 'Interpreter','none', ...
- 'FontSize',12, ...
- 'FontWeight','bold')
-
-
-
-function BottomAnnotation(main)
-% annotates the directory containing the data being plotted
-subplot('position',[0.48 0.01 0.04 0.04])
-axis off
-bob = which(main);
-[pathstr,name,ext,versn] = fileparts(bob);
-h = text(0.0,0.5,pathstr);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','middle',...
- 'Interpreter','none',...
- 'FontSize',8)
Deleted: DART/trunk/diagnostics/matlab/fit_mean_spread_time.m
===================================================================
--- DART/trunk/diagnostics/matlab/fit_mean_spread_time.m 2009-08-11 16:29:29 UTC (rev 4000)
+++ DART/trunk/diagnostics/matlab/fit_mean_spread_time.m 2009-08-12 15:41:26 UTC (rev 4001)
@@ -1,238 +0,0 @@
-function fit_mean_spread_time(ddir)
-% fit_mean_spread_time(ddir)
-%
-% Part of the observation-space diagnostics routines.
-%
-% Plots the spatial mean RMSE of the ensemble mean and
-% RMS of the ensemble spread as a function of time at a single
-% level for several regions. This function simply plots the
-% data in *ges_times_*mb.dat using metadata in ObsDiagAtts.m - both
-% created by the executable 'obs_diag'.
-%
-% 'obs_diag' also produces a matlab-compatible file of plotting attributes:
-% ObsDiagAtts.m which specifies the run-time configuration of obs_diag.
-%
-% ddir is an optional argument specifying the directory containing
-% the data files as preprocessed by the support routines.
-%
-% USAGE: if the preprocessed data files are in a directory called 'plot'
-%
-% ddir = 'plot';
-% fit_mean_spread_time(ddir)
-%
-% USAGE: if the preprocessed data files are in the current directory
-%
-% fit_mean_spread_time
-
-% Data Assimilation Research Testbed -- DART
-% Copyright 2004-2007, Data Assimilation Research Section
-% University Corporation for Atmospheric Research
-% Licensed under the GPL -- www.gpl.org/licenses/gpl.html
-%
-% <next few lines under version control, do not edit>
-% $URL$
-% $Id$
-% $Revision$
-% $Date$
-
-% Ensures the specified directory is searched first.
-if ( nargin > 0 )
- startpath = addpath(ddir);
-else
- startpath = path;
-end
-
-%----------------------------------------------------------------------
-% Defaults
-%----------------------------------------------------------------------
-
-datafile = 'ObsDiagAtts';
-ptypes = {'gs-','bd-','ro-','k+-'}; % for each region
-
-%----------------------------------------------------------------------
-% Get plotting metadata from obs_diag run.
-%----------------------------------------------------------------------
-
-if ( exist(datafile) == 2 )
-
- eval(datafile)
-
- if ( exist('plevel','var') == 0 )
- plevel = 1;
- iskip = iskip_days;
- plotdat.toff = 0;
- plotdat.bin1 = datenum(t1);
- else % high dimensional models
- % Coordinate between time types and dates
- skip_seconds = time_to_skip(4)*3600 + time_to_skip(5)*60 + time_to_skip(6);
- iskip = time_to_skip(3) + skip_seconds/86400;
- plotdat.bin1 = datenum(first_bin_center); % a known date in matlab's time units
- plotdat.toff = plotdat.bin1 - t1; % determine temporal offset (calendar base)
- end
-
-else
- error(sprintf('%s cannot be found.', datafile))
-end
-
-% set up a structure with all static plotting components
-plotdat.day1 = datestr(t1+plotdat.toff+iskip,'yyyy-mm-dd HH');
-plotdat.dayN = datestr(tN+plotdat.toff,'yyyy-mm-dd HH');
-plotdat.level = plevel;
-plotdat.ylabel = 'RMSE';
-plotdat.nregions = length(Regions);
-plotdat.nvars = length(One_Level_Varnames);
-plotdat.linewidth = 2.0;
-
-%----------------------------------------------------------------------
-% Loop around observation types
-%----------------------------------------------------------------------
-
-for ivar = 1:plotdat.nvars,
-
- plotdat.varname = One_Level_Varnames{ivar};
-
- switch obs_select
- case 1,
- string1 = sprintf('%s (all data)', plotdat.varname);
- case 2,
- string1 = sprintf('%s (RaObs)', plotdat.varname);
- otherwise,
- string1 = sprintf('%s (ACARS,SATWND)', plotdat.varname);
- end
-
-% switch One_Level_Varnames{ivar}
-% case{'P'}
- ges = sprintf('%s_ges_times.dat',One_Level_Varnames{ivar});
- anl = sprintf('%s_anl_times.dat',One_Level_Varnames{ivar});
- main = sprintf('%s',string1);
-% otherwise
-% ges = sprintf('%s_ges_times_%04dmb.dat',One_Level_Varnames{ivar},plotdat.level);
-% anl = sprintf('%s_anl_times_%04dmb.dat',One_Level_Varnames{ivar},plotdat.level);
-% main = sprintf('%s %d hPa',string1,plotdat.level);
-% end
-
- plotdat.ges = ges;
- plotdat.anl = anl;
-
- % plot by region
-
- figure(ivar); orient tall; clf; wysiwyg
-
- for iregion = 1:plotdat.nregions,
- plotdat.title = Regions{iregion};
- plotdat.region = iregion;
- myplot(plotdat);
- end
-
- CenterAnnotation(main)
- BottomAnnotation(ges)
-
- % create a postscript file
-
- psfname = sprintf('%s_mean_spread_time.ps',plotdat.varname);
- print(ivar,'-dpsc',psfname);
-
-end
-
-path(startpath); % restore MATLABPATH to original setting
-
-%----------------------------------------------------------------------
-% 'Helper' functions
-%----------------------------------------------------------------------
-
-function myplot(plotdat)
-p1 = load(plotdat.ges); p = SqueezeMissing(p1);
-a1 = load(plotdat.anl); a = SqueezeMissing(a1);
-
-x = [1:2*size(p,1)]; % Each time has a guess and analysis
-ens_mean = x;
-ens_spread = x;
-
-countm = 3+(plotdat.region-1)*3; % pick off region mean
-counts = 4+(plotdat.region-1)*3; % pick off region spread
-
-for itime = 1:size(p,1)
-
- obsT1 = p(itime,1) + p(itime,2)/86400 + plotdat.toff;
- obsT2 = a(itime,1) + a(itime,2)/86400 + plotdat.toff;
- x(2*itime-1) = obsT1;
- x(2*itime ) = obsT2;
-
- ens_mean( 2*itime-1) = p(itime,countm);
- ens_spread(2*itime-1) = p(itime,counts);
-
- ens_mean( 2*itime ) = a(itime,countm);
- ens_spread(2*itime ) = a(itime,counts);
-end
-
-subplot(plotdat.nregions,1,plotdat.region)
-
- % Since the mean and the spread are getting plotted
- % on the same figure, we should have two axes ...
- % bias on left, spread on right, for example. no time now ...
-
- gmean = mean(ens_mean( isfinite(ens_mean )));
- amean = mean(ens_spread(isfinite(ens_spread)));
- gstring = sprintf('Ens. mean; mean=%.3f',gmean);
- astring = sprintf('Ens. spread; mean=%.3f',amean);
-
- plot(x,ens_mean,'k+-',x,ens_spread,'ro-','LineWidth',1.5)
- grid
- ylabel(plotdat.ylabel, 'fontsize', 10);
- title(plotdat.title, 'Interpreter', 'none', ...
- 'Fontsize', 12, 'FontWeight', 'bold')
- h = legend(gstring, astring);
- legend(h,'boxoff')
-
- % a slightly better way to annotate dates, etc.
- ttot = max(x) - min(x) + 1;
- if ((plotdat.bin1 > 1000) && (ttot > 32));
- datetick('x',6,'keeplimits','keepticks');
- monstr = datestr(x(1),28);
- xlabel(sprintf('month/day - %s start',monstr))
- elseif (plotdat.bin1 > 1000);
- datetick('x',7);
- monstr = datestr(x(1),28);
- xlabel(sprintf('day of month - %s start',monstr))
- else
- xlabel('days')
- end
-
-
-
-function y = SqueezeMissing(x)
-
-missing = find(x < -98); % 'missing' is coded as -99
-
-if isempty(missing)
- y = x;
-else
- y = x;
- y(missing) = NaN;
-end
-
-
-
-function CenterAnnotation(main)
-subplot('position',[0.48 0.48 0.04 0.04])
-axis off
-h = text(0.5,0.5,main);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','bottom', ...
- 'Interpreter','none', ...
- 'FontSize',12, ...
- 'FontWeight','bold')
-
-
-
-function BottomAnnotation(main)
-% annotates the directory containing the data being plotted
-subplot('position',[0.48 0.01 0.04 0.04])
-axis off
-bob = which(main);
-[pathstr,name,ext,versn] = fileparts(bob);
-h = text(0.0,0.5,pathstr);
-set(h,'HorizontalAlignment','center', ...
- 'VerticalAlignment','middle',...
- 'Interpreter','none',...
- 'FontSize',8)
More information about the Dart-dev
mailing list