eodal.core.algorithms module

Collection of algorithms working with EOdal core objects such as Bands, RasterCollections, Scenes and SceneCollections.

Copyright (C) 2022 Lukas Valentin Graf

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

eodal.core.algorithms.merge_datasets(datasets: List[Path], out_file: Path | None = None, target_crs: int | CRS | None = None, vector_features: Path | GeoDataFrame | None = None, scene_properties: SceneProperties | None = None, band_options: Dict[str, Any] | None = None, sensor: str | None = None, **kwargs) None | RasterCollection[source]

Merges a list of raster datasets using the rasterio.merge module.

The function can handle datasets in different coordinate systems by resampling the data into a common spatial reference system either provided in the function call or infered from the first dataset in the list.

Attention

All datasets must have the same number of bands and data type!

Parameters:
  • datasets – list of datasets (as path-like objects or opened raster datasets) to merge into a single raster

  • out_file – name of the resulting raster dataset (optional). If None (default) returns a new RasterCollection instance otherwise writes the data to disk as new raster dataset.

  • target_crs – optional target spatial coordinate reference system in which the output product shall be generated. Must be passed as integer EPSG code or CRS instance.

  • vector_features – optional vector features to clip the merged dataset to (full bounding box).

  • scene_properties – optional scene properties to set to the resulting merged dataset

  • band_options – optional sensor-specific band options to pass to the sensor’s RasterCollection constructor

  • sensor – if the data is from a sensor explicitly supported by eodal such as Sentinel-2 the raster data is loaded into a sensor-specific collection

  • kwargs – kwargs to pass to rasterio.warp.reproject

Returns:

depending on the kwargs passed either None (if output is written to file directly) or a RasterCollection instance if the operation takes place in memory