From 6e7ed913aa5443c4cb6094448095617820387b29 Mon Sep 17 00:00:00 2001 From: Niko Aarnio Date: Mon, 29 Apr 2024 09:56:33 +0300 Subject: [PATCH] cli: add max distance parameter to distance computation and distance to anomaly CLI functions --- eis_toolkit/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eis_toolkit/cli.py b/eis_toolkit/cli.py index 010c8d51..e78ccf7a 100644 --- a/eis_toolkit/cli.py +++ b/eis_toolkit/cli.py @@ -1194,6 +1194,7 @@ def distance_to_anomaly_cli( threshold_criteria: Annotated[ThresholdCriteria, typer.Option(case_sensitive=False)], first_threshold_criteria_value: float = typer.Option(), second_threshold_criteria_value: float = None, + max_distance: float = None, ): """ Calculate distance from each raster cell to nearest anomaly cell. @@ -1216,6 +1217,7 @@ def distance_to_anomaly_cli( anomaly_raster_data=raster.read(1), threshold_criteria_value=threshold_criteria_value, threshold_criteria=get_enum_values(threshold_criteria), + max_distance=max_distance, ) typer.echo("Progress: 75%") @@ -1979,6 +1981,7 @@ def distance_computation_cli( base_raster: INPUT_FILE_OPTION = None, pixel_size: float = None, extent: Tuple[float, float, float, float] = (None, None, None, None), + max_distance: float = None, ): """Calculate distance from raster cell to nearest geometry.""" from eis_toolkit.exceptions import InvalidParameterValueException @@ -2004,7 +2007,7 @@ def distance_computation_cli( with rasterio.open(base_raster) as raster: profile = raster.profile.copy() - out_image = distance_computation(geodataframe=geodataframe, raster_profile=profile) + out_image = distance_computation(geodataframe=geodataframe, raster_profile=profile, max_distance=max_distance) profile["count"] = 1 typer.echo("Progress: 75%")