Skip to content

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

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

Open
tasansal opened this issue Apr 16, 2025 · 2 comments · May be fixed by #2992
Open

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

tasansal opened this issue Apr 16, 2025 · 2 comments · May be fixed by #2992
Labels
bug Potential issues with the zarr-python library

Comments

@tasansal
Copy link
Contributor

tasansal commented Apr 16, 2025

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": []
}
@tasansal tasansal added the bug Potential issues with the zarr-python library label Apr 16, 2025
@tasansal tasansal changed the title Function zeros_like ignores keyword arguments Function zeros_like ignores chunk override in keyword arguments Apr 16, 2025
@tasansal tasansal changed the title Function zeros_like ignores chunk override in keyword arguments Function zeros_like ignores overrides in keyword arguments (e.g. chunks, dtype. Apr 16, 2025
@tasansal tasansal changed the title Function zeros_like ignores overrides in keyword arguments (e.g. chunks, dtype. Function zeros_like ignores overrides in keyword arguments (e.g. chunks, dtype). Apr 16, 2025
@tasansal tasansal changed the title Function zeros_like ignores overrides in keyword arguments (e.g. chunks, dtype). [v3] Function zeros_like ignores overrides in keyword arguments (e.g. chunks, dtype). Apr 16, 2025
@d-v-b d-v-b linked a pull request Apr 17, 2025 that will close this issue
@d-v-b
Copy link
Contributor

d-v-b commented Apr 17, 2025

@tasansal thanks for this bug report. I think I fixed this in #2992, please let me know if that PR doesn't resolve this

@BrianMichell
Copy link
Contributor

@d-v-b Thanks for the quick response! I did some quick testing and it appears that the fix behaves as expected, but unfortunately our full test suite currently keels over due to #2998.

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.

3 participants