remotior_sensus.tools.band_clustering module

Band clustering.

This tool allows for the automatic clustering of a BandSet or a list of files.

Typical usage example:

>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> catalog = rs.bandset_catalog()
>>> # create a BandSets
>>> file_list_1 = ['file1_b1.tif', 'file1_b2.tif', 'file1_b3.tif']
>>> catalog.create_bandset(file_list_1, bandset_number=1)
>>> # start the process
>>> output = rs.band_clustering(
... input_bands=catalog.get_bandset(1), output_raster_path='output.tif',
... algorithm_name='minimum distance', class_number=10,
... seed_signatures='random pixel'
... )
remotior_sensus.tools.band_clustering.band_clustering(input_bands: list | int | BandSet, output_raster_path: str, algorithm_name: str, class_number: int, seed_signatures: str | SpectralSignaturesCatalog | None = None, threshold: None | float = None, max_iter: None | int = None, overwrite: bool | None = False, nodata_value: None | int = None, extent_list: list | None = None, n_processes: None | int = None, available_ram: int | None = None, bandset_catalog: BandSetCatalog | None = None, progress_message: bool | None = True) OutputManager

Calculation of Band Clustering.

This tool allows for the calculation of Band Clustering. A classification raster file is created. In addition, the spectral signatures of the final iteration are saved as .scpx file.

Parameters:
  • input_bands – input of type BandSet or list of paths or integer number of BandSet.

  • output_raster_path – path of output file.

  • algorithm_name – algorithm name selected from cfg.classification_algorithms between minimum distance and spectral angle maping.

  • class_number – the output number of classes (default = 10).

  • seed_signatures – the type of seed signatures (random pixel or band mean) or a SpectralSignaturesCatalog() containing spectral signatures, or path of spectral signature file.

  • threshold – if None, classification without threshold; if float, use this value as threshold for all the signatures.

  • max_iter – sets the maximum number of iterations (default = 10).

  • overwrite – if True, output overwrites existing files.

  • nodata_value – value to be considered as nodata.

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

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

  • extra = {‘signature_path’: output spectral signature .scpx file path}

Examples

Perform the clustering on a list of files
>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> # input file list
>>> file_list_2 = ['file1_b1.tif', 'file1_b2.tif', 'file1_b3.tif']
>>> # start the process
>>> output = rs.band_clustering(
... input_bands=file_list_2, output_raster_path='output.tif',
... algorithm_name='minimum distance', class_number=10,
... seed_signatures='band mean'
... )