diff --git a/openeo_driver/ProcessGraphDeserializer.py b/openeo_driver/ProcessGraphDeserializer.py index 0f4ec397..4312cab8 100644 --- a/openeo_driver/ProcessGraphDeserializer.py +++ b/openeo_driver/ProcessGraphDeserializer.py @@ -1993,23 +1993,24 @@ def mask_scl_dilation(args: Dict, env: EvalEnv): @process_registry_100.add_function(spec=read_spec("openeo-processes/experimental/to_scl_dilation_mask.json")) @process_registry_2xx.add_function(spec=read_spec("openeo-processes/experimental/to_scl_dilation_mask.json")) -def to_scl_dilation_mask(args: Dict, env: EvalEnv): - cube: DriverDataCube = extract_arg(args, "data") - if not isinstance(cube, DriverDataCube): - raise ProcessParameterInvalidException( - parameter="data", - process="to_scl_dilation_mask", - reason=f"Invalid data type {type(cube)!r} expected raster-cube.", - ) +def to_scl_dilation_mask(args: ProcessArgs, env: EvalEnv): + cube: DriverDataCube = args.get_required("data", expected_type=DriverDataCube) + if hasattr(cube, "to_scl_dilation_mask"): - erosion_kernel_size = args.get("erosion_kernel_size", 0) - mask1_values = args.get("mask1_values", [2, 4, 5, 6, 7]) - mask2_values = args.get("mask2_values", [3, 8, 9, 10, 11]) - kernel1_size = args.get("kernel1_size", 17) - kernel2_size = args.get("kernel2_size", 201) - return cube.to_scl_dilation_mask(erosion_kernel_size, mask1_values, mask2_values, kernel1_size, kernel2_size) + spec = read_spec("openeo-processes/experimental/to_scl_dilation_mask.json") + optionals = { + arg: args.get_optional(arg, default=spec["parameters"][arg]["default"]) + for arg in [ + "erosion_kernel_size", + "mask1_values", + "mask2_values", + "kernel1_size", + "kernel2_size", + ] + } + return cube.to_scl_dilation_mask(**optionals) else: - return cube + raise FeatureUnsupportedException(message="to_scl_dilation_mask is not supported") @process_registry_100.add_function(spec=read_spec("openeo-processes/experimental/mask_l1c.json"))