Skip to content

Commit

Permalink
Merge pull request #19 from ircwaves/issue/18/count-some-underscores
Browse files Browse the repository at this point in the history
fix: use instance_id instead of item.id
  • Loading branch information
ircwaves authored Jun 27, 2023
2 parents 604505a + 9c616cb commit c9a0453
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ number as needed.
### Fixed

- Use correct EO Extension attribute names and units ([#13](https://github.com/stactools-packages/sentinel3/pull/15))
- Use un-stripped `instance_id` to check for strip granules and apply geometry
fix ([#19](https://github.com/stactools-packages/sentinel3/pull/19))

## [0.4.0] - 2023-03-31

Expand Down
6 changes: 4 additions & 2 deletions src/stactools/sentinel3/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def create_item(
stac_extensions=["https://stac-extensions.github.io/file/v2.1.0/schema.json"],
)
sen3naming = re.match(
r".*/(?P<mission>...)_(?P<source>[A-Z]{2})_(?P<level>[_012])_(?P<datatype>.{6})"
r"^.*/?(?P<mission>...)_(?P<source>[A-Z]{2})_(?P<level>[_012])_(?P<datatype>.{6})"
r"_(?P<datastart>.{15})_(?P<datastop>.{15})_(?P<creation>.{15})"
r"_(?P<instance_id>((?P<duration>[0-9]{4})_(?P<cycle>[0-9]{3})"
r"_(?P<relative_orbit>[0-9]{3})"
Expand Down Expand Up @@ -339,7 +339,9 @@ def create_item(
geometry = shapely.geometry.shape(geometry_dict)

# slstr-lst strip geometries are incorrect, so we apply a hack
if item.properties["s3:product_name"] == "slstr-lst" and item.id.endswith("_____"):
if item.properties["s3:product_name"] == "slstr-lst" and sen3naming.group(
"instance_id"
).endswith("_____"):
geometry = antimeridian.fix_polygon(geometry, force_north_pole=True)
else:
geometry = antimeridian.fix_polygon(geometry)
Expand Down

0 comments on commit c9a0453

Please sign in to comment.