[Thread Prev][Thread Next][Index]

Variable from a grid



Hello,

I'd like to write a simple script "def_var_from_grid.jnl" which takes a
grid name (g_in) as input, then defines a variable (v_out) on that grid.
Sounds easy: if the grid had x and y axes only, then

let v_out = 0*x[gx=g_in] + 0*y[gy=g_in]

would do the trick.  Problem is, how can I determine whether a given axis
is present in g_in?  SHOW GRID provides this information (absent axes are
tagged as "normal"), but how can I grab this info in the script?  Note
that barging ahead with

let v_out = 0*x[gx=g_in] + 0*y[gy=g_in] + 0*z[gz=g_in] + 0*t[gt=g_in]

replaces the nonexistent axes with "abstract" axes in v_out.  This leads
to overflow errors when dumping the data to a file.

Any help would be much appreciated,

Andrew

P.S. The larger context for this is an attempt to collect a (possibly
transformed) variable from multiple files into a single file.  Say, a
model parameter sensitivity study, where you want to see a map of how some
model quantity changes as a function of two model parameters x and y.  
The model parameters are introduced as two new axes, and the data are
appended, one input file at a time.

Many of Ferret's functions (e.g. reshape) and queries (`return=isize`)
require variable names to obtain their grid information; they won't accept
the names of grids.  Being able to define a variable from a grid would
allow the user to take advantage of these functions for grids.

----------------------------------------------------------------------
Andrew Wittenberg          Program in Atmospheric and Oceanic Sciences
andyw@splash.princeton.edu                        Princeton University
----------------------------------------------------------------------





[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement