Skip to content

Commit

Permalink
handle case where the tile geometry is empty, probably because there …
Browse files Browse the repository at this point in the history
…is no data in the L2A product even though there was data in the L1C product
  • Loading branch information
Phil Varner committed Jan 30, 2024
1 parent 642a83c commit 3545789
Show file tree
Hide file tree
Showing 4 changed files with 1,109 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/stactools/sentinel2/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,12 @@ def metadata_from_granule_metadata(
"Perhaps there is no data in the scene?"
)

if not (cs := tileinfo_metadata.geometry.get("coordinates")) or not (all(cs)):
raise ValueError(
f"Metadata contains a geometry for {granule_metadata_href} with no "
"coordinates. Perhaps there is no data in the scene?"
)

geometry = reproject_shape(
f"epsg:{granule_metadata.epsg}", "epsg:4326", tileinfo_metadata.geometry
).simplify(tolerance)
Expand Down
Loading

0 comments on commit 3545789

Please sign in to comment.