cf.Field.cell_measure¶
-
Field.
cell_measure
(identity, default=ValueError(), key=False)[source]¶ Select a cell measure construct by its identity.
New in version 3.0.0
See also
TODO
Parameters: - identity:
Select the cell measure construct by:
- The identity or key of a cell measure construct.
- The identity or key of a domain axis construct that is spanned by a unique 1-d cell measure construct’s data.
- The position, in the field construct’s data, of a domain axis construct that is spanned by a unique 1-d cell measure construct’s data.
A construct identity is specified by a string (e.g.
'long_name=Cell Area', ``'ncvar%areacello'
, etc.); aQuery
object (e.g.cf.eq('measure:area')
); or a compiled regular expression (e.g.re.compile('^atmosphere')
) that selects the relevant constructs whose identities match viare.search
.Each construct has a number of identities, and is selected if any of them match any of those provided. A construct’s identities are those returned by its
identities
method. In the following example, the constructx
has six identities:>>> x.identities() ['time', 'long_name=Time', 'foo=bar', 'standard_name=time', 'ncvar%t', T']
A construct key may optionally have the
'key%'
prefix. For example'cellmeasure2'
and'key%cellmeasure2'
are both acceptable keys.A position of a domain axis construct in the field construct’s data is specified by an integer index.
Note that in the output of a
print
call ordump
method, a construct is always described by one of its identities, and so this description may always be used as an identity argument.- Parameter example:
identity='measure:area'
- Parameter example:
identity='cell_area'
- Parameter example:
identity='long_name=Cell Area'
- Parameter example:
identity='cellmeasure1'
- Parameter example:
identity='domainaxis2'
- Parameter example:
identity=0
- key:
bool
, optional If True then return the selected construct key. By default the construct itself is returned.
- default: optional
Return the value of the default parameter if a construct can not be found. If set to an
Exception
instance then it will be raised instead.
Returns: CellMeasure`or `str
The selected cell measure construct, or its key.
Examples:
TODO