File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 6
6
import pandas as pd
7
7
import pydantic
8
8
import xarray as xr
9
+ import zarr
9
10
from intake .source .base import DataSource , Schema
10
11
11
12
from .cat import Aggregation , DataFormat
@@ -20,6 +21,15 @@ class ESMDataSourceError(Exception):
20
21
pass
21
22
22
23
24
+ def _zarr_async () -> bool :
25
+ """
26
+ Zarr went all async in version 3.0.0. This sets the async flag based on
27
+ the zarr version in storage options
28
+ """
29
+
30
+ return int (zarr .__version__ .split ('.' )[0 ]) > 2
31
+
32
+
23
33
def _get_xarray_open_kwargs (data_format , xarray_open_kwargs = None , storage_options = None ):
24
34
xarray_open_kwargs = (xarray_open_kwargs or {}).copy ()
25
35
_default_open_kwargs = {
Original file line number Diff line number Diff line change 14
14
_get_xarray_open_kwargs ,
15
15
_open_dataset ,
16
16
_update_attrs ,
17
+ _zarr_async ,
17
18
)
18
19
19
20
dask .config .set (scheduler = 'single-threaded' )
@@ -86,9 +87,10 @@ def test_open_dataset_kerchunk(kerchunk_file=kerchunk_file):
86
87
dict (engine = 'zarr' , consolidated = False ),
87
88
storage_options = {
88
89
'remote_protocol' : 's3' ,
89
- 'remote_options' : {'anon' : True , 'asynchronous' : True },
90
+ 'remote_options' : {'anon' : True , 'asynchronous' : _zarr_async () },
90
91
},
91
92
)
93
+
92
94
ds = _open_dataset (
93
95
data_format = 'reference' ,
94
96
urlpath = kerchunk_file ,
You can’t perform that action at this time.
0 commit comments