remotior_sensus.tools.mosaic module
Band mosaic.
This tool performs the mosaic of single bands, or multiple BandSets. Corresponding bands in two or more BandSet are merged into a single raster for each band, covering the extent of input bands. For instance, this is useful to mosaic several multiband images togheter, obtaining a multispectral mosaic of bands (e.g., the first band of the mosaic corresponds to all the first bands of input images).
Typical usage example:
>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> # start the process
>>> file_list = ['file1_b1.tif', 'file2_b1.tif']
>>> mosaic_bands = rs.mosaic(input_bands=file_list,output_path='output_directory')
- remotior_sensus.tools.mosaic.mosaic(input_bands: list | int | BandSet, output_path: None | str = None, overwrite: bool | None = False, prefix: str | None = '', nodata_value: None | int = None, n_processes: None | int = None, available_ram: None | int = None, virtual_output: bool | None = False, output_name: None | str = None, reference_raster_crs: None | str = None, bandset_catalog: BandSetCatalog | None = None, progress_message: bool | None = True) OutputManager
Mosaic bands.
This tool performs the mosaic of corresponding bands from multiple BandSets. A new raster is created for each band, named as output_name or first band name, and followed by band number.
- Parameters:
input_bands – list of paths of input rasters, or number of BandSet, or BandSet object.
output_path – string of output path directory.
overwrite – if True, output overwrites existing files.
prefix – optional string for output name prefix.
nodata_value – value to be considered as nodata.
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.
output_name – string used as general name for all output bands.
reference_raster_crs – path to a raster to be used as crs reference; if None, the first band is used as reference.
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
- Object
Examples
- Perform the mosaic of three BandSets
>>> # 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'] >>> file_list_3 = ['file3_b1.tif', 'file3_b2.tif', 'file3_b3.tif'] >>> catalog.create_bandset(file_list_1, bandset_number=1) >>> catalog.create_bandset(file_list_2, bandset_number=2) >>> catalog.create_bandset(file_list_3, bandset_number=3) >>> # start the process >>> mosaic_bands = rs.mosaic(input_bands=[1, 2, 3], ... output_path='output_directory', bandset_catalog=catalog)