8000 Removed `raise ValueError` from previous commit · pydata/xarray@896f699 · GitHub
[go: up one dir, main page]

Skip to content

Commit 896f699

Browse files
committed
Removed raise ValueError from previous commit
It seems that np.min/max works in place of nanmin/nanmax for datetime types for numpy < 1.18, see https://github.com/pydata/xarray/pull/3924/files
1 parent 80e07cb commit 896f699

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

xarray/core/missing.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -554,13 +554,10 @@ def _localize(var, indexes_coords):
554554
if np.issubdtype(new_x.dtype, np.datetime64) and LooseVersion(
555555
np.__version__
556556
) < LooseVersion("1.18"):
557-
if new_x.isnull().any():
558-
raise ValueError(
559-
"numpy 1.18 or newer required to use interp with datetime/ timedelta array containing missing values"
560-
)
561-
else:
562-
minval = np.min(new_x.values)
563-
maxval = np.max(new_x.values)
557+
# np.nanmin/max changed behaviour for datetime types in numpy 1.18,
558+
# see https://github.com/pydata/xarray/pull/3924/files
559+
minval = np.min(new_x.values)
560+
maxval = np.max(new_x.values)
564561
else:
565562
minval = np.nanmin(new_x.values)
566563
maxval = np.nanmax(new_x.values)

0 commit comments

Comments
 (0)
0