Skip to content

Commit

Permalink
Wrap sync fs for xarray.to_zarr
Browse files Browse the repository at this point in the history
  • Loading branch information
moradology committed Dec 18, 2024
1 parent f360fc6 commit 38a841c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/zarr/storage/fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import warnings
from typing import TYPE_CHECKING, Any

from fsspec.implementations.asyn_wrapper import AsyncFileSystemWrapper

from zarr.abc.store import ByteRangeRequest, Store
from zarr.storage.common import _dereference_path

Expand Down Expand Up @@ -166,6 +168,8 @@ def from_url(
opts = {"asynchronous": True, **opts}

fs, path = url_to_fs(url, **opts)
if not fs.async_impl:
fs = AsyncFileSystemWrapper(fs)

# fsspec is not consistent about removing the scheme from the path, so check and strip it here
# https://github.com/fsspec/filesystem_spec/issues/1722
Expand Down

0 comments on commit 38a841c

Please sign in to comment.