From 4d6c030d9da64f04d647ad116c6f478bbf2437f0 Mon Sep 17 00:00:00 2001 From: trs Date: Fri, 18 Oct 2024 09:13:47 +1300 Subject: [PATCH] feat: add description field for assets in collection TDE-1294 (#1132) ### Motivation To show a data consumer more information about what kind of data the linked `capture-area.geojson` and `capture-dates.geojson` files hold without having to view those. ### Modifications Added a `description` field to the `capture_area` and `capture_dates` Asset objects created in `collection.py` and associated tests. ### Verification Unit tests updated to include the new data fields. pre-commit checks to unify formatting. --- scripts/stac/imagery/collection.py | 5 +++++ scripts/stac/imagery/tests/collection_test.py | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/scripts/stac/imagery/collection.py b/scripts/stac/imagery/collection.py index eb772a474..934b429d4 100644 --- a/scripts/stac/imagery/collection.py +++ b/scripts/stac/imagery/collection.py @@ -110,6 +110,8 @@ def add_capture_area(self, polygons: list[BaseGeometry], target: str, artifact_t capture_area = { "href": f"./{CAPTURE_AREA_FILE_NAME}", "title": "Capture area", + "description": "Boundary of the total capture area for this collection. Excludes nodata areas in the source " + "data. Geometries are simplified.", "type": ContentType.GEOJSON, "roles": ["metadata"], "file:checksum": file_checksum, @@ -145,6 +147,9 @@ def add_capture_dates(self, source_directory: str) -> None: capture_dates = { "href": f"./{CAPTURE_DATES_FILE_NAME}", "title": "Capture dates", + "description": "Boundaries of individual surveys or flight runs that make up the overall collection with " + "the data collection dates, data source links and other associated metadata, such as producers and licensors, " + "where available. Excludes nodata areas in the source data. Geometries are simplified.", "type": ContentType.GEOJSON, "roles": ["metadata"], "file:checksum": file_checksum, diff --git a/scripts/stac/imagery/tests/collection_test.py b/scripts/stac/imagery/tests/collection_test.py index b6915c75d..1df578c31 100644 --- a/scripts/stac/imagery/tests/collection_test.py +++ b/scripts/stac/imagery/tests/collection_test.py @@ -296,6 +296,12 @@ def test_capture_area_added(fake_collection_metadata: CollectionMetadata, subtes with subtests.test(): assert collection.stac["assets"]["capture_area"]["title"] == "Capture area" + with subtests.test(): + assert ( + collection.stac["assets"]["capture_area"]["description"] == "Boundary of the total capture area for " + "this collection. Excludes nodata areas in the source data. Geometries are simplified." + ) + with subtests.test(): assert collection.stac["assets"]["capture_area"]["type"] == "application/geo+json" @@ -342,6 +348,9 @@ def test_capture_dates_added(fake_collection_metadata: CollectionMetadata) -> No assert collection.stac["assets"]["capture_dates"] == { "href": "./capture-dates.geojson", "title": "Capture dates", + "description": "Boundaries of individual surveys or flight runs that make up the overall collection with the " + "data collection dates, data source links and other associated metadata, such as producers and licensors, " + "where available. Excludes nodata areas in the source data. Geometries are simplified.", "type": ContentType.GEOJSON, "roles": ["metadata"], "file:checksum": "1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",