-
Notifications
You must be signed in to change notification settings - Fork 180
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
Support Zarr-Python 3 #1082
Support Zarr-Python 3 #1082
Conversation
ds = xarray.open_zarr(store, **xr_open_args) | ||
else: | ||
fs = fsspec.filesystem(protocol) | ||
ds = xarray.open_zarr(fs.get_mapper(src_path), **xr_open_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the bulk of the changes to account for Zarr no longer accepting fsspec's mutable mapping wrappers and expecting asynchronous file systems.
Co-authored-by: Vincent Sarago <[email protected]>
"h5netcdf", | ||
"fsspec", | ||
"s3fs", | ||
"aiohttp", | ||
"gcsfs", | ||
] | ||
minimal = [ | ||
"zarr>=2,<3", | ||
"zarr", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this work for zarr<3 ? Should that be specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I accounted for both the new and old syntax in
titiler/src/titiler/xarray/titiler/xarray/io.py
Lines 81 to 89 in e081d0f
if module_available("zarr", minversion="3.0"): | |
if protocol == "file": | |
store = zarr.storage.LocalStore(parsed.path, read_only=True) | |
else: | |
fs = fsspec.filesystem(protocol, storage_options={"asynchronous": True}) | |
store = zarr.storage.FsspecStore(fs, path=src_path, read_only=True) | |
else: | |
store = fsspec.filesystem(protocol).get_mapper(src_path) |
Adds support for both opening Zarr stores using either Zarr-Python 2 or Zarr-Python 3.
Fixed #1068