cf.eq

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

Return a cf.Query object for a variable for being equal to a value.

Parameters:
value

The value which a variable is to be compared with.

units: str or cf.Units, optional

The units of value. By default, the same units as the variable being tested are assumed, if applicable.

exact: bool, optional

If False then string values are to be treated as regular expressions understood by the re module and are evaluated using the re.match method.

attr: str, optional

Return a query object for a variable’s attr attribute.

Returns:
out: cf.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