Computation/
grad.pro
compute the gradient of a variable
grad
Calculation
result = grad(field, direc)
Return value
RES {type=2D, 3D or 4D array}
the gradient of the input data (with the same size)
Parameters
field
The field for which we want to compute the gradient. A 2D (xy),
3D (xyz or yt) or 4D (xyzt) array or a structure readable by litchamp
and containing a 2D (xy), 3D (xyz or yt) or 4D (xyzt) array.
note that the dimension of the arry must suit the domain dimension.
direc
type: scalar string
the gradient direction: 'x', 'y', 'z'
Examples
IDL> @tst_initorca2
IDL> plt, grad({arr:gphit,g:'T'}, 'x')
IDL> plt, grad({arr:gphit,g:'T'}, 'y')
Version history
Version
$Id: grad.pro 168 2006-09-06 10:46:29Z pinsard $
History
Sebastien Masson (smasson@lodyc.jussieu.fr)
Known issues
Restrictions
- Works only for Arakawa C-grid.
- When computing the gradient, the result is not on the same grid point
than the input data. In consequence, we update, vargrid and the grid position
parameters (firstx[tuvf], lastx[tuvf], nx[tuvf], firsty[tuvf], lasty[tuvf],
ny[tuvf], firstz[tw], lastz[tw], nz[tw]).
- points that cannot be computed (domain bondaries, coastline) are set to NaN
- the common variable jpt is used to differ xyz (jpt=1) and xyt (jpt=1) cases.
Other attributes
Uses routines
cm_4cal, cm_4data, cm_4mmesh
Produced by IDLdoc 2.0 on Wed Sep 13 16:32:08 2006.