cf.eq

cf.eq(value, units=None, attr=None, exact=True)[source]

A Query object for an “equal” condition.

Parameters:
value:

The query condition’s value.

units: str or Units, optional

The units of value. By default, the same units as the operand being tested are assumed, if applicable. If units is specified and the already value has units (such as a Data object`), then they 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:

>>> q = cf.eq(5)
>>> q
<CF Query: x eq 5>
>>> q.evaluate(5)
True
>>> q == 4
False
>>> q = cf.eq('air', exact=False)
>>> q == 'air_temperature'
True
>>> q = cf.eq('.*temp', exact=False)
>>> q == 'air_temperature'
True