raster_tools.Raster.where
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.
Truecells pull values from this raster andFalsecells 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