cf.Comparison.evaluate

Comparison.evaluate(x)[source]

Evaluate the comparison operation for a given left hand side operand.

Note that for the comparison object c and any object, x, x==c is equivalent to c.evaluate(x) and x!=c is equivalent to c.evaluate(x)==False.

Parameters :
x :

The object for the left hand side operand of the comparison.

Returns :
out :

The result of the comparison. The nature of the result is dependent on the object type of x.

Examples

>>> c = cf.Comparison('lt', 5.5)
>>> c.evaluate(6)
False
>>> c = cf.Comparison('wi', (1,2))
>>> array = numpy.arange(4)
>>> array
array([0, 1, 2, 3])
>>> c.evaluate(array)
array([False,  True,  True, False], dtype=bool)

Previous topic

cf.Comparison.dump

Next topic

cf.Datetime

This Page