diff --git a/src/openeo_grass_gis_driver/actinia_processing/base.py b/src/openeo_grass_gis_driver/actinia_processing/base.py index 0b279b54..842ede15 100644 --- a/src/openeo_grass_gis_driver/actinia_processing/base.py +++ b/src/openeo_grass_gis_driver/actinia_processing/base.py @@ -385,6 +385,20 @@ def openeo_to_actinia(node: Node) -> Tuple[list, list]: node.get_parent_by_name( parent_name=key).output_objects)[0] data_object = value + # check schema subtype of parameter and compare with + # datatype of data_object + if ao["schema"]["subtype"] == "cell" and \ + data_object.datatype != GrassDataType.RASTER: + raise Exception( + "Wrong input data type, expecting 'cell'") + elif ao["schema"]["subtype"] == "strds" and \ + data_object.datatype != GrassDataType.STRDS: + raise Exception( + "Wrong input data type, expecting 'strds'") + elif ao["schema"]["subtype"] == "vector" and \ + data_object.datatype != GrassDataType.VECTOR: + raise Exception( + "Wrong input data type, expecting 'vector'") elif ao["schema"]["type"] == "boolean": # flag if node.arguments[key] is True: diff --git a/src/openeo_grass_gis_driver/processes_process_id.py b/src/openeo_grass_gis_driver/processes_process_id.py index 6e820a7d..bab089d2 100644 --- a/src/openeo_grass_gis_driver/processes_process_id.py +++ b/src/openeo_grass_gis_driver/processes_process_id.py @@ -31,8 +31,22 @@ def get(self, process_id): iface = ActiniaInterface() module = ACTINIA_OPENEO_PROCESS_DESCRIPTION_DICT[process_id] module_name = module["id"] + # note that this will list all outputs of a module, not the + # selected output of the pseudo module status_code, module = iface.list_module(module_name) if status_code == 200: + if "parameters" in module: + for item in module["parameters"]: + if "subtype" in item["schema"]: + if item["schema"]["subtype"] in ("cell", "strds"): + item["schema"]["type"] = "object" + item["schema"]["subtype"] = "raster-cube" + if "returns" in module: + for item in module["returns"]: + if "subtype" in item["schema"]: + if item["schema"]["subtype"] in ("cell", "strds"): + item["schema"]["type"] = "object" + item["schema"]["subtype"] = "raster-cube" return make_response(jsonify(module), 200) return make_response( diff --git a/src/openeo_grass_gis_driver/register_actinia_processes.py b/src/openeo_grass_gis_driver/register_actinia_processes.py index 16504771..d6cbd38d 100644 --- a/src/openeo_grass_gis_driver/register_actinia_processes.py +++ b/src/openeo_grass_gis_driver/register_actinia_processes.py @@ -28,6 +28,18 @@ def register_processes(): for module in modules: # convert grass module names to openeo process names process = module["id"].replace('.', '_') + if "parameters" in module: + for item in module["parameters"]: + if "subtype" in item["schema"]: + if item["schema"]["subtype"] in ("cell", "strds"): + item["schema"]["type"] = "object" + item["schema"]["subtype"] = "raster-cube" + if "returns" in module: + for item in module["returns"]: + if "subtype" in item["schema"]: + if item["schema"]["subtype"] in ("cell", "strds"): + item["schema"]["type"] = "object" + item["schema"]["subtype"] = "raster-cube" ACTINIA_PROCESS_DESCRIPTION_DICT[process] = module # create "pseudo" modules which comply to openeo @@ -37,6 +49,8 @@ def register_processes(): # create "pseudo" module for every output: for returns in module['returns']: pm = dict(module) + # TODO: do not change the id, otherwise it breaks + # iface.list_module(pm['id']) pm['id'] = "%s_%s" % ( module['id'], returns['name']) pm['returns'] = returns diff --git a/src/openeo_grass_gis_driver/utils/process_graph_examples_v10.py b/src/openeo_grass_gis_driver/utils/process_graph_examples_v10.py index 8a32ca47..f98b1e35 100644 --- a/src/openeo_grass_gis_driver/utils/process_graph_examples_v10.py +++ b/src/openeo_grass_gis_driver/utils/process_graph_examples_v10.py @@ -786,7 +786,7 @@ } }, "compute_slope": { - "process_id": "r_slope_aspect", + "process_id": "r_slope_aspect_slope", "arguments": { "elevation": {"from_node": "get_elevation_data"}, "e": True,