MCPcopy
hub / github.com/pydata/xarray / allclose_or_equiv

Function allclose_or_equiv

xarray/core/duck_array_ops.py:345–358  ·  view source on GitHub ↗

Like np.allclose, but also allows values to be NaN in both arrays

(arr1, arr2, rtol=1e-5, atol=1e-8)

Source from the content-addressed store, hash-verified

343
344
345def allclose_or_equiv(arr1, arr2, rtol=1e-5, atol=1e-8):
346 """Like np.allclose, but also allows values to be NaN in both arrays"""
347 arr1 = asarray(arr1)
348 arr2 = asarray(arr2)
349
350 lazy_equiv = lazy_array_equiv(arr1, arr2)
351 if lazy_equiv is None:
352 with warnings.catch_warnings():
353 warnings.filterwarnings("ignore", r"All-NaN (slice|axis) encountered")
354 return bool(
355 array_all(isclose(arr1, arr2, rtol=rtol, atol=atol, equal_nan=True))
356 )
357 else:
358 return lazy_equiv
359
360
361def array_equiv(arr1, arr2):

Callers

nothing calls this directly

Calls 3

asarrayFunction · 0.85
lazy_array_equivFunction · 0.85
array_allFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…