Skip to content

Commit

Permalink
deprecate pynio backend (#7301)
Browse files Browse the repository at this point in the history
* deprecate pynio backend

* add whats new

* use DeprecationWarning
  • Loading branch information
jhamman authored Nov 26, 2022
1 parent 8953df7 commit fb42ef9
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 10 deletions.
1 change: 0 additions & 1 deletion ci/requirements/all-but-dask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies:
- pip
- pseudonetcdf
- pydap
# - pynio # not compatible with netCDF4>1.5.3, see #4491
- pytest
- pytest-cov
- pytest-env
Expand Down
1 change: 0 additions & 1 deletion ci/requirements/environment-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies:
- pre-commit
- pseudonetcdf
- pydap
# - pynio # Not available on Windows
- pytest
- pytest-cov
- pytest-env
Expand Down
1 change: 0 additions & 1 deletion ci/requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dependencies:
- pre-commit
- pseudonetcdf
- pydap
# - pynio # not compatible with netCDF4>1.5.3, see #4491
- pytest
- pytest-cov
- pytest-env
Expand Down
1 change: 0 additions & 1 deletion ci/requirements/min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ dependencies:
- pip
- pseudonetcdf=3.2
- pydap=3.2
# - pynio=1.5.5 # see: https://github.com/pydata/xarray/issues/4491
- pytest
- pytest-cov
- pytest-env
Expand Down
11 changes: 6 additions & 5 deletions doc/user-guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,10 @@ We recommend installing cfgrib via conda::
Formats supported by PyNIO
--------------------------

.. warning::

The PyNIO backend is deprecated_. PyNIO is no longer maintained_. See

Xarray can also read GRIB, HDF4 and other file formats supported by PyNIO_,
if PyNIO is installed. To use PyNIO to read such files, supply
``engine='pynio'`` to :py:func:`open_dataset`.
Expand All @@ -1217,12 +1221,9 @@ We recommend installing PyNIO via conda::

conda install -c conda-forge pynio

.. warning::

PyNIO is no longer actively maintained and conflicts with netcdf4 > 1.5.3.
The PyNIO backend may be moved outside of xarray in the future.

.. _PyNIO: https://www.pyngl.ucar.edu/Nio.shtml
.. _deprecated: https://github.com/pydata/xarray/issues/4491
.. _maintained: https://github.com/NCAR/pynio/issues/53

.. _io.PseudoNetCDF:

Expand Down
3 changes: 2 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Breaking changes

Deprecations
~~~~~~~~~~~~

- The PyNIO backend has been deprecated (:issue:`4491`, :pull:`7301`).
By `Joe Hamman <https://github.com/jhamman>`_.

Bug fixes
~~~~~~~~~
Expand Down
17 changes: 17 additions & 0 deletions xarray/backends/pynio_.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import warnings

import numpy as np

from ..core import indexing
Expand Down Expand Up @@ -55,6 +57,12 @@ class NioDataStore(AbstractDataStore):
def __init__(self, filename, mode="r", lock=None, **kwargs):
import Nio

warnings.warn(
"The PyNIO backend is Deprecated and will be removed from Xarray in a future release. "
"See https://github.com/pydata/xarray/issues/4491 for more information",
DeprecationWarning,
)

if lock is None:
lock = PYNIO_LOCK
self.lock = ensure_lock(lock)
Expand Down Expand Up @@ -94,6 +102,15 @@ def close(self):


class PynioBackendEntrypoint(BackendEntrypoint):
"""
PyNIO backend
.. deprecated:: 0.20.0
Deprecated as PyNIO is no longer supported. See
https://github.com/pydata/xarray/issues/4491 for more information
"""

available = module_available("Nio")

def open_dataset(
Expand Down

0 comments on commit fb42ef9

Please sign in to comment.