[Dart-dev] [4348] DART/trunk/diagnostics/matlab/read_obs_netcdf.m: Added fields to the output structure: "numZtypes", "Zpositivedir", and " Zunits"

nancy at ucar.edu nancy at ucar.edu
Fri Apr 16 16:45:08 MDT 2010


Revision: 4348
Author:   thoar
Date:     2010-04-16 16:45:07 -0600 (Fri, 16 Apr 2010)
Log Message:
-----------
Added fields to the output structure: "numZtypes", "Zpositivedir", and "Zunits"

numZtypes will be 1 for a single observation level coordinate system, but since
the routine can return 'ALL' observations, this may be larger than 1.

Zpositivedir will be either 'up' or 'down' ... large positive numbers should be
at the top of the Z axis for 'up' and at the bottom for 'down'.

Zunits is unbelievable, since observation sequence files do not retain units.
Right now, the acceptable values are 'undefined','surface','pressure','level','depth'
I'm not telling ...

Modified Paths:
--------------
    DART/trunk/diagnostics/matlab/read_obs_netcdf.m

-------------- next part --------------
Modified: DART/trunk/diagnostics/matlab/read_obs_netcdf.m
===================================================================
--- DART/trunk/diagnostics/matlab/read_obs_netcdf.m	2010-04-13 17:37:02 UTC (rev 4347)
+++ DART/trunk/diagnostics/matlab/read_obs_netcdf.m	2010-04-16 22:45:07 UTC (rev 4348)
@@ -144,3 +144,54 @@
 if ~ isempty(myqc)
    obsstruct.qc = myqc(inds);
 end
+
+%% Try to determine if large numbers of the Z coordinate are up or down ...  
+%  The observation sequences don't actually have the units as part of the
+%  metadata. That would be 'nice'.
+
+ztypes = unique(obsstruct.Ztyp);
+
+obsstruct.numZtypes = length(ztypes);
+
+for itype = 1:obsstruct.numZtypes
+
+   if (     ztypes(itype) == -2 )   % VERTISUNDEF
+      obsstruct.Zpositivedir = 'up';
+      obsstruct.Zunits       = 'unknown';
+
+   elseif ( ztypes(itype) == -1 )   % VERTISSURFACE
+      obsstruct.Zpositivedir = 'up';
+      obsstruct.Zunits       = 'surface';
+
+   elseif ( ztypes(itype) ==  1 )   % VERTISLEVEL
+      % for example, cam level 1 is at the top of the atmosphere
+      obsstruct.Zpositivedir = 'down';
+      obsstruct.Zunits       = 'model level';
+
+   elseif ( ztypes(itype) ==  2 )   % VERTISPRESSURE
+      obsstruct.Zpositivedir = 'down';
+      obsstruct.Zunits       = 'pressure';
+
+   elseif ( ztypes(itype) ==  3 )   % VERTISHEIGHT
+      %% here is the troublemaker. 
+      obsstruct.Zpositivedir = 'up';
+      obsstruct.Zunits       = 'height';
+
+      % If the observations are from the World Ocean Database, they
+      % are probably depths. large positive numbers are near the
+      % center of the earth.
+
+      inds = strmatch('WOD', obsstruct.CopyString); 
+      if ( ~ isempty(inds) )
+         obsstruct.Zpositivedir = 'down';
+         obsstruct.Zunits       = 'depth';
+      end
+
+   else
+      error('not a known vertical coordinate system')
+   end
+
+end
+
+
+


More information about the Dart-dev mailing list