Skip to content

Commit 40291ad

Browse files
aladinorkeewis
andauthored
passing missing parameters to ZarrStore.open_store when opening a datatree (#9377)
* passing missing parameters to ZarrStore.open_store when opening a datatree * Fix issue with passing parameters to ZarrStore.open_store when opening datatree in zarr format * whats-new formatting --------- Co-authored-by: Justus Magin <[email protected]>
1 parent ca2e9d6 commit 40291ad

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

doc/whats-new.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ Bug fixes
4747
date "0001-01-01". (:issue:`9108`, :pull:`9116`) By `Spencer Clark
4848
<https://github.com/spencerkclark>`_ and `Deepak Cherian
4949
<https://github.com/dcherian>`_.
50+
- Fix issue with passing parameters to ZarrStore.open_store when opening
51+
datatree in zarr format (:issue:`9376`, :pull:`9377`).
52+
By `Alfonso Ladino <https://github.com/aladinor>`_
5053

5154
Documentation
5255
~~~~~~~~~~~~~

xarray/backends/zarr.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,15 +1225,37 @@ def open_datatree(
12251225
filename_or_obj = _normalize_path(filename_or_obj)
12261226
if group:
12271227
parent = NodePath("/") / NodePath(group)
1228-
stores = ZarrStore.open_store(filename_or_obj, group=parent)
1228+
stores = ZarrStore.open_store(
1229+
filename_or_obj,
1230+
group=parent,
1231+
mode=mode,
1232+
synchronizer=synchronizer,
1233+
consolidated=consolidated,
1234+
consolidate_on_close=False,
1235+
chunk_store=chunk_store,
1236+
storage_options=storage_options,
1237+
stacklevel=stacklevel + 1,
1238+
zarr_version=zarr_version,
1239+
)
12291240
if not stores:
12301241
ds = open_dataset(
12311242
filename_or_obj, group=parent, engine="zarr", **kwargs
12321243
)
12331244
return DataTree.from_dict({str(parent): ds})
12341245
else:
12351246
parent = NodePath("/")
1236-
stores = ZarrStore.open_store(filename_or_obj, group=parent)
1247+
stores = ZarrStore.open_store(
1248+
filename_or_obj,
1249+
group=parent,
1250+
mode=mode,
1251+
synchronizer=synchronizer,
1252+
consolidated=consolidated,
1253+
consolidate_on_close=False,
1254+
chunk_store=chunk_store,
1255+
storage_options=storage_options,
1256+
stacklevel=stacklevel + 1,
1257+
zarr_version=zarr_version,
1258+
)
12371259
ds = open_dataset(filename_or_obj, group=parent, engine="zarr", **kwargs)
12381260
tree_root = DataTree.from_dict({str(parent): ds})
12391261
for path_group, store in stores.items():

0 commit comments

Comments
 (0)