Open dcherian opened 3 months ago
I think this occurs in the case of fancy indexing of an xarray object (i.e., provide another DataArray as indexer argument to isel
) where the same coordinate name is found in both the indexed object and the indexer.
Remove the name conflict and it works fine, e.g.,
xr.align(d, m.rename(x="w").isel(w=d.x))
In such case, the coordinate in the indexer should probably be passed to the result instead of the one found in the indexed object (not the current behavior, although I haven't checked how the coordinates are merged in the result).
What happened?
From https://github.com/pydata/xarray/discussions/8951
if
d
is a MultiIndex-ed dataset with levels(x, y, z)
, andm
is a dataset with a single coordx
m.isel(x=d.x)
builds a dataset with a MultiIndex with levels(y, z)
. This seems like it should work.cc @benbovy
What did you expect to happen?
No response
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
No response
Anything else we need to know?
No response
Environment