cf.Query.evaluate¶
- Query.evaluate(x)[source]¶
Evaluate the query operation for a given left hand side operand.
Note that for the query object
q
and any object,x
,x==q
is equivalent toq.evaluate(x)
andx!=q
is equivalent toq.evaluate(x)==False
.- Parameters:
- x:
The object for the left hand side operand of the query.
- Returns:
The result of the query. The nature of the result is dependent on the object type of x.
Examples
>>> q = cf.Query('lt', 5.5) >>> q.evaluate(6) False
>>> q = cf.Query('wi', (1,2)) >>> array = numpy.arange(4) >>> array array([0, 1, 2, 3]) >>> q.evaluate(array) array([False, True, True, False], dtype=bool)