semantique.ArrayProxy.assign

semantique.ArrayProxy.assign#

ArrayProxy.assign(y, at=None, **kwargs)[source]#

Assign new values to the pixels in an array.

Assigns a new value to each non-missing observation in the input, without any computation. Optionally, it assigns these new values only to a subset of pixels (which may have missing values) in the input. Which pixels these are is defined by the at argument.

Parameters:
  • y – Values to be assigned. May be a constant, meaning that the same value is assigned to each pixel. May also be a proxy of another array which can be aligned to the same shape as the input.

  • at (ArrayProxy, optional) – Proxy of a binary array which can be aligned to the same shape as the input.

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

Returns:

ArrayProxy

Examples

>>> import semantique as sq
>>> sq.entity("water").assign(True, at = sq.entity("cloud"))
>>> sq.entity("water").assign(sq.self().extract("time", "year"))