cf.set

cf.set(values, units=None, exact=True, attr=None)[source]

Return a cf.Query object for a variable for being equal to any member of a collection.

Parameters:

values: sequence

units: str or cf.Units, optional

The units of each element of values. 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:
>>> c = cf.set([3, 5])
>>> c
<CF Query: set [3, 5]>
>>> c == 4
False
>>> c == 5
True
>>> print c == numpy.array([2, 3, 4, 5])
[False  True False  True]