-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
Deterministic chunk padding #2755
base: main
Are you sure you want to change the base?
Deterministic chunk padding #2755
Conversation
Co-authored-by: Joe Hamman <[email protected]>
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.
A couple of suggestions (in particular, explaining in a bit more detail the user facing bug this fixes), otherwise looks good!
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.
Marking this as request changes, since it looks like it broke some tests - I had a look at the tests, and failure seems real (requesting a fill value of ""
, and getting 0
instead)
Fixed it. |
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 this now means zarr.emtpy
deafults to filling data with zeros, instead of undefined data, this is a behaviour change from zarr-python 2: https://zarr.readthedocs.io/en/v2.18.4/api/creation.html#zarr.creation.empty - I think this is fine, but we should document that change in the changelog.
The docstring of zarr.creation.empty is now also incorrect, and needs updating:
The contents of an empty Zarr array are not defined. On attempting to retrieve data from an empty Zarr array, any values may be returned, and these are not guaranteed to be stable from one access to the next.
I also had a suggested improvement to the changelog above.
Co-authored-by: David Stansby <[email protected]>
Head branch was pushed to by a user without write access
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 for updating the docstrings!
I had another read and think about this, and this is quite a major change happening - the data being returned/created by a function is changing. I think in this case it's okay, because it's only filled data that the user hasn't specified, and it fixes a bad bug.
It also seems like this change makes empty()
do the same thing as zeros()
? (create an array filled with zeros) Is that correct, and do these two functions do the same thing now? If that's the case, should we deprecate and eventually remove zarr.empty()
? That can happen in a follow up PR to keep this tightly scoped to the bug fix, but it's a consquence of this PR we should make sure we're happy with.
Because of the above issues I'm not 100% on just me reviewing this - I'd like someone else in @zarr-developers/python-core-devs to review and approve this (and explicitly say that they're okay with the data changing/potentially making emtpy()
redundant).
|
||
Notes | ||
----- | ||
The contents of an empty Zarr array are not defined. On attempting to |
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.
A bit of a random thought, but this sentence could likely stay in the sense that not defined can also mean "with fill_value OR 0
" if we are concerned that this isn't a constraint we want to impose in the future.
Both The old docs might have said that |
i had a quick look through the v2 code and it looks like v2 was padding with 0s to ensure consistency and compressibility: Lines 2309 to 2313 in 66e2982
|
zarr_format=2
#2696TODO:
docs/user-guide/*.rst
changes/