Skip to content

remove the compatibility code in duck_array_ops.allclose_or_equiv #4270

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

Merged
merged 1 commit into from
Jul 26, 2020
Merged
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
19 changes: 0 additions & 19 deletions xarray/core/duck_array_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import contextlib
import inspect
import warnings
from distutils.version import LooseVersion
from functools import partial

import numpy as np
Expand All @@ -21,14 +20,6 @@
except ImportError:
dask_array = None # type: ignore

# TODO: remove after we stop supporting dask < 2.9.1
try:
import dask

dask_version = dask.__version__
except ImportError:
dask_version = None


def _dask_or_eager_func(
name,
Expand Down Expand Up @@ -217,16 +208,6 @@ def allclose_or_equiv(arr1, arr2, rtol=1e-5, atol=1e-8):

lazy_equiv = lazy_array_equiv(arr1, arr2)
if lazy_equiv is None:
# TODO: remove after we require dask >= 2.9.1
sufficient_dask_version = (
dask_version is not None and LooseVersion(dask_version) >= "2.9.1"
)
if not sufficient_dask_version and any(
isinstance(arr, dask_array_type) for arr in [arr1, arr2]
):
arr1 = np.array(arr1)
arr2 = np.array(arr2)

return bool(isclose(arr1, arr2, rtol=rtol, atol=atol, equal_nan=True).all())
else:
return lazy_equiv
Expand Down