Skip to content

Optional base class for zarr Stores? #573

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

Closed
shoyer opened this issue Jul 1, 2020 · 2 comments
Closed

Optional base class for zarr Stores? #573

shoyer opened this issue Jul 1, 2020 · 2 comments

Comments

@shoyer
Copy link
Contributor

shoyer commented Jul 1, 2020

Has there been consideration of defining an optional base class in Zarr for storage objects?

The main use cases would be to support type inference. For example, it would be nice if xarray.open_dataset(zarr_store) could work automatically, but this requires some way to infer that zarr_store is a Zarr store as opposed to another file-type supported by xarray. My current proposal is to check for the presence of a '.zgroup' key in a mutable mapping. It would be more elegant/faster to just be able to to use isinstance(store, zarr.storage.Store).

I know that in principle any object implementing the MutableMapping interface suffices for storing data in Zarr, but in practice I suspect that most storage objects include least a small layer written explicitly for Zarr, e.g., to implement special methods like listdir and rmdir. You could still support arbitrary Mapping objects when explicitly passed into zarr.open(), etc (in xarray, this would happen if engine='zarr' passed into open_dataset).

@joshmoore
Copy link
Member

Closing this in favor of #600

@jakirkham
Copy link
Member

Done in PR ( #789 )

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