-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expose use_cftime option in open_zarr #2886 #3229
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
Conversation
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.
Thanks @Geektrovert - for testing I think we need to create a temporary zarr store that contains a single time that could be decoded into a different date type depending on the value passed to use_cftime
. Then we need to assert that the time gets decoded to the date type we expect when we use open_zarr
with different values of use_cftime
.
For details on how to create a temporary zarr store you could probably draw some inspiration from looking at some of the other tests in test_backends.py
, like this one:
xarray/xarray/tests/test_backends.py
Lines 1778 to 1784 in 0a3bb18
def test_append_write(self): | |
ds, ds_to_append, _ = create_append_test_data() | |
with self.create_zarr_target() as store_target: | |
ds.to_zarr(store_target, mode="w") | |
ds_to_append.to_zarr(store_target, append_dim="time") | |
original = xr.concat([ds, ds_to_append], dim="time") | |
assert_identical(original, xr.open_zarr(store_target)) |
@Geektrovert, thank you for working on this! I rebased your fork to upstream master and added some tests locally. Do you mind giving me permissions so that I can push to your fork so as to bring this PR to completion? |
@andersy005 sure! I will add you as a collaborator to my fork. Thank you for working on this! |
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.
LGTM. This just needs a whats-new
entry
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.
Indeed this looks great @andersy005; thanks for finishing this up.
Done! I don't know why the readthedocs build failed though |
this seems to be a general issue with RTD (there are quite a few open issues about this already) and has to be fixed by them. |
Thanks @Geektrovert & @andersy005. This is a great improvement. @Geektrovert I see this is your first PR. Thanks! and welcome to xarray. |
black . && mypy . && flake8