Skip to content

Regression failures reading fsspec ReferenceFileSystem file with zarr 2.13.6 #1324

@cgohlke

Description

@cgohlke

Zarr version

2.13.6

Numcodecs version

0.11.0

Python Version

3.10.9, any version

Operating System

Windows

Installation

pip

Description

Fsspec ReferenceFileSystem files for image file sequences produced by tifffile can no longer be read correctly by zarr 2.13.6. Version 2.13.3 worked fine.

Tifffile's test_tifffile::test_write_fsspec_sequence and earthbigdata.py fail with zarr 2.13.6.

It looks like the chunks are no longer correctly mapped to their indices.

Steps to reproduce

Example

import tifffile
import fsspec
import zarr

from tifffile.numcodecs import register_codec

register_codec()

print(f'tifffile {tifffile.__version__}')
print(f'fsspec {fsspec.__version__}')
print(f'zarr {zarr.__version__}')

# generate file sequence
for i in range(16):
    for j in range(16):
        tifffile.imwrite(f'test_{i}_{j}.tif', [i * j])

expected = tifffile.imread('*.tif', pattern=r'_(\d+)_(\d+)')

# write fsspec ReferenceFileSystem file
with tifffile.imread('*.tif', pattern=r'_(\d+)_(\d+)', aszarr=True) as store:
    store.write_fsspec('test.json', '')

# get zarr array from reference file
mapper = fsspec.get_mapper('reference://', fo='test.json', target_protocol='file')
from_zarr = zarr.open(mapper, mode='r')[:]

# compare images
from matplotlib import pyplot

pyplot.subplot(211)
pyplot.imshow(expected)
pyplot.subplot(212)
pyplot.imshow(from_zarr)
pyplot.show()

Output

tifffile 2022.10.10
fsspec 2022.11.0
zarr 2.13.6

zarr_issue

Additional output

test.json.zip

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