Skip to content

Commit

Permalink
Use datacube extension v2.1.0 for asset support #16, enable validatio…
Browse files Browse the repository at this point in the history
…n again in tests #7
  • Loading branch information
m-mohr committed Jul 26, 2022
1 parent f96294f commit f434fa5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/stactools/goes_glm/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
# Extensions
GOES_EXTENSION = "https://stac-extensions.github.io/goes/v1.0.0/schema.json"
PROCESSING_EXTENSION = "https://stac-extensions.github.io/processing/v1.1.0/schema.json"
DATACUBE_EXTENSION = "https://stac-extensions.github.io/datacube/v2.1.0/schema.json"

# Scientific
DOI = "10.7289/V5KH0KK6"
Expand Down
3 changes: 1 addition & 2 deletions src/stactools/goes_glm/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
Summaries,
TemporalExtent,
)
from pystac.extensions.datacube import DatacubeExtension
from pystac.extensions.item_assets import AssetDefinition, ItemAssetsExtension
from pystac.extensions.projection import ProjectionExtension
from pystac.extensions.scientific import ScientificExtension
Expand Down Expand Up @@ -244,13 +243,13 @@ def create_item(
TableExtension.ext(asset, add_if_missing=True)

if not nonetcdf:
item.stac_extensions.append(constants.DATACUBE_EXTENSION)
asset_dict = netcdf.create_asset(asset_href)
asset_dict["created"] = dataset.date_created
asset_dict["cube:dimensions"] = netcdf.to_cube_dimensions(dataset)
asset_dict["cube:variables"] = netcdf.to_cube_variables(dataset)
asset = Asset.from_dict(asset_dict)
item.add_asset(constants.NETCDF_KEY, asset)
DatacubeExtension.ext(asset, add_if_missing=True)

return item

Expand Down
4 changes: 2 additions & 2 deletions tests/test_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_create_collection(self) -> None:

# Validate
# can't validate yet due to https://github.com/stac-utils/pystac/issues/845
# collection.validate()
collection.validate()

def test_create_item(self) -> None:
# Write tests for each for the creation of STAC Items
Expand All @@ -32,4 +32,4 @@ def test_create_item(self) -> None:

# Validate
# can't validate yet due to https://github.com/stac-utils/pystac/issues/845
# item.validate()
item.validate()

0 comments on commit f434fa5

Please sign in to comment.