Variable Querying Routines¶
Operations that retrieve information about the variable.
- Var.whichaxis(iaxis)[source]¶
Locates a particular
Axis
associated with this variable.- Parameters
- iaxisstring,
Axis
class, or int The search criteria for finding the class.
- iaxisstring,
- Returns
- iThe index of the matching Axis. Raises
KeyError
if there is no match.
- iThe index of the matching Axis. Raises
Examples
>>> from pygeode.tutorial import t1 >>> T = t1.Temp >>> print(T.axes) (<Lat>, <Lon>) >>> print(T.whichaxis('lat')) 0 >>> print(T.whichaxis('lon')) 1 >>> print(T.whichaxis('time')) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/pygeode/var.py", line 352, in whichaxis raise KeyError, "axis %s not found in %s"%(repr(iaxis),self.axes) KeyError: "axis 'time' not found in (<Lat>, <Lon>)"
- Var.hasaxis(iaxis)[source]¶
Determines if a particular
Axis
is associated with this variable.- Parameters
- iaxisstring,
Axis
class, or int The search criteria for finding the class.
- iaxisstring,
- Returns
- foundboolean.
True
if found, otherwiseFalse
- foundboolean.
- Var.getweights(iaxes=None)[source]¶
Returns weights associated with the axes of this variable.
- Parameters
- iaxeslist of axis identifiers (string,
Axis
, or int) (optional) Axes over which to compute the weights
- iaxeslist of axis identifiers (string,
- Returns
- weights
Var
defined on the subgrid of this variable on which weights are defined.
- weights
See also
- See Also: