(self)
| 1209 | assert_equal(actual, expected) |
| 1210 | |
| 1211 | def test_sel_float_multiindex(self) -> None: |
| 1212 | # regression test https://github.com/pydata/xarray/issues/5691 |
| 1213 | # test multi-index created from coordinates, one with dtype=float32 |
| 1214 | lvl1 = ["a", "a", "b", "b"] |
| 1215 | lvl2 = np.array([0.1, 0.2, 0.3, 0.4], dtype=np.float32) |
| 1216 | da = xr.DataArray( |
| 1217 | [1, 2, 3, 4], dims="x", coords={"lvl1": ("x", lvl1), "lvl2": ("x", lvl2)} |
| 1218 | ) |
| 1219 | da = da.set_index(x=["lvl1", "lvl2"]) |
| 1220 | |
| 1221 | actual = da.sel(lvl1="a", lvl2=0.1) |
| 1222 | expected = da.isel(x=0) |
| 1223 | |
| 1224 | assert_equal(actual, expected) |
| 1225 | |
| 1226 | def test_sel_no_index(self) -> None: |
| 1227 | array = DataArray(np.arange(10), dims="x").assign_coords( |
nothing calls this directly
no test coverage detected