Skip to content

Commit

Permalink
Merge pull request #63 from developmentseed/patch/date-parsing
Browse files Browse the repository at this point in the history
catch dateparsing issue
  • Loading branch information
vincentsarago authored Nov 21, 2024
2 parents 4ca061f + f0a7b04 commit 290a687
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

## 0.10.1 (2024-11-21)

* exclude rasterio version `1.4.2` from requirements
* catch date parsing issue and raise warning

## 0.10.0 (2024-10-29)

* handle `TIFFTAG_DATETIME` metadata for STAC datetime
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers = [
]
dynamic = ["version"]
dependencies = [
"rasterio",
"rasterio>=1.0,!=1.4.2",
"pystac>=1.0.0,<2.0.0",
]

Expand Down
7 changes: 6 additions & 1 deletion rio_stac/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,12 @@ def create_stac_item(
acq_date = src_dst.get_tag_item("ACQUISITIONDATETIME", "IMAGERY")
tiff_date = src_dst.get_tag_item("TIFFTAG_DATETIME")
dst_date = acq_date or tiff_date
dst_datetime = str_to_datetime(dst_date) if dst_date else None
try:
dst_datetime = str_to_datetime(dst_date) if dst_date else None
except ValueError as err:
warnings.warn(f"Could not get parse date: {dst_date}: {err}")
dst_datetime = None

input_datetime = input_datetime or dst_datetime or datetime.datetime.utcnow()

# add projection properties
Expand Down

0 comments on commit 290a687

Please sign in to comment.