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

catch dateparsing issue #63

Merged
merged 2 commits into from
Nov 21, 2024
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
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
Loading