Skip to content

Commit

Permalink
Removed raise ValueError from previous commit
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jenssss committed Aug 25, 2020
1 parent 80e07cb commit 896f699
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions xarray/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,10 @@ def _localize(var, indexes_coords):
if np.issubdtype(new_x.dtype, np.datetime64) and LooseVersion(
np.__version__
) < LooseVersion("1.18"):
if new_x.isnull().any():
raise ValueError(
"numpy 1.18 or newer required to use interp with datetime/ timedelta array containing missing values"
)
else:
minval = np.min(new_x.values)
maxval = np.max(new_x.values)
# np.nanmin/max changed behaviour for datetime types in numpy 1.18,
# see https://github.com/pydata/xarray/pull/3924/files
minval = np.min(new_x.values)
maxval = np.max(new_x.values)
else:
minval = np.nanmin(new_x.values)
maxval = np.nanmax(new_x.values)
Expand Down

0 comments on commit 896f699

Please sign in to comment.