Skip to content

Commit

Permalink
FIX: Upgraded to EO STAC extension v1.1.0 #83
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-braun committed Jul 20, 2023
1 parent 116fe4a commit dccb0ae
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- FIX: Minor fix in RasterioError handling when reading bands
- FIX: Fix Landsat L2 surface reflectance and temperature computation ([#99](https://github.com/sertit/eoreader/issues/99))
- FIX: Test thermal bands in CI
- FIX: Upgraded to EO STAC extension v1.1.0 ([#83](https://github.com/sertit/eoreader/issues/83))

## 0.20.2 (2023-06-22)

Expand Down
2 changes: 1 addition & 1 deletion CI/SCRIPTS/test_satellites.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"MERIT_DEM.vrt",
]

WRITE_ON_DISK = True
WRITE_ON_DISK = False


def set_dem(dem_path):
Expand Down
15 changes: 10 additions & 5 deletions CI/SCRIPTS/test_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ def compare(to_be_checked, ref, topic):
"""
Compare two fields
"""
assert (
ref == to_be_checked
), f"Non equal {topic}: ref ={ref} != to_be_checked={to_be_checked}"
try:
assert (
ref == to_be_checked
), f"Non equal {topic}: ref ={ref} != to_be_checked={to_be_checked}"
except AssertionError:
assert to_be_checked.startswith("No") and to_be_checked.endswith(
"available"
), f"Non equal {topic}: ref ={ref} != to_be_checked={to_be_checked}"


def _test_core(
Expand Down Expand Up @@ -170,7 +175,7 @@ def _test_core(
compare(
item.stac_extensions,
[
"https://stac-extensions.github.io/eo/v1.0.0/schema.json",
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
"https://stac-extensions.github.io/projection/v1.1.0/schema.json",
"https://stac-extensions.github.io/view/v1.0.0/schema.json",
],
Expand All @@ -180,7 +185,7 @@ def _test_core(
compare(
item.stac_extensions,
[
"https://stac-extensions.github.io/eo/v1.0.0/schema.json",
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
"https://stac-extensions.github.io/projection/v1.1.0/schema.json",
],
"item.stac_extensions",
Expand Down
4 changes: 3 additions & 1 deletion eoreader/stac/stac_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ def add_to_item(self, item) -> None:
Band.create(
name=band.name,
common_name=common_name,
description=band.description,
description="No description available"
if len(band.description) < 1
else band.description,
center_wavelength=center_wavelength,
full_width_half_max=full_width_half_max,
solar_illumination=solar_illumination,
Expand Down
6 changes: 4 additions & 2 deletions eoreader/stac/stac_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ def fill_common_mtd(asset: Any, prod, **kwargs) -> None:
**kwargs: Additional arguments
"""
# Basics
asset.common_metadata.title = kwargs.get(TITLE)
asset.common_metadata.description = kwargs.get(DESCRIPTION)
asset.common_metadata.title = kwargs.get(TITLE, "No title available")
asset.common_metadata.description = kwargs.get(DESCRIPTION, "")
if len(asset.common_metadata.description) < 1:
asset.common_metadata.description = "No description available"

# Date and Time
asset.common_metadata.created = datetime.utcnow()
Expand Down

0 comments on commit dccb0ae

Please sign in to comment.