Skip to content

Shape and chunks accept float values when creating an array #2530

Closed
@faymanns

Description

@faymanns

Zarr version

v2.18.3

Numcodecs version

v0.12.1

Python Version

v3.11.2

Operating System

Linux

Installation

Using pip into virtual environment

Description

When you create a new array (e.g. using zarr.zeros), the tuples for shape and chunks can contain float values.
The values after the decimal point are trimmed without a warning.
Is this the intended behavior?
I would expect zarr-python to raise an exception or at least a warning.

Steps to reproduce

import zarr

z = zarr.zeros((100.4, 100.9), chunks=(10.5, 10.1), dtype="i4")
print(z.shape)
print(z.chunks)

As you can see from the output the float values are trimmed without warning:

(100, 100)
(10, 10)

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