Skip to content

nbytes_stored incorrect when dimension_separator="/" #2174

Open
@dstansby

Description

@dstansby

Zarr version

2.18.2

Numcodecs version

0.13.0

Python Version

3.10.4

Operating System

macOS

Installation

conda

Description

When saving an array to disk and loading it again with dimension_separator="/", the number of stored bytes is incorrectly reported. In this case it is just reporting the size of the .zarray file.

Steps to reproduce

import numpy as np
import zarr

zarr_path = "test.zarr"
data = np.random.randint(0, 2**8, size=(64, 64, 64), dtype=np.uint8)

for dimension_separator in [".", "/"]:
    zarr.save_array(zarr_path, data, dimension_separator=dimension_separator)
    zarr_arr = zarr.open(zarr_path)
    print(f"{dimension_separator=}")
    print("nbytes_stored:", zarr_arr.nbytes_stored)
    print()
dimension_separator='.'
nbytes_stored: 262567

dimension_separator='/'
nbytes_stored: 391

Additional output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    V2Affects the v2 branchbugPotential 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