diff --git a/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/benchmark_scenarios/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/benchmark_scenarios/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json new file mode 100644 index 00000000..90b5e9d1 --- /dev/null +++ b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/benchmark_scenarios/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json @@ -0,0 +1,24 @@ +[ + { + "id": "ramona_benin", + "type": "openeo", + "description": "extract for Benin", + "backend": "openeo.dataspace.copernicus.eu", + "process_graph": { + "RAMONA-herbaceous_rangeland_biomass-country-mosaick": { + "process_id": "RAMONA-herbaceous_rangeland_biomass-country-mosaick", + "arguments": { + "year": "2022", + "month": "06", + "country": "benin" + }, + "result": true, + "namespace": "https://raw.githubusercontent.com/ESA-APEx/apex_algorithms/8efbe040499e0108a6ed7fce5ca92a3f08115a7f/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json" + } + }, + "reference_data": { + "job-results.json": "https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-15066001243!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/job-results.json", + "ramona_hrb.tif": "https://s3.waw3-1.cloudferro.com/apex-benchmarks/gh-15066001243!tests_test_benchmarks.py__test_run_benchmark_max_ndvi_!actual/openEO.tif" + } + } +] diff --git a/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json new file mode 100644 index 00000000..dc230ee4 --- /dev/null +++ b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json @@ -0,0 +1,244 @@ +{ + "process_graph": { + "textconcat1": { + "process_id": "text_concat", + "arguments": { + "data": [ + { + "from_parameter": "year" + }, + "-", + { + "from_parameter": "month" + }, + "-01T00:00:00Z" + ] + } + }, + "dateshift1": { + "process_id": "date_shift", + "arguments": { + "date": { + "from_node": "textconcat1" + }, + "unit": "day", + "value": 1 + } + }, + "loadstac1": { + "process_id": "load_stac", + "arguments": { + "temporal_extent": [ + { + "from_node": "textconcat1" + }, + { + "from_node": "dateshift1" + } + ], + "url": "https://stac.openeo.vito.be/collections/RAMONA_HERBACEOUS_BIOMASS" + } + }, + "textconcat2": { + "process_id": "text_concat", + "arguments": { + "data": [ + "https://raw.githubusercontent.com/georgique/world-geojson/refs/heads/develop/countries/", + { + "from_parameter": "country" + }, + ".json" + ] + } + }, + "loadurl1": { + "process_id": "load_url", + "arguments": { + "format": "GeoJSON", + "url": { + "from_node": "textconcat2" + } + } + }, + "filterspatial1": { + "process_id": "filter_spatial", + "arguments": { + "data": { + "from_node": "loadstac1" + }, + "geometries": { + "from_node": "loadurl1" + } + } + }, + "apply1": { + "process_id": "apply", + "arguments": { + "data": { + "from_node": "filterspatial1" + }, + "process": { + "process_graph": { + "linearscalerange1": { + "process_id": "linear_scale_range", + "arguments": { + "inputMax": 31000, + "inputMin": -10, + "outputMax": 31000, + "outputMin": -10, + "x": { + "from_parameter": "x" + } + }, + "result": true + } + } + } + } + }, + "dropdimension1": { + "process_id": "drop_dimension", + "arguments": { + "data": { + "from_node": "apply1" + }, + "name": "t" + } + }, + "saveresult1": { + "process_id": "save_result", + "arguments": { + "data": { + "from_node": "dropdimension1" + }, + "format": "GTiff", + "options": { + "filename_prefix": "ramona_hrb", + "overviews": "AUTO", + "tile_size": 512, + "bands_metadata": { + "biomass": { + "SCALE": 0.01, + "Unit": "g DW per m2 per month" + } + } + } + }, + "result": true + } + }, + "id": "RAMONA-herbaceous_rangeland_biomass-country-mosaick", + "description": "# RAMONA - Herbaceous Rangeland Biomass (HRB) - Country Level Mosaick\n\nFor a selected African country, year and month, the process returns a mosaic of the monthly HRB products as a single GeoTIFF.\n\nThis is an example output for Benin:\n\n![Benin](https://github.com/ESA-APEx/apex_algorithms/blob/503edd5ef736b740bccb52f946530b33b85f9ee9/algorithm_catalog/dhi/ramona_biomass_extract/openeo_udp/benin_extract.png)\n\n## Methodology\n\nMonthly HRB input files are mosaicked and exported as a GeoTIFF. The RAMONA HRB products have been precomputed. The products were generated for the target year 2022 and specifically from Aug-2021 to January-2023. \n\nMore information can be found at [https://www.ramona.earth/](https://www.ramona.earth/)\n\n## Performance\n\nThe table below lists cost and timings of test runs. You may see (small) deviations from this\nin your own runs.\n\n| Country | Wall time | Credit cost |\n|----------|-------------|-------------|\n| Benin | 3.5 minutes | 6 |\n| Cameroon | 9 minutes | 26 |\n| Ethiopia | 20 minutes | 64 |\n", + "default_job_options": { + "driver-memory": "15G", + "executor-memory": "6G", + "python-memory": "50m", + "executor-memoryOverhead": "1500m", + "driver-memoryOverhead": "5G" + }, + "parameters": [ + { + "name": "country", + "description": "Country for which data is to be extracted.", + "schema": { + "type": "string", + "enum": [ + "algeria", + "angola", + "benin", + "botswana", + "burkina_faso", + "burundi", + "cameroon", + "cape_verde", + "central_african_republic", + "chad", + "comoros", + "congo", + "democratic_congo", + "djibouti", + "egypt", + "equatorial_guinea", + "eritrea", + "eswatini", + "ethiopia", + "gabon", + "gambia", + "ghana", + "guinea", + "guinea_bissau", + "ivory_coast", + "kenya", + "lesotho", + "liberia", + "libya", + "madagascar", + "malawi", + "mali", + "mauritania", + "mauritius", + "morocco", + "mozambique", + "namibia", + "niger", + "nigeria", + "rwanda", + "sao_tome_and_principe", + "senegal", + "seychelles", + "sierra_leone", + "somalia", + "south_africa", + "south_sudan", + "sudan", + "tanzania", + "togo", + "tunisia", + "uganda", + "western_sahara", + "zambia", + "zimbabwe" + ] + }, + "default": "benin", + "optional": true + }, + { + "name": "year", + "description": "year", + "schema": { + "type": "string", + "enum": [ + "2021", + "2022", + "2023" + ] + }, + "default": "2021", + "optional": true + }, + { + "name": "month", + "description": "Data is available between august 2021 and januari 2023.", + "schema": { + "type": "string", + "enum": [ + "01", + "02", + "03", + "04", + "05", + "06", + "07", + "08", + "09", + "10", + "11", + "12" + ] + }, + "default": "10", + "optional": true + } + ] +} \ No newline at end of file diff --git a/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/README.md b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/README.md new file mode 100644 index 00000000..22b56089 --- /dev/null +++ b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/README.md @@ -0,0 +1,24 @@ +# RAMONA - Herbaceous Rangeland Biomass (HRB) - Country Level Mosaick + +For a selected African country, year and month, the process returns a mosaic of the monthly HRB products as a single GeoTIFF. + +This is an example output for Benin: + +![Benin](https://github.com/ESA-APEx/apex_algorithms/blob/503edd5ef736b740bccb52f946530b33b85f9ee9/algorithm_catalog/dhi/ramona_biomass_extract/openeo_udp/benin_extract.png) + +## Methodology + +Monthly HRB input files are mosaicked and exported as a GeoTIFF. The RAMONA HRB products have been precomputed. The products were generated for the target year 2022 and specifically from Aug-2021 to January-2023. + +More information can be found at [https://www.ramona.earth/](https://www.ramona.earth/) + +## Performance + +The table below lists cost and timings of test runs. You may see (small) deviations from this +in your own runs. + +| Country | Wall time | Credit cost | +|----------|-------------|-------------| +| Benin | 3.5 minutes | 6 | +| Cameroon | 9 minutes | 26 | +| Ethiopia | 20 minutes | 64 | diff --git a/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/benin_extract.png b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/benin_extract.png new file mode 100644 index 00000000..23a33c0e Binary files /dev/null and b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/benin_extract.png differ diff --git a/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/generate.py b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/generate.py new file mode 100644 index 00000000..75a95ad9 --- /dev/null +++ b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/generate.py @@ -0,0 +1,137 @@ +import json +from pathlib import Path + +import openeo +from docutils.nodes import description +from openeo.api.process import Parameter +from openeo.processes import text_concat +from openeo.rest.udp import build_process_dict + + +def generate(): + connection = openeo.connect("openeofed.dataspace.copernicus.eu").authenticate_oidc() + + african_countries = [ + "algeria", + "angola", + "benin", + "botswana", + "burkina_faso", + "burundi", + "cameroon", + "cape_verde", + "central_african_republic", + "chad", + "comoros", + "congo", + "democratic_congo", + "djibouti", + "egypt", + "equatorial_guinea", + "eritrea", + "eswatini", + "ethiopia", + "gabon", + "gambia", + "ghana", + "guinea", + "guinea_bissau", + "ivory_coast", + "kenya", + "lesotho", + "liberia", + "libya", + "madagascar", + "malawi", + "mali", + "mauritania", + "mauritius", + "morocco", + "mozambique", + "namibia", + "niger", + "nigeria", + "rwanda", + "sao_tome_and_principe", + "senegal", + "seychelles", + "sierra_leone", + "somalia", + "south_africa", + "south_sudan", + "sudan", + "tanzania", + "togo", + "tunisia", + "uganda", + "western_sahara", + "zambia", + "zimbabwe" + ] + + country_name = Parameter.string( + name="country", + description="Country for which data is to be extracted.", + values=african_countries, + default= "benin" + ) + + #date_param = Parameter.date_time("date",description="A date between 2021-08-01 and 2023-01-31.", default="2021-08-01T00:00:00Z") + from openeo.processes import text_concat, date_shift + + year_param = Parameter.string("year", default="2021", values=["2021", "2022", "2023"]) + month_param = Parameter.string("month",description="Data is available between august 2021 and januari 2023.", default="10", values=["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]) + + date_param = text_concat([year_param, "-", month_param, "-01T00:00:00Z"]) + + + format_opts = { + "filename_prefix": "ramona_hrb", + "overviews": "AUTO", + "tile_size": 512, + "bands_metadata" : { + "biomass" : { + "SCALE": 0.01, + "Unit": "g DW per m2 per month" + } + } + } + + cube = (connection.load_stac("https://stac.openeo.vito.be/collections/RAMONA_HERBACEOUS_BIOMASS", + temporal_extent=[date_param, date_shift(date_param, 1, "day")]) + .filter_spatial(connection.load_url(text_concat(["https://raw.githubusercontent.com/georgique/world-geojson/refs/heads/develop/countries/", country_name, ".json"]), + format="GeoJSON")).linear_scale_range(-10,31000,-10,31000).drop_dimension("t").save_result(format="GTiff", options= format_opts )) + + udp = build_process_dict(process_graph=cube, process_id="RAMONA-herbaceous_rangeland_biomass-country-mosaick", + description=(Path(__file__).parent / "README.md").read_text(), + parameters=[country_name, year_param, month_param], + default_job_options={"driver-memory": "15G", "executor-memory": "6G", "python-memory": "50m", "executor-memoryOverhead": "1500m", "driver-memoryOverhead": "5G"} + ) + connection.save_user_defined_process(process_graph=cube, user_defined_process_id="RAMONA_herbaceous_rangeland_biomass_country_mosaick", + description=(Path(__file__).parent / "README.md").read_text(), + parameters=[country_name, year_param, month_param]) + return udp + + +if __name__ == "__main__": + + with open("RAMONA-herbaceous_rangeland_biomass-country-mosaick.json", "w") as f: + json.dump(generate(), f, indent=2) + +import requests + +def get_countries(): + url = "https://api.github.com/repos/georgique/world-geojson/contents/countries" + response = requests.get(url) + if response.status_code == 200: + files = response.json() + african_countries = [file['name'] for file in files if file['name'].endswith('.json')] + return african_countries + else: + raise Exception(f"Failed to fetch data: {response.status_code}") + +# if __name__ == "__main__": +# african_countries = get_countries() +# print("Countries GeoJSON files:") +# for country in african_countries: +# print(country) \ No newline at end of file diff --git a/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/records/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/records/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json new file mode 100644 index 00000000..5cceb43d --- /dev/null +++ b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/records/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json @@ -0,0 +1,116 @@ +{ + "id": "RAMONA-herbaceous_rangeland_biomass-country-mosaick", + "type": "Feature", + "conformsTo": [ + "http://www.opengis.net/spec/ogcapi-records-1/1.0/req/record-core", + "https://apex.esa.int/core/openeo-udp" + ], + "geometry": null, + "properties": { + "created": "2025-03-12T00:00:00Z", + "updated": "2025-03-12T00:00:00Z", + "type": "service", + "title": "RAMONA Herbaceous Rangeland Biomass (HRB) country level mosaics for Africa (2022).", + "description": "Generates country-level mosaicks from the (pre-computed) RAMONA monthly HRB products. The original HRB products follow the Sentinel-2 tiling grid in UTM projection. The resulting mosaic is projected in WGS84 / EPSG 4326.", + "cost_estimate": 0.05, + "cost_unit": "platform credits per km\u00b2", + "keywords": [ + "Vegetation" + ], + "language": { + "code": "en-US", + "name": "English (United States)" + }, + "languages": [ + { + "code": "en-US", + "name": "English (United States)" + } + ], + "contacts": [ + { + "name": "The RAMONA project consortium: University of Aarhus, DHI, Lund University and GeoVille.", + "position": "Project consortium", + "organization": "University of Aarhus, DHI, Lund University and GeoVille.", + "links": [ + { + "href": "https://www.ramona.earth/", + "title": "Ramona Website", + "rel": "about", + "type": "text/html" + }, + { + "href": "https://github.com/alkiskk", + "title": "GitHub", + "rel": "about", + "type": "text/html" + } + ], + "contactInstructions": "Contact via DHI", + "roles": [ + "principal investigator" + ] + } + ], + "themes": [ + { + "concepts": [ + { + "id": "Sentinel-2 MSI", + "url": "https://gcmd.earthdata.nasa.gov/kms/concept/fc57a9a0-a287-4bcf-a517-20811b55596b?format=json" + }, + { + "id": "BIOMASS", + "url": "https://cmr.earthdata.nasa.gov/kms/concept/686feba9-87ba-474c-8280-7f67565cfb2f?format=json" + } + ], + "scheme": "https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/sciencekeywords" + } + ], + "formats": [ + { + "name": "GeoJSON" + } + ], + "license": "proprietary" + }, + "linkTemplates": [], + "links": [ + { + "rel": "application", + "type": "application/vnd.openeo+json;type=process", + "title": "openEO Process Definition", + "href": "https://raw.githubusercontent.com/ESA-APEx/apex_algorithms/8efbe040499e0108a6ed7fce5ca92a3f08115a7f/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/openeo_udp/RAMONA-herbaceous_rangeland_biomass-country-mosaick.json" + }, + { + "rel": "service", + "type": "application/json", + "title": "CDSE openEO", + "href": "https://openeo.dataspace.copernicus.eu" + }, + { + "rel": "webapp", + "type": "text/html", + "title": "OpenEO Web Editor", + "href": "https://openeo.dataspace.copernicus.eu/?wizard=UDP&wizard%7Eprocess=RAMONA-herbaceous_rangeland_biomass-country-mosaick&wizard%7EprocessUrl=https%3A%2F%2Fraw.githubusercontent.com%2FESA-APEx%2Fapex_algorithms%2F8efbe040499e0108a6ed7fce5ca92a3f08115a7f%2Falgorithm_catalog%2Fdhi%2FRAMONA-herbaceous_rangeland_biomass-country-mosaick%2Fopeneo_udp%2FRAMONA-herbaceous_rangeland_biomass-country-mosaick.json" + }, + { + "rel": "about", + "type": "text/html", + "title": "ESA Project website", + "href": "https://www.ramona.earth/" + }, + { + "rel": "about", + "type": "text/html", + "title": "Scientific publication", + "href": "https://doi.org/10.3390/rs16111833" + }, + { + "rel": "thumbnail", + "type": "image/png", + "title": "Thumbnail image", + "href": "https://raw.githubusercontent.com/ESA-APEx/apex_algorithms/8efbe040499e0108a6ed7fce5ca92a3f08115a7f/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/records/thumbnail.png" + } + ] +} diff --git a/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/records/thumbnail.png b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/records/thumbnail.png new file mode 100644 index 00000000..32618b4a Binary files /dev/null and b/algorithm_catalog/dhi/RAMONA-herbaceous_rangeland_biomass-country-mosaick/records/thumbnail.png differ diff --git a/qa/tools/apex_algorithm_qa_tools/scenarios.py b/qa/tools/apex_algorithm_qa_tools/scenarios.py index b550d182..9f3af838 100644 --- a/qa/tools/apex_algorithm_qa_tools/scenarios.py +++ b/qa/tools/apex_algorithm_qa_tools/scenarios.py @@ -106,7 +106,7 @@ def lint_benchmark_scenario(scenario: BenchmarkScenario): assert isinstance(scenario.process_graph, dict) for node_id, node in scenario.process_graph.items(): assert isinstance(node, dict) - assert re.match(r"^[a-z0-9_-]+$", node["process_id"]) + assert re.match(r"^[a-zA-Z0-9_-]+$", node["process_id"]) assert "arguments" in node assert isinstance(node["arguments"], dict)