Skip to content

[v3] Function zeros_like ignores overrides in keyword arguments (e.g. chunks, dtype). #2989

Open
@tasansal

Description

@tasansal

Zarr version

3.0.6

Numcodecs version

0.15.1

Python Version

3.13

Operating System

Mac

Installation

Using uv into virtual env

Description

The zeros_like function doesn't honor the overrides. e.g. chunks and dtype.

Steps to reproduce

import zarr

root = zarr.open("test.zarr", mode="w")
arr = root.create_array(name="array", shape=(256, 512, 512), chunks=(256, 512, 512), dtype="float32")

arr2 = root.zeros_like(data=arr, name="clone", chunks=(16, 16, 16), dtype="uint32")

arr2.chunks should show (16, 16, 16) but it keeps original (256, 512, 512)

Additional output

Here is metadata for that clone array.

{
  "shape": [
    256,
    512,
    512
  ],
  "data_type": "float32",
  "chunk_grid": {
    "name": "regular",
    "configuration": {
      "chunk_shape": [
        256,
        512,
        512
      ]
    }
  },
  "chunk_key_encoding": {
    "name": "default",
    "configuration": {
      "separator": "/"
    }
  },
  "fill_value": 0.0,
  "codecs": [
    {
      "name": "bytes",
      "configuration": {
        "endian": "little"
      }
    },
    {
      "name": "zstd",
      "configuration": {
        "level": 0,
        "checksum": false
      }
    }
  ],
  "attributes": {},
  "zarr_format": 3,
  "node_type": "array",
  "storage_transformers": []
}

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