Skip to content

Commit 07bc6c9

Browse files
Move _zarr_async to utils module
1 parent 86c00fd commit 07bc6c9

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

intake_esm/source.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import pandas as pd
77
import pydantic
88
import xarray as xr
9-
import zarr
109
from intake.source.base import DataSource, Schema
1110

1211
from .cat import Aggregation, DataFormat
@@ -21,15 +20,6 @@ class ESMDataSourceError(Exception):
2120
pass
2221

2322

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-
3323
def _get_xarray_open_kwargs(data_format, xarray_open_kwargs=None, storage_options=None):
3424
xarray_open_kwargs = (xarray_open_kwargs or {}).copy()
3525
_default_open_kwargs = {

intake_esm/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from collections import defaultdict
66

77
import polars as pl
8+
import zarr
89

910

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

5960

61+
def _zarr_async() -> bool:
62+
"""
63+
Zarr went all async in version 3.0.0. This sets the async flag based on
64+
the zarr version in storage options
65+
"""
66+
67+
return int(zarr.__version__.split('.')[0]) > 2
68+
69+
6070
OPTIONS = {
6171
'attrs_prefix': 'intake_esm_attrs',
6272
'dataset_key': 'intake_esm_dataset_key',

tests/test_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
_get_xarray_open_kwargs,
1515
_open_dataset,
1616
_update_attrs,
17-
_zarr_async,
1817
)
18+
from intake_esm.utils import _zarr_async
1919

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

0 commit comments

Comments
 (0)