[MITgcm-support] Loading a 1D time series

Ed Hill ed at eh3.com
Tue Feb 21 19:40:28 EST 2006


On Wed, 2006-02-22 at 00:58 +0100, Petter Stenström wrote:
> What is the easiest way to load a long time series to the model, i.e. not
> a field, but just a 1D time series of a scalar, without having to write
> all the values in the data file?

Hi Petter,

MNC (the MITgcm netCDF package) can do the above and it will
automatically handle variable type conversions (R*4,R*8,I) and all
"endian" (byte-swapping) issues.  Basically, you just put the data in a
netCDF file and define it as a function of a single dimension such as:

  #  this is sample output from "ncdump your_mnc_file.nc":
  dimensions:
    T = UNLIMITED ; // (2 currently)
  variables:
    double a_var(T) ;
             a_var:long_name = "name" ;
             a_var:units = "m/s" ;

and then, within the model, define the variable (do this exactly once!)
as having a single time dimension using, for instance:

  # see MITgcm/model/src/ini_mnc_vars.F
  CALL MNC_CW_ADD_VNAME('a_var', '-_-_--__-__t', 0,0, myThid)
  CALL MNC_CW_ADD_VATTR_TEXT('a_var','long_name','name', myThid)
  CALL MNC_CW_ADD_VATTR_TEXT('a_var','units','m/s', myThid)

and then call it (as many times as necessary) with syntax such as:

  CALL MNC_CW_SET_UDIM(fn, time_level, myThid)
  fn(1:12) = 'your_file.nc'
  CALL MNC_CW_RL_R('D',fn,0,0,'a_var',var, myThid)

and that should be it.  There are a number of examples in the code that
show how to do the above -- just "grep" for them.  And the above is all
described in the on-line manual in Chapter 7:

  http://mitgcm.org/r2_web_testing/latest/
  http://mitgcm.org/r2_web_testing/latest/online_documents/node1.html

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-support mailing list