Skip to content

Commit

Permalink
Support collection "cube:dimensions" merging
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Feb 4, 2022
1 parent 9bcbbfe commit 596eb0d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/openeo_aggregator/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def _merge_collection_metadata(self, by_backend: Dict[str, dict]) -> dict:
},
}
result["links"] = list(getter.union("links"))
# TODO cube_dimensions = getter.get("cube:dimensions") ...
# TODO: combine cube:dimensions smarter?
cube_dimensions = getter.first("cube:dimensions")
if cube_dimensions:
result["cube:dimensions"] = cube_dimensions
# TODO merge existing summaries?
result["summaries"] = {
# TODO: use a more robust/user friendly backend pointer than backend id (which is internal implementation detail)
Expand Down
12 changes: 12 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ def test_get_all_metadata_common_collections_merging(
"spatial": {"bbox": [[-10, 20, 30, 50]]},
"temporal": {"interval": [["2011-01-01T00:00:00Z", "2019-01-01T00:00:00Z"]]}
},
"cube:dimensions": {
"bands": {"type": "bands", "values": ["B01", "B02"]},
"x": {"type": "spatial", "axis": "x"}
},
"links": [
{"rel": "license", "href": "https://spdx.org/licenses/MIT.html"},
],
Expand All @@ -209,6 +213,10 @@ def test_get_all_metadata_common_collections_merging(
"spatial": {"bbox": [[-20, -20, 40, 40]]},
"temporal": {"interval": [["2012-02-02T00:00:00Z", "2019-01-01T00:00:00Z"]]}
},
"cube:dimensions": {
"bands": {"type": "bands", "values": ["B01", "B02"]},
"y": {"type": "spatial", "axis": "y"}
},
"links": [
{"rel": "license", "href": "https://spdx.org/licenses/Apache-1.0.html"},
],
Expand All @@ -227,6 +235,10 @@ def test_get_all_metadata_common_collections_merging(
"spatial": {"bbox": [[-10, 20, 30, 50], [-20, -20, 40, 40]]},
"temporal": {"interval": [["2011-01-01T00:00:00Z", "2019-01-01T00:00:00Z"],
["2012-02-02T00:00:00Z", "2019-01-01T00:00:00Z"]]}},
"cube:dimensions": {
"bands": {"type": "bands", "values": ["B01", "B02"]},
"x": {"type": "spatial", "axis": "x"}
},
"license": "various",
"providers": [{"name": "ESA", "roles": ["producer"]}, {"name": "ESA", "roles": ["licensor"]}],
"summaries": {"provider:backend": ["b1", "b2"]},
Expand Down

0 comments on commit 596eb0d

Please sign in to comment.