remotior_sensus.tools.band_spectral_distance module

Band spectral distance.

This tool allows for calculating the spectral distance pixel by pixel between two BandSets.

Typical usage example:

>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> catalog = rs.bandset_catalog()
>>> # create three BandSets
>>> file_list_1 = ['file1_b1.tif', 'file1_b2.tif', 'file1_b3.tif']
>>> file_list_2 = ['file2_b1.tif', 'file2_b2.tif', 'file2_b3.tif']
>>> catalog.create_bandset(file_list_1, bandset_number=1)
>>> catalog.create_bandset(file_list_2, bandset_number=2)
>>> distance = rs.band_spectral_distance(
... input_bandsets=[catalog.get(1), catalog.get(2)], output_path='output_path',
... )
remotior_sensus.tools.band_spectral_distance.band_spectral_distance(input_bandsets: list, output_path: None | str = None, algorithm_name: None | str = None, nodata_value: None | int = None, threshold: None | float = None, n_processes: None | int = None, available_ram: None | int = None, virtual_output: bool | None = False, overwrite: bool | None = False, bandset_catalog: BandSetCatalog | None = None, progress_message: bool | None = True) OutputManager

Band spectral distance.

This tool allows for calculating the spectral distance pixel by pixel between two BandSets, which can be useful for change detection. A new raster is created where pixel values rapresent the spectral distance between pixels of input BandSets. Optionally, a threshold value can be defined to create a binary raster where pixel value is 1 if distance > threshold or 0 otherwise.

Parameters:
  • input_bandsets – list of number of BandSets, or BandSet objects.

  • output_path – string of output path directory.

  • algorithm_name – algorithm name selected form cfg.classification_algorithms.

  • nodata_value – value to be considered as nodata.

  • threshold – threshold value to create a binary raster if distance > threshold.

  • 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.

  • overwrite – if True, output overwrites existing files.

  • bandset_catalog – optional type BandSetCatalog for BandSet number.

  • 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 spectral distance of two BandSets using threshold
>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> catalog = rs.bandset_catalog()
>>> # create three BandSets
>>> file_list_1 = ['file1_b1.tif', 'file1_b2.tif', 'file1_b3.tif']
>>> file_list_2 = ['file2_b1.tif', 'file2_b2.tif', 'file2_b3.tif']
>>> catalog.create_bandset(file_list_1, bandset_number=1)
>>> catalog.create_bandset(file_list_2, bandset_number=2)
>>> # start the process
>>> distance = rs.band_spectral_distance(
... input_bandsets=[1, 2], output_path='output_path',
... threshold=1000, bandset_catalog=catalog
... )