semantique.ArrayProxy.evaluate

semantique.ArrayProxy.evaluate#

ArrayProxy.evaluate(operator, y=None, **kwargs)[source]#

Evaluate an expression for each pixel in an array.

Evaluates an expression for each pixel in the input. This expression may be univariate, i.e. applying an operator to a single value, or bivariate, e.g. an arithmetic operation (add, multiply, ..) or a condition (equals, greater, ..). In the bivariate case, the second operand may be a constant (e.g. multiply by 2) or a second array (e.g. add the pixels of two arrays).

Parameters:
  • operator (str) – Name of the operator to be used in the expression. Should either be one of the built-in operators of semantique, or a user-defined operator which will be provided to the query processor when executing the query recipe.

  • y (optional) – Right-hand side of a bivariate expression. May be a constant, meaning that the same value is used in each expression. May also be a proxy of another array which can be aligned to the same shape as the input. Ignored when the operator is univariate.

  • **kwargs – Additional keyword arguments passed on to Array.evaluate.

Returns:

ArrayProxy

Examples

>>> import semantique as sq
>>> sq.entity("water").evaluate("not")
>>> sq.entity("water").evaluate("or", sq.entity("vegetation"))