cf.set

cf.set(values, units=None, regex=False, attr=None)[source]

Return a comparison 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.

regex : str, optional

If True then each element of values is assumed to be a string containing a regular expression, which is evaluated using the re.search function.

Returns :
out : cf.Comparison

The comparison object.

See also

eq, ge, gt, ne, le, lt, wi, wo

Examples

>>> c = cf.set([3, 5])
>>> c
<CF Comparison: set [3, 5]>
>>> c == 4
False
>>> c == 5
True
>>> print c == numpy.array([2, 3, 4, 5])
[False  True False  True]

Previous topic

cf.ne

Next topic

cf.wi

This Page