Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies:
- watermark
- xarray-datatree >=0.0.9
- xarray >=2024.10
- zarr >=2.12,<3.0
- zarr <3.0|>=3.0.10
- furo >=2022.09.15
- pip:
- git+https://github.com/ncar-xdev/ecgtools
Expand Down
2 changes: 1 addition & 1 deletion ci/environment-upstream-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies:
- scipy
- xarray-datatree
- xgcm
- zarr >=2.10,<3.0
- zarr <3.0|>=3.0.10
- pip:
- git+https://github.com/intake/intake.git
- git+https://github.com/pydata/xarray.git
Expand Down
2 changes: 1 addition & 1 deletion ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ dependencies:
- scipy
- xarray >=2024.10
- xarray-datatree
- zarr >=2.12,<3.0
- zarr <3.0|>=3.0.10
# - pytest-icdiff
10 changes: 10 additions & 0 deletions intake_esm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from collections import defaultdict

import polars as pl
import zarr


def show_versions(file=sys.stdout): # pragma: no cover
Expand Down Expand Up @@ -57,6 +58,15 @@ def show_versions(file=sys.stdout): # pragma: no cover
print(f'{k}: {stat}', file=file)


def _zarr_async() -> bool:
"""
Zarr went all async in version 3.0.0. This sets the async flag based on
the zarr version in storage options
"""

return int(zarr.__version__.split('.')[0]) > 2


OPTIONS = {
'attrs_prefix': 'intake_esm_attrs',
'dataset_key': 'intake_esm_dataset_key',
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ pydantic>=2.0
pydap!=3.5.5
requests>=2.24.0
xarray>=2024.10
zarr>=2.12
zarr>=3.0.10
7 changes: 6 additions & 1 deletion tests/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
_open_dataset,
_update_attrs,
)
from intake_esm.utils import _zarr_async

dask.config.set(scheduler='single-threaded')

Expand Down Expand Up @@ -84,8 +85,12 @@ def test_open_dataset_kerchunk(kerchunk_file=kerchunk_file):
xarray_open_kwargs = _get_xarray_open_kwargs(
'reference',
dict(engine='zarr', consolidated=False),
storage_options={'remote_protocol': 's3', 'remote_options': {'anon': True}},
storage_options={
'remote_protocol': 's3',
'remote_options': {'anon': True, 'asynchronous': _zarr_async()},
},
)

ds = _open_dataset(
data_format='reference',
urlpath=kerchunk_file,
Expand Down
Loading