We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 50f8726 commit faa6345Copy full SHA for faa6345
xarray/core/missing.py
@@ -553,11 +553,11 @@ def _localize(var, indexes_coords):
553
"""
554
indexes = {}
555
for dim, [x, new_x] in indexes_coords.items():
556
- minval = np.nanmin(new_x.values)
557
- maxval = np.nanmax(new_x.values)
+ new_x_loaded = new_x.values
+ minval = np.nanmin(new_x_loaded)
558
+ maxval = np.nanmax(new_x_loaded)
559
index = x.to_index()
- imin = index.get_indexer([minval], method="nearest").item()
560
- imax = index.get_indexer([maxval], method="nearest").item()
+ imin, imax = index.get_indexer([minval, maxval], method="nearest")
561
indexes[dim] = slice(max(imin - 2, 0), imax + 2)
562
indexes_coords[dim] = (x[indexes[dim]], new_x)
563
return var.isel(**indexes), indexes_coords
0 commit comments