semantique.processor.arrays.Array.assign

Contents

semantique.processor.arrays.Array.assign#

Array.assign(y, at=None, track_types=True, **kwargs)[source]#

Apply the assign verb to the array.

The assign verb assigns new values to the pixels in an array, without any computation. Unless specifically stated through the at argument, it does not assign new values to missing pixels (i.e. those pixels having a missing value).

Parameters:
  • y – Value(s) to be assigned. May be a constant, meaning that the same value is assigned to every pixel. May also be another array which can be aligned to the same shape as the input array. In the latter case, the value assigned to a pixel in the input array is the value of the pixel in array y that has the same dimension coordinates.

  • at (xarray.DataArray, optional) – Binary array which can be aligned to the same shape as the input array. To be used for conditional assignment, in which a pixel in the input will only be assigned a new value if the if the pixel in at with the same dimension coordinates is true.

  • track_types (bool) – Should the value type of the output object be promoted, and should it be checked that at has value type binary?

  • **kwargs – Ignored.

Returns:

xarray.DataArray

Raises:

exceptions.InvalidValueTypeError – If track_types = True and the value type of at is not binary.