Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stactools to v0.2.1 #1

Merged
merged 2 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ package_dir =
= src
packages = find_namespace:
install_requires =
stactools[s3] @ git+https://github.com/stac-utils/stactools@c278e73476d8def30a8d25b23aac9c4110be681c
stactools[s3] == 0.2.1

[options.packages.find]
where = src
10 changes: 5 additions & 5 deletions src/stactools/cop_dem/constants.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import datetime

from pystac import Provider, Link
from pystac import Provider, Link, ProviderRole

COP_DEM_PLATFORM = "TanDEM-X"
COP_DEM_EPSG = 4326
COP_DEM_PROVIDERS = [
Provider("European Space Agency",
roles=["licensor"],
Provider("European Space Agency",
roles=[ProviderRole.LICENSOR],
url=("https://spacedata.copernicus.eu/documents/20126/0/"
"CSCDA_ESA_Mission-specific+Annex.pdf")),
Provider("Sinergise",
roles=["producer", "processor"],
roles=[ProviderRole.PRODUCER, ProviderRole.PROCESSOR],
url="https://registry.opendata.aws/copernicus-dem/"),
Provider("OpenTopography",
roles=["host"],
roles=[ProviderRole.HOST],
url=("https://portal.opentopography.org/"
"datasetMetadata?otCollectionID=OT.032021.4326.1"))
]
Expand Down
2 changes: 1 addition & 1 deletion src/stactools/cop_dem/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create_item(href: str,
bbox=bbox,
datetime=OPENTOPOGRAPHY_DATETIME,
properties={},
stac_extensions={})
stac_extensions=[])

p = re.compile(r'Copernicus_DSM_COG_(\d\d)_(.*)_DEM.tif')
m = p.match(os.path.basename(href))
Expand Down
31 changes: 19 additions & 12 deletions tests/test_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from pystac import Provider, MediaType
from pystac.extensions.projection import ProjectionExtension
from pystac.provider import ProviderRole

from stactools.cop_dem import stac

Expand Down Expand Up @@ -31,19 +32,22 @@ def test_create_glo30_item(self):
common_metadata = item.common_metadata
self.assertEqual(common_metadata.platform, "TanDEM-X")
self.assertEqual(common_metadata.gsd, 30)
self.assertEqual(common_metadata.providers, [
Provider("European Space Agency",
roles=["licensor"],
expected_providers = [
Provider("European Space Agency",
roles=[ProviderRole.LICENSOR],
url=("https://spacedata.copernicus.eu/documents/20126/0/"
"CSCDA_ESA_Mission-specific+Annex.pdf")),
Provider("Sinergise",
roles=["producer", "processor"],
roles=[ProviderRole.PRODUCER, ProviderRole.PROCESSOR],
url="https://registry.opendata.aws/copernicus-dem/"),
Provider("OpenTopography",
roles=["host"],
roles=[ProviderRole.HOST],
url=("https://portal.opentopography.org/"
"datasetMetadata?otCollectionID=OT.032021.4326.1"))
])
]
for expected, actual in zip(expected_providers,
common_metadata.providers):
self.assertDictEqual(expected.to_dict(), actual.to_dict())
self.assertEqual(common_metadata.license, "proprietary")

projection = ProjectionExtension.ext(item)
Expand Down Expand Up @@ -87,19 +91,22 @@ def test_create_glo90_item(self):
common_metadata = item.common_metadata
self.assertEqual(common_metadata.platform, "TanDEM-X")
self.assertEqual(common_metadata.gsd, 90)
self.assertEqual(common_metadata.providers, [
Provider("European Space Agency",
roles=["licensor"],
expected_providers = [
Provider("European Space Agency",
roles=[ProviderRole.LICENSOR],
url=("https://spacedata.copernicus.eu/documents/20126/0/"
"CSCDA_ESA_Mission-specific+Annex.pdf")),
Provider("Sinergise",
roles=["producer", "processor"],
roles=[ProviderRole.PRODUCER, ProviderRole.PROCESSOR],
url="https://registry.opendata.aws/copernicus-dem/"),
Provider("OpenTopography",
roles=["host"],
roles=[ProviderRole.HOST],
url=("https://portal.opentopography.org/"
"datasetMetadata?otCollectionID=OT.032021.4326.1"))
])
]
for expected, actual in zip(expected_providers,
common_metadata.providers):
self.assertDictEqual(expected.to_dict(), actual.to_dict())
self.assertEqual(common_metadata.license, "proprietary")

projection = ProjectionExtension.ext(item)
Expand Down