You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7b8b72e
Browse filesBrowse the repository at this point in the historyBrowse files
`from_array` discards both `fill_value` and `attributes`.
An explicit `fill_value=None` now means the dtype's default scalar (v3) or a
null fill value (v2), consistent with `create_array`, and an empty
`attributes` dict opts out of copying the source's attributes.
Fixeszarr-developers#4287
`zarr.from_array` now defaults to the fill value and the attributes of the source array, as its documentation already stated. Previously both were silently discarded: the array was created with the data type's default scalar and no attributes.
2
+
3
+
The `fill_value` keep-branch compared the argument against `None`, but the parameter's default is the `DEFAULT_FILL_VALUE` sentinel, so the branch never ran when the argument was omitted — while an explicit `fill_value=None` did keep the source's fill value, the opposite of what `create_array` does with `None`. `attributes` had no keep-branch at all.
4
+
5
+
Because the copy silently used the wrong fill value, unwritten regions of the new array read back as the data type's default rather than the source's fill value. With `write_data=False` the entire array read back wrongly, and after a `resize` the newly exposed region did too.
6
+
7
+
An explicit `fill_value=None` now selects the data type's default scalar (Zarr format 3) or a null fill value (Zarr format 2), consistently with `create_array`, and an empty `attributes` dict creates the array with no attributes. Pass either explicitly to opt out of copying from the source.
0 commit comments