Skip to content

Commit

Permalink
Merge pull request #318 from headtr1ck/plugin
Browse files Browse the repository at this point in the history
Replace distutils.version
  • Loading branch information
iainrussell authored Nov 1, 2022
2 parents 8578f10 + b8c0904 commit a317a88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog for cfgrib
====================

0.9.10.3 (2022-xx-xx)
---------------------

- Replaced ``distutils.version`` py ``packaging.version`` and
added description and url to the xarray plugin.
See `#318 <https://github.com/ecmwf/cfgrib/pull/318/>`_.


0.9.10.2 (2022-10-04)
---------------------

Expand Down
11 changes: 7 additions & 4 deletions cfgrib/xarray_plugin.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import os
import pathlib
import typing as T
from distutils.version import LooseVersion

import numpy as np
import xarray as xr
from packaging.version import Version

from . import abc, dataset, messages

if LooseVersion(xr.__version__) <= "0.17.0":
if Version(xr.__version__) <= Version("0.17.0"):
raise ImportError("xarray_plugin module needs xarray version >= 0.18+")

from xarray.backends.common import AbstractDataStore, BackendArray, BackendEntrypoint

from . import abc, dataset, messages

# FIXME: Add a dedicated lock, even if ecCodes is supposed to be thread-safe
# in most circumstances. See:
# https://confluence.ecmwf.int/display/ECC/Frequently+Asked+Questions
Expand Down Expand Up @@ -71,6 +71,9 @@ def get_encoding(self) -> T.Dict[str, T.Set[str]]:


class CfGribBackend(BackendEntrypoint):
description = "Open GRIB files (.grib, .grib2, .grb and .grb2) in Xarray"
url = "https://github.com/ecmwf/cfgrib"

def guess_can_open(
self,
store_spec: str,
Expand Down

0 comments on commit a317a88

Please sign in to comment.