raster_tools.reclassify#
- raster_tools.reclassify(raster, remapping, unmapped_to_null=False)[source]#
Reclassify the input raster values based on a mapping.
- Parameters
raster (str, Raster) – The input raster to reclassify. Can be a path string or Raster object.
remapping (str, dict) – Can be either a
dictor a path string. If adictis provided, the keys will be reclassified to the corresponding values. It is possible to map values to the null value by providingNonein the mapping. If a path string, it is treated as an ASCII remap file where each line looks likea:bandaandbare scalars.bcan also be “NoData”. This indicates thatawill be mapped to the null value. The output values of the mapping can cause type promotion. If the input raster has integer data and one of the outputs in the mapping is a float, the result will be a float raster.unmapped_to_null (bool, optional) – If
True, values not included in the mapping are instead mapped to the null value. Default isFalse.
- Returns
The remapped raster.
- Return type