diff --git a/doc/whats-new.rst b/doc/whats-new.rst index c8f3a40e87f..e4ffc5ca799 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -47,6 +47,9 @@ Bug fixes date "0001-01-01". (:issue:`9108`, :pull:`9116`) By `Spencer Clark `_ and `Deepak Cherian `_. +- Fix issue with passing parameters to ZarrStore.open_store when opening + datatree in zarr format (:issue:`9376`, :pull:`9377`). + By `Alfonso Ladino `_ Documentation ~~~~~~~~~~~~~ diff --git a/xarray/backends/zarr.py b/xarray/backends/zarr.py index 0da056e8ad2..242507f9c20 100644 --- a/xarray/backends/zarr.py +++ b/xarray/backends/zarr.py @@ -1225,7 +1225,18 @@ def open_datatree( filename_or_obj = _normalize_path(filename_or_obj) if group: parent = NodePath("/") / NodePath(group) - stores = ZarrStore.open_store(filename_or_obj, group=parent) + stores = ZarrStore.open_store( + filename_or_obj, + group=parent, + mode=mode, + synchronizer=synchronizer, + consolidated=consolidated, + consolidate_on_close=False, + chunk_store=chunk_store, + storage_options=storage_options, + stacklevel=stacklevel + 1, + zarr_version=zarr_version, + ) if not stores: ds = open_dataset( filename_or_obj, group=parent, engine="zarr", **kwargs @@ -1233,7 +1244,18 @@ def open_datatree( return DataTree.from_dict({str(parent): ds}) else: parent = NodePath("/") - stores = ZarrStore.open_store(filename_or_obj, group=parent) + stores = ZarrStore.open_store( + filename_or_obj, + group=parent, + mode=mode, + synchronizer=synchronizer, + consolidated=consolidated, + consolidate_on_close=False, + chunk_store=chunk_store, + storage_options=storage_options, + stacklevel=stacklevel + 1, + zarr_version=zarr_version, + ) ds = open_dataset(filename_or_obj, group=parent, engine="zarr", **kwargs) tree_root = DataTree.from_dict({str(parent): ds}) for path_group, store in stores.items():