Skip to content

Resizing an array overwrites the dimension separator metadata #1533

Closed
@ziw-liu

Description

@ziw-liu

Zarr version

v2.15.0, v2.16.1

Numcodecs version

v0.11.0

Python Version

3.9.16, 3.10.12

Operating System

Linux, macOS

Installation

using pip into a conda environment

Description

When an array with "dimension_separator": "/" is resized, the metadata field is overwritten (removed from the .zarray file). Subsequent reading operations will silently fall back to the default ("."), and fill zeros because it will not find the chunks with the expected path name.

Steps to reproduce

import zarr

with zarr.open(
    zarr.DirectoryStore("img.zarr", dimension_separator="/"), mode="w"
) as img:
    img[0] = zarr.ones((100, 100), chunks=(10, 10))

with zarr.open("img.zarr") as img:
    assert img[0]._dimension_separator == "/"

with zarr.open("img.zarr") as img:
    img[0].resize(100, 200)

with zarr.open("img.zarr") as img:
    assert img[0]._dimension_separator == "/", "Dimension separator changed"

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