Skip to content

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

Closed
@TomAugspurger

Description

@TomAugspurger

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions