remotior_sensus.tools.raster_reclassification module

Raster reclassification.

This tool allows for the reclassification of a raster based on a reclassification table.

Typical usage example:

>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> # start the process
>>> reclassification = rs.raster_reclassification(raster_path='file1.tif',
... output_path='output.tif',
... reclassification_table=[[1, -10], ['nan', 6000]])
remotior_sensus.tools.raster_reclassification.raster_reclassification(raster_path: str, output_path: None | str = None, overwrite: bool | None = False, reclassification_table: list | array | None = None, csv_path: None | str = None, separator: str | None = ',', output_data_type: None | str = None, extent_list: list | None = None, n_processes: None | int = None, available_ram: None | int = None, virtual_output: bool | None = None, progress_message: bool | None = True) OutputManager

Performs raster reclassification.

This tool reclassifies a raster based on a reclassification table. The reclassification table is defined by two columns: old values and new values. Old values define the values of the raster to be reclassified to new values. Old values can be integer numbers or conditions selecting ranges of values.

Parameters:
  • raster_path – path of raster used as input.

  • output_path – string of output path.

  • overwrite – if True, output overwrites existing files.

  • reclassification_table – table of values for reclassification or list of values [[old_value, new_value], …]; if None, csv_path is used.

  • csv_path – path to a csv file containing the reclassification table; used if reclassification_table is None.

  • separator – separator character for csv file; default is comma separated.

  • output_data_type – set output data type such as ‘Float32’ or ‘Int32’; if None, input data type is used.

  • extent_list – list of boundary coordinates left top right bottom.

  • n_processes – number of parallel processes.

  • available_ram – number of megabytes of RAM available to processes.

  • virtual_output – if True (and output_path is directory), save output as virtual raster of multiprocess parts.

  • progress_message – if True then start progress message, if False does not start the progress message (useful if launched from other tools).

Returns:

Object OutputManager() with
  • path = output path

Examples

Perform the reclassification using a csv file containing the reclassification values
>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> # start the process
>>> reclassification = rs.raster_reclassification(raster_path='file1.tif',output_path='output.tif',csv_path='file.csv')
remotior_sensus.tools.raster_reclassification.unique_values_table(raster_path: str, n_processes: None | int = None, available_ram: None | int = None, incremental: bool | None = False, progress_message: bool | None = True)

Calculate unique values from raster.