Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace distutils.version #318

Merged
merged 6 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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