cf.Comparison.evaluate

Comparison.evaluate(x)[source]

Evaluate the comparison operation for a given object.

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 : object

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

Returns :
out :

The result of the operation given by the operator attribute with x as its left hand side operand and the value attribute as its right hand side operand.

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.CoordinateList

This Page