-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Ensure KeyError raised for zarr datasets missing dim names #10025
Conversation
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. |
Locally I am getting a failure I don't understand for default_zarr_format=2 case, related to the NCZarr code path.
|
Test still failing for case
Not sure best solution—should we check zarr version here and handle async function appropriately? Is there a way to get this info that has same API in zarr-python 2 and 3? Or can we just not test with this combination of zarr-python version and default zarr format? @jhamman |
for more information, see https://pre-commit.ci
…y into check-shape-matches-dims
…y into check-shape-matches-dims
zarray_str = asyncio.run(zarr_obj.store.get(zarray_path)).to_bytes() | ||
else: | ||
zarray_str = zarr_obj.store.get(zarray_path) | ||
zarray = json.loads(zarray_str) |
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.
would you find it useful if zarr let you do this with a single function? because we could totally add that
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.
I've not needed to access the 'zarray' info before, so that wouldn't make a big difference to me. But it seems nczarr does use it and I was just trying to get this existing code to work with zarr-python 3.
if _zarr_v3(): | ||
import asyncio | ||
|
||
zarray_str = asyncio.run(zarr_obj.store.get(zarray_path)).to_bytes() |
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.
If there's no check previously guaranteeing that this is zarr_format=2, an additional check for zarray_paths ending with zarr.json
will likely be needed.
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.
I believe the first try/except block in this function is intended to ensure we have zarr_format=2 here:
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! I'll merge once we fix our test failures.
Add check to ensure that a KeyError is raised for zarr datasets that were not created by xarray.
whats-new.rst