[Dart-dev] [4150] DART/trunk: alpha test

nancy at ucar.edu nancy at ucar.edu
Wed Nov 18 17:44:18 MST 2009


Revision: 4150
Author:   thoar
Date:     2009-11-18 17:44:18 -0700 (Wed, 18 Nov 2009)
Log Message:
-----------
alpha test

Added Paths:
-----------
    DART/trunk/models/wrf/matlab/link_obs.m
    DART/trunk/observations/utilities/threed_sphere/linked_observations.m

-------------- next part --------------
Added: DART/trunk/models/wrf/matlab/link_obs.m
===================================================================
--- DART/trunk/models/wrf/matlab/link_obs.m	                        (rev 0)
+++ DART/trunk/models/wrf/matlab/link_obs.m	2009-11-19 00:44:18 UTC (rev 4150)
@@ -0,0 +1,51 @@
+function link_obs(fname,ObsTypeString)
+% link_obs generates the 'brushable' observation plots.
+%
+% EXAMPLE 1:
+% fname         = 'obs_sequence_013.nc';
+% ObsTypeString = 'RADIOSONDE_TEMPERATURE';
+% link_obs(fname,ObsTypeString)
+%
+% EXAMPLE 3:
+% link_obs('obs_sequence_003.nc','RADIOSONDE_TEMPERATURE')
+
+% Data Assimilation Research Testbed -- DART
+% Copyright 2004-2009, 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$
+
+region        = [0 360 -90 90 -Inf Inf];
+CopyString    = 'observation';
+CopyString    = 'NCEP BUFR observation';
+QCString      = 'DART quality control';
+verbose       = 1;
+
+obs = read_obs_netcdf(fname, ObsTypeString, region, CopyString, QCString, verbose);
+
+obs.lonindex  = 1;
+obs.latindex  = 2;
+obs.zindex    = 3;
+obs.obsindex  = 4;
+obs.qcindex   = 5;
+obs.keyindex  = 6;
+obs.timeindex = 7;
+obs.indindex  = 8;
+
+global obsmat
+obsmat = zeros(length(obs.lons),5);
+obsmat(:,obs.lonindex ) = obs.lons;
+obsmat(:,obs.latindex ) = obs.lats;
+obsmat(:,obs.zindex   ) = obs.z;
+obsmat(:,obs.obsindex ) = obs.obs;
+obsmat(:,obs.qcindex  ) = obs.qc;
+obsmat(:,obs.keyindex ) = obs.keys;
+obsmat(:,obs.timeindex) = obs.time;
+obsmat(:,obs.indindex ) = [1:length(obs.time)];
+
+linked_observations(obsmat,obs)


Property changes on: DART/trunk/models/wrf/matlab/link_obs.m
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/x-matlab
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: DART/trunk/observations/utilities/threed_sphere/linked_observations.m
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/linked_observations.m	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/linked_observations.m	2009-11-19 00:44:18 UTC (rev 4150)
@@ -0,0 +1,163 @@
+function linked_observations(obsmat,obs)
+% linked_observations(obs)
+%
+% obs is a structure with the following required components
+%
+% obs.lons	longitudes of the observations
+% obs.lats	latitudes of the observations
+% obs.z		vertical level (depth) of the observations
+% obs.obs	observation values
+% obs.qc	observation DART QC code
+
+% Data Assimilation Research Testbed -- DART
+% Copyright 2004-2009, 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$
+
+% Create figure
+%figure1 = figure('XVisual',...
+%    '0x24 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)',...
+%    'Renderer','OpenGL');
+figure1 = figure(1); clf(figure1);;
+
+%% Create axes for 3D plot
+axes0 = axes('Parent',figure1,'OuterPosition',[0 0 1 0.90],'FontSize',12);
+view(axes0,[-37.5 30]);
+grid(axes0,'on');
+hold(axes0,'all');
+
+xstring = sprintf('obsmat(:,%d)',obs.lonindex);
+ystring = sprintf('obsmat(:,%d)',obs.latindex);
+zstring = sprintf('obsmat(:,%d)',obs.zindex  );
+
+h0 = scatter3(obsmat(:,obs.lonindex), obsmat(:,obs.latindex), obsmat(:,obs.zindex), ...
+             'Parent',axes0,'DisplayName','observation locations', ...
+             'XDataSource',xstring, ...
+             'YDataSource',ystring, ...
+             'ZDataSource',zstring);
+
+worldmap('light');
+xlabel('longitude');
+ylabel('latitude');
+zlabel('depth');
+h = title({obs.ObsTypeString, ...
+      sprintf('%s ---> %s',obs.timestring(1,:),obs.timestring(2,:)) });
+set(h,'Interpreter','none')
+linkdata on
+
+%% Create figure for ancillary plots
+
+figure2 = figure(2); clf(figure2); orient tall; wysiwyg
+
+%% Create axes for time VS. QC
+axes4 = axes('Parent',figure2,'OuterPosition',[0 0.80 1 0.175]);
+set(axes4,'XAxisLocation','top')
+box(axes4,'on');
+hold(axes4,'all');
+
+xstring = sprintf('obsmat(:,%d)',obs.timeindex);
+ystring = sprintf('obsmat(:,%d)',obs.qcindex);
+h4 = scatter(obsmat(:,obs.timeindex),obsmat(:,obs.qcindex),'Parent',axes4, ...
+             'DisplayName','time vs qc', ...
+             'XDataSource',xstring, ...
+             'YDataSource',ystring);
+datetick(axes4,'x',6);
+ylabel(obs.QCString);
+
+%% Create axes for observation index VS. time 
+axes3 = axes('Parent',figure2,'OuterPosition',[0 0.575 1 0.175]);
+box(axes3,'on');
+hold(axes3,'all');
+
+xstring = sprintf('obsmat(:,%d)',obs.timeindex);
+ystring = sprintf('obsmat(:,%d)',obs.indindex);
+h3 = scatter(obsmat(:,obs.timeindex),obsmat(:,obs.indindex),'Parent',axes3, ...
+             'DisplayName','time vs key', ...
+             'XDataSource',xstring, ...
+             'YDataSource',ystring);
+ylabel('obs count');
+datetick(axes3,'x',6);
+
+%% Create axes for observation index VS. linked list key
+axes2 = axes('Parent',figure2,'OuterPosition',[0.0 0.400 1 0.15]);
+box(axes2,'on');
+hold(axes2,'all');
+
+xstring = sprintf('obsmat(:,%d)',obs.indindex);
+ystring = sprintf('obsmat(:,%d)',obs.keyindex);
+h2 = scatter(obsmat(:,obs.indindex),obsmat(:,obs.keyindex),'Parent',axes2, ...
+             'DisplayName','count vs key', ...
+             'XDataSource',xstring, ...
+             'YDataSource',ystring);
+xlabel('obs count');
+ylabel('key');
+
+%% Create axes for QC vs. ObsVal scatterplot
+axes1 = axes('Parent',figure2,'Position',[0.05 0.05 0.6 0.25]);
+box(axes1,'on');
+hold(axes1,'all');
+
+xstring = sprintf('obsmat(:,%d)',obs.obsindex);
+ystring = sprintf('obsmat(:,%d)',obs.qcindex);
+h1 = scatter(obsmat(:,obs.obsindex),obsmat(:,obs.qcindex),'Parent',axes1, ...
+             'DisplayName','obs vs qc', ...
+             'XDataSource',xstring, ...
+             'YDataSource',ystring);
+xlabel(obs.CopyString);
+title(obs.QCString);
+
+
+LabelQC(obs.QCString, obs.qc)
+
+
+refreshdata
+linkdata on
+
+
+function LabelQC(QCString, qcarray)
+%% Create legend for (DART) QC values.
+%
+% 0     observation assimilated
+% 1     observation evaluated only
+%   --- everything above this means the prior and posterior are OK
+% 2     assimilated, but the posterior forward operator failed
+% 3     Evaluated only, but the posterior forward operator failed
+%   --- everything above this means only the prior is OK
+% 4     prior forward operator failed
+% 5     not used
+% 6     prior QC rejected
+% 7     outlier rejected
+
+dartqc_strings = { 'assimilated', ...
+        'observation evaluated only', ...
+   'assimilated, post fwd op failed', ...
+     'eval only, post fwd op failed', ...
+     'prior forward operator failed', ...
+                          'not used', ...
+                 'prior QC rejected', ...
+                  'outlier rejected', ...
+                          'reserved'};
+
+switch lower(strtrim(QCString))
+   case 'dart quality control',
+
+      qcvals  = unique(qcarray);
+      qccount = zeros(size(qcvals));
+      for i = 1:length(qcvals)
+         qccount(i) = sum(qcarray == qcvals(i));
+         s{i} = sprintf('%d - %s %d obs',qcvals(i), dartqc_strings{qcvals(i)+1}, qccount(i));
+      end
+
+      set(gca,'YTick',qcvals,'YAxisLocation','right')
+      set(gca,'YTickLabel',char(s))
+
+   otherwise,
+      str = sprintf('no way to interpret values of %s',strtrim(QCString));
+      text(0.0, 0.0, str)
+end


Property changes on: DART/trunk/observations/utilities/threed_sphere/linked_observations.m
___________________________________________________________________
Added: svn:mime-type
   + text/x-matlab
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native


More information about the Dart-dev mailing list