Skip to content

zarr allows bad fill values #2205

Closed
Closed
@dcherian

Description

@dcherian

Zarr version

v3 main

Numcodecs version

?

Python Version

?

Operating System

?

Installation

?

Description

Seems to accept -1 fill value for uint32 arrays.

Steps to reproduce

def test_bad_fill_value():
    import zarr
    import numpy as np

    store = zarr.store.MemoryStore({}, mode="w")
    group = zarr.group(store=store, overwrite=True)

    zarray = group.create_array(
        name="foo",
        shape=(2,),
        fill_value=-1,
        chunk_shape=(1,),
        dtype=np.uint32,
        exists_ok=True,
    )
    print(zarray.fill_value)


test_bad_fill_value() # 4294967295

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