cf.wi

cf.wi(value0, value1, units=None, attr=None)[source]

Return a cf.Query object for a variable being within a range.

x == cf.wi(a, b) is equivalent to x == cf.ge(a) & cf.le(b).

x == cf.wi(a, b, attr='foo') is equivalent to x.foo == cf.wi(a, b).

Parameters:
value0 : scalar object

The lower bound of the range which a variable is to be compared with.

value1 : scalar object

The upper bound of the range which a variable is to be compared with.

units : str or cf.Units, optional

If applicable, the units of value0 and value1. By default, the same units as the variable being tested are assumed.

attr : str, optional

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

Returns:
out : cf.Query

The query object.

Examples:
>>> q = cf.wi(5, 7)
>>> q
<CF Query: wi (5, 7)>
>>> q.evaluate(6)
True
>>> q.evaluate(4)
False

Previous topic

cf.set

Next topic

cf.wo

This Page