mapchete_eo.processes package

Submodules

mapchete_eo.processes.config module

class mapchete_eo.processes.config.RGBCompositeConfig(*, red: Tuple[int, int] = (0, 2300), green: Tuple[int, int] = (0, 2300), blue: Tuple[int, int] = (0, 2300), gamma: float = 1.15, saturation: float = 1.3, clahe_flag: bool = True, clahe_clip_limit: float = 3.2, clahe_tile_grid_size: Tuple[int, int] = (32, 32), sigmoidal_flag: bool = False, sigmoidal_contrast: int = 0, sigmoidal_bias: float = 0.0, fuzzy_radius: int | None = 0, sharpen: bool | None = False, smooth: bool | None = False, smooth_config: SmoothConfig = SmoothConfig(radius=1, smooth_more=False), smooth_water: bool | None = False, smooth_water_config: SmoothConfig = SmoothConfig(radius=6, smooth_more=True), smooth_water_ndwi_threshold: float = 0.2, calculations_dtype: str = 'float16')[source]

Bases: BaseModel

blue: Tuple[int, int]
calculations_dtype: str
clahe_clip_limit: float
clahe_flag: bool
clahe_tile_grid_size: Tuple[int, int]
fuzzy_radius: int | None
gamma: float
green: Tuple[int, int]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

static parse(inp: RGBCompositeConfig | Dict) RGBCompositeConfig[source]
red: Tuple[int, int]
saturation: float
sharpen: bool | None
sigmoidal_bias: float
sigmoidal_contrast: int
sigmoidal_flag: bool
smooth: bool | None
smooth_config: SmoothConfig
smooth_water: bool | None
smooth_water_config: SmoothConfig
smooth_water_ndwi_threshold: float
class mapchete_eo.processes.config.SmoothConfig(*, radius: int | None = 1, smooth_more: bool | None = False)[source]

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

static parse(inp: SmoothConfig | dict) SmoothConfig[source]
radius: int | None
smooth_more: bool | None

mapchete_eo.processes.dtype_scale module

mapchete_eo.processes.dtype_scale.execute(mp: MapcheteProcess, inp: RasterInput, bands: list = [1, 2, 3, 4], resampling: str = 'nearest', matching_method: str | None = 'gdal', matching_max_zoom: int = 13, matching_precision: int = 8, fallback_to_higher_zoom: bool = False, out_dtype: str | None = 'uint8', out_nodata: float | None = None, max_source_value: float = 10000.0, max_output_value: float | None = None) MaskedArray[source]

Scale input to different value range.

Inputs:

inp

raster input to be scaled

Parameters:

bandslist

List of band indexes.

tresamplingstr (default: ‘nearest’)

Resampling used when reading from mosaic.

matching_methodstr (‘gdal’ or ‘min’) (default: ‘gdal’)
gdal: Uses GDAL’s standard method. Here, the target resolution is

calculated by averaging the extent’s pixel sizes over both x and y axes. This approach returns a zoom level which may not have the best quality but will speed up reading significantly.

min: Returns the zoom level which matches the minimum resolution of the

extents four corner pixels. This approach returns the zoom level with the best possible quality but with low performance. If the tile extent is outside of the destination pyramid, a TopologicalError will be raised.

matching_max_zoomint (optional, default: None)

If set, it will prevent reading from zoom levels above the maximum.

matching_precisionint (default: 8)

Round resolutions to n digits before comparing.

fallback_to_higher_zoombool (default: False)

In case no data is found at zoom level, try to read data from higher zoom levels. Enabling this setting can lead to many IO requests in areas with no data.

out_dtype: string

Output dtype for the target values, should fit the designated scaling from source, if the output scaled values do not fit, they will be clipped to the output dtype.

out_nodata: float, int

Output Nodata, per default read from output nodata of the mapchete config.

max_source_valuefloat

Upper limit for clipping and scaling (e.g. 10000 for Sentinel-2).

max_output_valuefloat, None

Output value range (e.g. 255 for 8 bit). If None it will be determined by the out_dtype

Output:

ma.ndarray

stretched input bands

mapchete_eo.processes.eo_to_xarray module

mapchete_eo.processes.eo_to_xarray.execute(inp: EODataCube, assets: List[str] | None = None, resampling: Resampling = Resampling.nearest, merge_method: MergeMethod = MergeMethod.average) Dataset[source]

Convert EO Data Cube into xarray.

mapchete_eo.processes.merge_rasters module

class mapchete_eo.processes.merge_rasters.MergeMethod(*values)[source]

Bases: str, Enum

fill = 'fill'
footprint_gradient = 'footprint_gradient'
mapchete_eo.processes.merge_rasters.execute(mp: MapcheteProcess, rasters: List[Tuple[str, RasterInput]], vectors: List[Tuple[str, VectorInput]], gradient_buffer: int = 10, merge_method: MergeMethod = MergeMethod.footprint_gradient) MaskedArray[source]

Merge multiple rasters into one.

mapchete_eo.processes.merge_rasters.fillnodata_merge(rasters: List[MaskedArray]) MaskedArray[source]

Read rasters sequentially and update masked pixels with values of next raster.

mapchete_eo.processes.merge_rasters.gradient_merge(rasters: List[MaskedArray], footprints: List[BaseGeometry], tile: BufferedTile, gradient_buffer: int = 10) MaskedArray[source]

Use footprint geometries to merge rasters using a gradient buffer.

mapchete_eo.processes.merge_rasters.merge_rasters(rasters: List[MaskedArray], tile: BufferedTile, method: MergeMethod = MergeMethod.fill, footprints: List[BaseGeometry] | None = None, gradient_buffer: int = 10) MaskedArray[source]

Module contents