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

Re-add data= in zarr.core.array.create_array #2707

Open
martindurant opened this issue Jan 14, 2025 · 2 comments
Open

Re-add data= in zarr.core.array.create_array #2707

martindurant opened this issue Jan 14, 2025 · 2 comments

Comments

@martindurant
Copy link
Member

In V2, create_array allowed for passing data=, which was convenient for determining the shape, dtype and initial data of the created data.

arr = create_array(name,  dtype=arr.dtype, shape=arr.dtype)
arr[:] = arr

would simplify to

create_array(name,  data=arr)
@d-v-b
Copy link
Contributor

d-v-b commented Jan 14, 2025

I don't think create_array existed in v2, but it's true that the v2 array function took an array-like data parameter which would be used to initialize the array.

Given how many people have asked for this feature recently, I wonder if we should rename create_array to init_array, and use the name create_array for a top-level routine that combines array initialization with filling the array with data.

@jhamman
Copy link
Member

jhamman commented Jan 15, 2025

I don't see any harm in adding the data keyword to the create_array function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants