remotior_sensus.tools.band_pca module

Band PCA.

This tool allows for the calculation of Principal Components Analysis on input bands, producing rasters corresponding to the principal components.

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_pca(input_bands=catalog.get_bandset(1),
... output_path='directory_path')
remotior_sensus.tools.band_pca.band_pca(input_bands: list | int | BandSet, output_path: str | list | None = 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, number_components: None | int = None, progress_message: bool | None = True) OutputManager

Calculation of Principal Components Analysis.

This tool allows for the calculation of Principal Components Analysis of raster bands obtaining the principal components. A new raster file is created for each component. In addition, a table containing the Principal Components statistics is created.

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

  • output_path – string of output path directory or list of paths.

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

  • number_components – defines the maximum number of components calculated.

  • 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
  • paths = output list

  • extra = {‘table’: table path string}

Examples

Perform the PCA on the first BandSet
>>> # 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
>>> pca = rs.band_pca(input_bands=catalog.get_bandset(1),output_path='directory_path')