remotior_sensus.tools.band_sieve module

Band sieve.

This tool allows for performing the sieve of raster bands removing patches having size lower than a threshold (i.e. number of pixels).

Typical usage example:

>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> # start the process
>>> sieve = rs.band_sieve(
... input_bands=['file1.tif', 'file2.tif'],size=2,
... output_path='directory_path', connected=False,prefix='sieve_'
... )
remotior_sensus.tools.band_sieve.band_sieve(input_bands: list | int | BandSet, size: int, output_path: str | list | None = None, connected: bool | None = None, overwrite: bool | None = False, prefix: str | None = '', extent_list: list | None = None, multiple_resolution: bool | None = True, n_processes: None | int = None, available_ram: None | int = None, bandset_catalog: BandSetCatalog | None = None, virtual_output: bool | None = None, progress_message: bool | None = True) OutputManager

Perform band sieve.

This tool allows for performing the sieve of raster bands removing patches having size lower than a threshold (i.e. number of pixels).

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.

  • size – size of dilation in pixels.

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

  • connected – if True, consider 8 pixel connection; if False, consider 4 pixel connection.

  • prefix – optional string for output name prefix.

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

  • multiple_resolution – if True, keep the original resolution of individual raster; if False, use the resolution of the first raster for all the bands.

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

Examples

Perform the sieve of size 3 with connected pixel (8 connection)
>>> sieve = band_sieve(
... input_bands=['file1.tif', 'file2.tif'], size=3,
... output_path='directory_path', connected=True, prefix='sieve_'
... )