remotior_sensus.tools.raster_label module
Raster label.
This tool allows for the label of raster pixels based on contiguous patches. Any value not equal to 0 is considered as input, while 0 is considered as background. Contiguous pixels having different values (not equal to 0) are considered as a patch. The 4 pixel connection is considered for retrieving patches. The output is a raster where each pixel value represents the pixel count of the patch thereof.
Typical usage example:
>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> # start the process
>>> label = rs.raster_label(raster_path='file1.tif',
... output_path='output.tif')
- remotior_sensus.tools.raster_label.raster_label(raster_path: str, output_path: None | str = None, overwrite: bool | None = False, 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 label.
This tool allows for the label of raster pixels based on contiguous patches. Please note that the argument n_processes is currently ignored, and only 1 process is used for performance reasons.
- Parameters:
raster_path – path of raster used as input.
output_path – string of output path.
overwrite – if True, output overwrites existing files.
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
- Object
Examples
- Perform the raster label
>>> # import Remotior Sensus and start the session >>> import remotior_sensus >>> rs = remotior_sensus.Session() >>> # start the process >>> label = rs.raster_label(raster_path='file1.tif',output_path='output.tif')