[MITgcm-devel] towards better MatLAB post-processing

Ed Hill ed at eh3.com
Fri Oct 21 17:09:44 EDT 2005


Hi folks,

Jean-Michel, Andrea, and I (and others!) have discussed MatLAB
post-processing tools on many occasions and have often agreed
that the existing tools need improvement.  But we haven't all
agreed what direction(s) to take.  In fact, we've had very
different ideas!

So today, we (JMC, AM, & me) had a "breakthrough" discussion and
heres the outcome.  We think it'll be a lot easier for folks to
use MNC by writing a better version of rdmnc() that spits out
data in multiple formats.  The idea is:

  [res,att] = rdnctiles(FilePatterns, VarNames, Times, flags)

    FilePatterns ::  either a string or a cell array of
                     strings that specify file patterns
                     eg. 'state.0000000000.t002.nc'
                         'state*'
                         { 'grid*' 'state*' 'phiHyd*' }

    VarNames     ::  either a string or a cell array of
                     strings that specifies the desired 
                     variable names
                     eg. 'S'
                         { 'Temp' 'S' 'XC' 'YC' }

    Times        ::  either a vector of model iteration
                     values or a struct that has fields
                     named 'iters' and/or 'times' that 
                     are each vectors of the desired 
                     iteration values and/or the desired 
                     model times in seconds
                     eg. [ 86400:86400:864000 ]
                         times.iters=[ 3600:3600:36000 ]
                         times.times=[ 7200 ]

    flags [OPT]  ::  optional string containing a flag
                     that defualts to 'oldflat'

    res          ::  results are written as a struct or 
                     a struct array with fields named 
                     after the variables
                     eg. res.U res.V res.Temp ...

    att          ::  a struct or a struct array containing 
                     the global attributes from the netCDF 
                     file(s)

And the key thing is the (optional!) flag.  The flag determines
the format (matrix shape/rank) of the variables.  Flag values
that we hashed out today are:

  'oldflat'  :: 

    this is the default value and its meant to be compatible
    with the output generated by rdmds() so that any variables
    read with it will be immediately usable with all our
    existing scripts

    eg.  res = rdnctiles('state*','U',[36000]);
         for exch1:     size(res.U) --> [ Nx*Ny Nr Nt ]
         for the cube:  size(res.U) --> [ (nC*nF)*nC Nr Nt ]
                        where: nC = nRed = nBlue = nGreen


  'compact'  ::

    this format is going to be specified by JMC and it is meant
    to be a compact vector of values that contains every value
    (inc. all corner points) without any redundancies and in a
    specified order (rank/shape)

    eg.  res = rdnctiles('state*','U',[36000], 'compact')
         size(res.U) --> order specified by JMC


  'bytile'   ::

    this format will be specified at a later date by EH3 and it
    is meant to allow folks to easily work with the data in a
    per-tile fashion


  'byface'  ::

    like 'bytile' but with per-face assembly


The above is partly implemented and checked in at:

  MITgcm/utils/matlab/gmt

And *PLEASE* point out possible improvements if you can!

Ed


-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS;  Rm 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464




More information about the MITgcm-devel mailing list