cf.Field.cell_method¶
-
Field.cell_method(*identity, default=ValueError(), key=False, item=False, **filter_kwargs)[source]¶ Select a cell method construct.
If zero or two or more constructs are selected then an exception is raised, or the default parameter is returned.
New in version (cfdm): 1.10.0.0
See also
- Parameters
- identity: optional
Select cell method constructs that have an identity, defined by their
identitiesmethods, that matches any of the given values.Additionally, the values are matched against construct identifiers, with or without the
'key%'prefix.Additionally, if for a given value
f.domain_axes(value)returns a unique domain axis construct then any cell method constructs that span exactly that axis are selected. Seedomain_axesfor details.If no values are provided then all cell method constructs are selected.
A value may be any object that can match via the
==operator, or are.Patternobject that matches via itssearchmethod.Note that in the output of a
dumpmethod orprintcall, a construct is always described by an identity that will select it.- key:
bool, optional If True then return the selected construct identifier. By default the construct itself is returned.
- item:
bool, optional If True then return the selected construct identifier and the construct itself. By default the construct itself is returned. If key is True then item is ignored.
- default: optional
Return the value of the default parameter if there is no unique construct.
If set to an
Exceptioninstance then it will be raised instead.- filter_kwargs: optional
Keyword arguments as accepted by
Constructs.filterthat define additional construct selection criteria.
- Returns
The selected construct, or its identifier if key is True, or a tuple of both if item is True.
Examples