Skip to content

Broken invocation of create in open_array #2383

Open
@d-v-b

Description

@d-v-b

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features or improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions