Open
Description
Maybe I'm an outlier, but my Zarr data access falls into three categories, sorted by frequency:
- I want to read immutable data that already exists at path
foo
. Two sub-cases:- I don't know what exactly is in
foo
, so I'm happy getting a handle to an array or group - I expect an array or group, and getting anything other than what I expect should be an error.
- I don't know what exactly is in
- I want to create a brand new Zarr array or group at path
foo
, optionally destroying anything already atfoo
. - I have some data in memory that I need to store in a Zarr array or group at path
foo
. Two sub-cases:- if an array or group compatible my data does not exist at
foo
, I want to create it and get a mutable handle to the array / group. - if an array or group matching my data does exist at
foo
then there's no need to create anything, and I just want a mutable handle to that array or group.
- if an array or group compatible my data does not exist at
First, does anyone have a common Zarr access pattern that isn't one of these three?
Second, does anyone think our current top-level API maps on to the access patterns I listed? I personally do not think it does, and I suspect we can get some easy user experience gains by adding more specific and safe functions to the top-level API. See #2463.
Longer term, I think we should consider dropping File-mode-like semantics for our top-level API. maybe open(mode=x)
makes sense for files, but I don't think that should be the basis for our user-facing API. We should provide a set of functions that actually match the access patterns users have.