From 0b3fd9ee751f64b9695609a601ae31b336c1e0a0 Mon Sep 17 00:00:00 2001 From: Benoit Bovy Date: Tue, 24 Sep 2024 22:13:40 +0200 Subject: [PATCH] sel: add todo note about rounding decimal pos --- xarray/core/indexes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xarray/core/indexes.py b/xarray/core/indexes.py index ab725f8683..987039e1f8 100644 --- a/xarray/core/indexes.py +++ b/xarray/core/indexes.py @@ -1476,6 +1476,9 @@ def sel( results = {} dims0 = tuple(dim_size0) for dim, pos in dim_positions.items(): + # TODO: rounding the decimal positions is not always the behavior we expect + # (there are different ways to represent implicit intervals) + # we should probably make this customizable. pos = np.round(pos).astype("int") if isinstance(label0_obj, Variable): xr_pos = Variable(dims0, pos)