cf.set¶
-
cf.
set
(values, units=None, attr=None, exact=True)[source]¶ A
Query
object for a “member of set” condition.See also
cf.contains
,cf.eq
,cf.ge
,cf.gt
,cf.ne
,cf.le
,cf.lt
,cf.wi
,cf.wo
,cf.isclose
- Parameters
- value: sequence
The query condition’s value.
- units:
str
orUnits
, optional The units of value. By default, the same units as the operand being tested are assumed, if applicable. If units is specified and value already has units (such as those attached to a
Data
object), then the pair of units must be equivalent.- attr:
str
, optional Apply the condition to the attribute, or nested attributes, of the operand, rather than the operand itself. Nested attributes are specified by separating them with a
.
. For example, the “month” attribute of the “bounds” attribute is specified as'bounds.month'
.- exact: deprecated at version 3.0.0.
Use
re.compile
objects in value instead.
- Returns
Query
The query object.
Examples
>>> c = cf.set([3, 5]) >>> c == 4 False >>> c == 5 True >>> c == numpy.array([2, 3, 4, 5]) array([False True False True])