Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in 2.18.x with size-1 slicing not resolved #1931

Open
i-jey opened this issue May 29, 2024 · 1 comment · Fixed by #1947
Open

Regression in 2.18.x with size-1 slicing not resolved #1931

i-jey opened this issue May 29, 2024 · 1 comment · Fixed by #1947
Labels
bug Potential issues with the zarr-python library

Comments

@i-jey
Copy link

i-jey commented May 29, 2024

Zarr version

v2.17.0, 2.18.x

Numcodecs version

v0.12.1

Python Version

3.10.0

Operating System

Linux/Mac

Installation

Using pip3 in a venv

Description

There appears to be a regression from v0.17.x to v0.18.0 that was not resolved in v0.18.1 or v0.18.2 when indexing a zarr array with size-1 dimensions.

Steps to reproduce

The below works on zarr==2.17.0, breaks on zarr==2.18.1

def min_example():
    import zarr
    import numpy as np

    store = zarr.ZipStore("temp.zip", mode="w")
    arr = zarr.zeros(shape=(100, 200, 10), chunks=(100, 200, 1), compressor=None, store=store, dtype='u1')
    arr[:, :, :] = np.random.randint(0, 255, (100, 200, 10))
    store.close()

    zf = zarr.open("temp.zip", "r")
    print(zf[:, :, 1])

Additional output

The error on 2.18.1 is:

ValueError: could not broadcast input array from shape (100,200,1) into shape (100,200)

@i-jey i-jey added the bug Potential issues with the zarr-python library label May 29, 2024
@jhamman
Copy link
Member

jhamman commented Jun 1, 2024

Thanks for the report here @i-jey. This is another regression from #1800. @dcherian -- care to take a look?

dcherian added a commit to dcherian/zarr-python that referenced this issue Jun 4, 2024
This is important for zarr-developers#1931
jhamman pushed a commit that referenced this issue Aug 8, 2024
* Add hypothesis tests

1. Roundtrip a numpy array
2. Basic Indexing

* Add compressors

This is important for #1931

* Add more test

* Add zarr_version

* Revert "Add zarr_version"

This reverts commit 2ad1b35.

* ADapt for V3

* Add workflow

* Try again

* always run

* fix env

* Try typing

* Cleanup

* Add vindex

* Review feedback

* cleanup

* WIP

* Cleanup

* Move to v3/

* another type ignore

* Add `_`

* Update src/zarr/strategies.py

* Update src/zarr/strategies.py

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Potential issues with the zarr-python library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants