-
Notifications
You must be signed in to change notification settings - Fork 122
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
Compatiblity with CFTime #238
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #238 +/- ##
========================================
Coverage 93.73% 93.73%
========================================
Files 30 30
Lines 3749 3749
========================================
Hits 3514 3514
Misses 235 235
Continue to review full report at Codecov.
|
Could the maintainers (maybe @lossyrob) let me know whether this PR might be acceptable. I'd be happy to make any changes required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rabernat apologies for the delay in review.
The change looks great, however can you provide a unit test that demostrates the failure case when this change is not in place/succeeds with this change? Thanks!
Sure. Would you prefer I add cftime as a test dependency or that I use some kind of mock / monkeypatch to datetime? |
I think the mock/monkeypatch version would work, with a comment pointing at the specific cftime class it is mimicking in case API changes down the road. Thanks! |
After thinking this through, I decided it made more sense to fix this in cftime, rather than pystac. See Unidata/cftime#209. But thanks for considering this. |
I am trying to catalog climate model data stored in Zarr format on Google Cloud / AWS using STAC. My approach is to create a STAC collection for each Zarr dataset and link to the Zarr data using collection-level assets (see related discussion @ radiantearth/stac-spec#781).
I have hit a tiny snag with datetimes. I need to populate
temporal_extent
for the collections. I get this by reading the dataset's time range. The times are encoded using the CF Conventions for time coordinates. In python, CF times are implemented by the cftime package. cftime provides a (mostly) duck-type compatible with datetime. However, cftime has no.tzinfo
attribute.This tiny change allows pystac to work with cftime datetimes.
I have not added a test because I didn't want to add cftime to the dependencies. One could possibly use a mock to test this feature. Or we could merge this tiny change with no test. I'll follow whatever path the devs recommend.
cc @charlesbluca