Skip to content

Commit 2baf610

Browse files
tomwhitemergify[bot]
authored andcommitted
Add kwargs to load_dataset to pass to xarray, matching save_dataset
1 parent 2e047c0 commit 2baf610

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sgkit/io/dataset.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def save_dataset(
1414
store: Union[PathType, MutableMapping[str, bytes]],
1515
storage_options: Optional[Dict[str, str]] = None,
1616
auto_rechunk: Optional[bool] = None,
17-
**kwargs: Any
17+
**kwargs: Any,
1818
) -> None:
1919
"""Save a dataset to Zarr storage.
2020
@@ -87,6 +87,7 @@ def save_dataset(
8787
def load_dataset(
8888
store: Union[PathType, MutableMapping[str, bytes]],
8989
storage_options: Optional[Dict[str, str]] = None,
90+
**kwargs: Any,
9091
) -> Dataset:
9192
"""Load a dataset from Zarr storage.
9293
@@ -99,6 +100,8 @@ def load_dataset(
99100
Zarr store or path to directory in file system to load from.
100101
storage_options:
101102
Any additional parameters for the storage backend (see ``fsspec.open``).
103+
kwargs
104+
Additional arguments to pass to :func:`xarray.open_zarr`.
102105
103106
Returns
104107
-------
@@ -110,7 +113,7 @@ def load_dataset(
110113
store = fsspec.get_mapper(store, **storage_options)
111114
elif isinstance(store, Path):
112115
store = str(store)
113-
ds: Dataset = xr.open_zarr(store, concat_characters=False) # type: ignore[no-untyped-call]
116+
ds: Dataset = xr.open_zarr(store, concat_characters=False, **kwargs) # type: ignore[no-untyped-call]
114117
for v in ds:
115118
# Workaround for https://github.com/pydata/xarray/issues/4386
116119
if v.endswith("_mask"): # type: ignore

0 commit comments

Comments
 (0)