You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
copy of custom index does not align with original #7162
I don't think there is anything wrong with the deep copy implementation. Only before it was not deep copying the indexes and now it is.
Can you check if index1.equals(index2) works if they are created the same?
Now that I think about it, Indexes.copy_indexes might also require some update that includes the memo argument.
But not sure if that will solve the issue here.
Indexes.copy_indexes might also require some update that includes the memo argument. But not sure if that will solve the issue here.
That's a possible cause. Alignment may fail early because .xindexes returns different mappings of coordinates vs. index objects. It's worth checking if after copying the dataset, copy.xindexes returns the same CRSIndex object for its "x", "y" and "spatial_ref" coordinates.
EDIT: checking copy.xindexes.group_by_index() is more convenient.
Activity
headtr1ck commentedon Oct 14, 2022
I don't think there is anything wrong with the deep copy implementation. Only before it was not deep copying the indexes and now it is.
Can you check if
index1.equals(index2)works if they are created the same?headtr1ck commentedon Oct 15, 2022
Now that I think about it,
Indexes.copy_indexesmight also require some update that includes thememoargument.But not sure if that will solve the issue here.
benbovy commentedon Oct 18, 2022
That's a possible cause. Alignment may fail early because
.xindexesreturns different mappings of coordinates vs. index objects. It's worth checking if after copying the dataset,copy.xindexesreturns the same CRSIndex object for its "x", "y" and "spatial_ref" coordinates.EDIT: checking
copy.xindexes.group_by_index()is more convenient.benbovy commentedon Oct 18, 2022
The refactored alignment logic could be improved (cf. #7002). The error raised in the method below is not very helpful.
xarray/xarray/core/alignment.py
Lines 294 to 333 in ab726c5
headtr1ck commentedon Oct 25, 2022
Could you create a MVCE without a custom index that I can use for debugging?
scottyhq commentedon Mar 24, 2023
Reviving this exploration with
xarray : 2023.3.0and I'm no longer seeing the traceback linked above, so I think this can be closedOriginal traceback from
xr.align(copy, newds), which now succeeds:`File ~/mambaforge/envs/xarray-release/lib/python3.10/site-packages/xarray/core/indexes.py:490, in PandasIndex.equals(self, other) 488 if not isinstance(other, PandasIndex): 489 return False --> 490 return self.index.equals(other.index) and self.dim == other.dim AttributeError: 'PandasIndex' object has no attribute 'index'dcherian commentedon Mar 24, 2023
Thanks @scottyhq