raster_tools.Raster.where#

Raster.where(condition, other)[source]#

Filter elements from this raster according to condition.

Parameters
  • condition (str or Raster) – A boolean or int raster that indicates where elements in this raster should be preserved and where other should be used. If the condition is an int raster, it is coerced to bool using condition > 0. True cells pull values from this raster and False cells pull from other. str is treated as a path to a raster.

  • other (scalar, str or Raster) – A raster or value to use in locations where condition is False. str is treated as a path to a raster.

Returns

The resulting filtered Raster.

Return type

Raster