Skip to content
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

Don't infer a default fill_value for zarr_format=2? #2271

Closed
TomAugspurger opened this issue Sep 30, 2024 · 0 comments · Fixed by #2274
Closed

Don't infer a default fill_value for zarr_format=2? #2271

TomAugspurger opened this issue Sep 30, 2024 · 0 comments · Fixed by #2274
Labels
bug Potential issues with the zarr-python library

Comments

@TomAugspurger
Copy link
Contributor

Zarr version

v3

Numcodecs version

na

Python Version

na

Operating System

na

Installation

na

Description

Zarr v2 didn't require a fill value to be set when writing data. To make it easier for users to transition to zarr-python v3 (ref pydata/xarray#5475), what do people think about changing the default fill_value for array metadata? ArrayV2Metadata.fill_value would be allowed to be None in memory and on disk.

We'd still have a fill value implicitly defined using the v2 rules for whatever fill value is actually used at read time.

Steps to reproduce

In [1]: import zarr

In [2]: arr = zarr.open_array(store = zarr.store.MemoryStore(store_dict={}, mode="w"), shape=(4,), zarr_format=2, fill_value=None)  # arr.metadata.fill_value will be None

In [3]: arr[:]  # at read time, find the v2 default and use that.
Out[3]: array([0.0, 0.0, 0.0, 0.0)

Additional output

No response

@TomAugspurger TomAugspurger added the bug Potential issues with the zarr-python library label Sep 30, 2024
@TomAugspurger TomAugspurger changed the title Don't infer a default fill_value for zarr_format=2 Don't infer a default fill_value for zarr_format=2? Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Potential issues with the zarr-python library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant