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

Broken invocation of create in open_array #2383

Open
d-v-b opened this issue Oct 15, 2024 · 1 comment
Open

Broken invocation of create in open_array #2383

d-v-b opened this issue Oct 15, 2024 · 1 comment

Comments

@d-v-b
Copy link
Contributor

d-v-b commented Oct 15, 2024

open_array is designed to either read an existing array or create a new one, if the the store_path object has the mode create and no existing array is found. However, creating an array requires specifying a shape as a positional argument to create, but shape is not one of the parameters of open_array, so open_array will always fail if the "create the array" branch is traversed, unless shape was provided in **kwargs, which is a strange API.

I'm not sure how to rescue this function in a way that preserves its intended functionality -- open_array(..., path='foo', shape=(100,)) will return an array with arbitrary shape if one happens to already exist at path foo, which is not good user experience (the user was expecting an array with shape (100,)). This is an API I always disliked about zarr v2; we should consider whether we want to keep it around.

@jhamman
Copy link
Member

jhamman commented Oct 15, 2024

One path forward could be to raise an error if open_array finds an array that does not match the provided parameters (shape, type, etc.). Would that suffice here?

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

2 participants