Skip to content

Commit

Permalink
zarr_version fixes
Browse files Browse the repository at this point in the history
* removed open_consolidated workarounds
* removed _store_version check
* pass through zarr_version
  • Loading branch information
TomAugspurger committed Sep 30, 2024
1 parent 636838c commit 9cfcc41
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions xarray/backends/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,30 +1436,14 @@ def _get_open_params(
if isinstance(store, os.PathLike):
store = os.fspath(store)

if zarr_version is None:
# default to 2 if store doesn't specify it's version (e.g. a path)
zarr_version = getattr(store, "_store_version", 2)

open_kwargs = dict(
# mode='a-' is a handcrafted xarray specialty
mode="a" if mode == "a-" else mode,
synchronizer=synchronizer,
path=group,
)
open_kwargs["storage_options"] = storage_options
if zarr_version > 2:
open_kwargs["zarr_version"] = zarr_version

if consolidated or consolidate_on_close:
raise ValueError(
"consolidated metadata has not been implemented for zarr "
f"version {zarr_version} yet. Set consolidated=False for "
f"zarr version {zarr_version}. See also "
"https://github.com/zarr-developers/zarr-specs/issues/136"
)

if consolidated is None:
consolidated = False
open_kwargs["zarr_format"] = zarr_version

if chunk_store is not None:
open_kwargs["chunk_store"] = chunk_store
Expand Down

0 comments on commit 9cfcc41

Please sign in to comment.