Skip to content

Commit

Permalink
Check for minimum Zarr version.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaipak committed Mar 3, 2018
1 parent a32475b commit 330d029
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions xarray/backends/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from base64 import b64encode
from itertools import product
from distutils.version import LooseVersion

import numpy as np

Expand Down Expand Up @@ -271,6 +272,14 @@ class ZarrStore(AbstractWritableDataStore):
def open_group(cls, store, mode='r', synchronizer=None, group=None,
writer=None):
import zarr
min_zarr = '2.2'

if LooseVersion(zarr.__version__) < min_zarr:
raise NotImplementedError("Zarr version %s or greater is "
"required by xarray. See zarr "
"installation "
"http://zarr.readthedocs.io/en/stable/"
"#installation" % min_zarr)
zarr_group = zarr.open_group(store=store, mode=mode,
synchronizer=synchronizer, path=group)
return cls(zarr_group, writer=writer)
Expand Down

0 comments on commit 330d029

Please sign in to comment.