Skip to content

Commit

Permalink
Check for minimum Zarr version. (pydata#1960)
Browse files Browse the repository at this point in the history
* Check for minimum Zarr version.

ws

* Exclude version check from coverage.

additional ws.
  • Loading branch information
kaipak authored and Joe Hamman committed Mar 6, 2018
1 parent 3419e9e commit 55128aa
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: # pragma: no cover
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 55128aa

Please sign in to comment.