Skip to content

interating over 1d array returns dimensionless numpy arrays in v3 #3415

Description

@christine-e-smit

Zarr version

3.1.2

Numcodecs version

0.16.1

Python Version

3.13.5

Operating System

Mac

Installation

using conda

Description

When I iterate over a 1D array, I get dimensionless numpy arrays out rather than just getting the data values. This behavior is different from zarr library version 2. In zarr library v2, I get the data values themselves. Is this new behavior intended?

Details of python setup where the script below works:
zarr version: 2.18.4
numcodecs version: 0.15.1
python version: 3.13.5

Steps to reproduce

# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
#   "numpy"
# ]
# ///
#
# This script automatically imports the development branch of zarr to check for issues

import zarr
import numpy as np

z = zarr.zeros(shape=(2,), chunks=(2,), dtype=np.int32)
listed = list(z)
assert type(listed[0]) == np.int32

Additional output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions