Skip to content

Commit

Permalink
feat: add description field for assets in collection TDE-1294 (#1132)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
schmidtnz authored Oct 17, 2024
1 parent d5b50d4 commit 4d6c030
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/stac/imagery/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions scripts/stac/imagery/tests/collection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 4d6c030

Please sign in to comment.