From 6b97c9799be8394c5482894c227a2459fa816ecb Mon Sep 17 00:00:00 2001 From: Lubomir Dolezal Date: Fri, 12 Jul 2024 15:08:33 +0200 Subject: [PATCH] add MapProjection info --- src/eodash_catalog/stac_handling.py | 4 ++-- tests/test_generate.py | 9 +++++++++ tests/testing-indicators/test_indicator.yaml | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/eodash_catalog/stac_handling.py b/src/eodash_catalog/stac_handling.py index 58eede8..1ebdfda 100644 --- a/src/eodash_catalog/stac_handling.py +++ b/src/eodash_catalog/stac_handling.py @@ -357,8 +357,6 @@ def add_extra_fields(stac_object: Collection | Catalog | Link, collection_config stac_object.extra_fields["sensor"] = collection_config["Sensor"] if "Agency" in collection_config: stac_object.extra_fields["agency"] = collection_config["Agency"] - if "yAxis" in collection_config: - stac_object.extra_fields["yAxis"] = collection_config["yAxis"] if "EodashIdentifier" in collection_config: stac_object.extra_fields["subcode"] = collection_config["EodashIdentifier"] if "DataSource" in collection_config: @@ -375,6 +373,8 @@ def add_extra_fields(stac_object: Collection | Catalog | Link, collection_config stac_object.extra_fields["insituSources"] = collection_config["DataSource"]["InSitu"] if "Other" in collection_config["DataSource"]: stac_object.extra_fields["otherSources"] = collection_config["DataSource"]["Other"] + if "MapProjection" in collection_config: + stac_object.extra_fields["mapProjection"] = collection_config["MapProjection"] def get_collection_times_from_config(endpoint_config: dict) -> list[str]: diff --git a/tests/test_generate.py b/tests/test_generate.py index abe6a90..e591b31 100644 --- a/tests/test_generate.py +++ b/tests/test_generate.py @@ -94,6 +94,15 @@ def test_indicator_groups_collections(catalog_output_folder): assert [-145.24, -61.13, -135.15, -65.05] in indicator_bbox +def test_indicator_map_projection_added(catalog_output_folder): + collection_name = "test_indicator_grouping_collections" + root_collection_path = os.path.join(catalog_output_folder, collection_name) + with open(os.path.join(root_collection_path, "collection.json")) as fp: + indicator_json = json.load(fp) + # test that collection has map projection defined + assert indicator_json["mapProjection"] == 3035 + + def test_baselayers_and_overlays_added(catalog_output_folder): collection_name = "imperviousness_density_2018" root_collection_path = os.path.join(catalog_output_folder, collection_name) diff --git a/tests/testing-indicators/test_indicator.yaml b/tests/testing-indicators/test_indicator.yaml index 4231f13..2b42bf0 100644 --- a/tests/testing-indicators/test_indicator.yaml +++ b/tests/testing-indicators/test_indicator.yaml @@ -2,6 +2,7 @@ Name: test_indicator_grouping_collections Title: test_indicator_grouping_collections EodashIdentifier: test_indicator_1 Description: 'test_indicator_1_description' +MapProjection: 3035 Collections: - test_tif_demo_1 - test_tif_demo_2