raster_tools.Raster.reclassify#

Raster.reclassify(remapping, unmapped_to_null=False)[source]#

Reclassify raster values based on a mapping.

The raster must have an integer type.

Parameters
  • remapping (str, dict) – Can be either a dict or a path string. If a dict is provided, the keys will be reclassified to the corresponding values. If a path string, it is treated as an ASCII remap file where each line looks like a:b and a and b are integers. All remap values (both from and to) must be integers.

  • unmapped_to_null (bool, optional) – If True, values not included in the mapping are instead mapped to the null value. Default is False.

Returns

The remapped raster.

Return type

Raster