Skip to content

Conversation

@benbovy
Copy link
Member

@benbovy benbovy commented Feb 21, 2025

  • Index.isel: more permissive return type (any Xarray Index)

This allows an index to return a new index of another type, e.g., a
1-dimensional CoordinateTransformIndex to return a PandasIndex when a
new transform cannot be computed (selection at arbitrary locations).

  • Index.equals: more permissive other type (any Xarray Index)

Xarray alignment logic is such that Xarray indexes are always compared
with other indexes of the same type. However, this is not necessarily
the case for "meta" indexes (i.e., indexes encapsulating one or more
index objects that may have another type) that are dispatching equals
to their wrapped indexes.

More context and concrete examples in corteva/rioxarray#846 (comment) and corteva/rioxarray#846 (comment).

This allows an index to return a new index of another type, e.g., a
1-dimensional CoordinateTransformIndex to return a PandasIndex when a
new transform cannot be computed (selection at arbitrary locations).
Xarray alignment logic is such that Xarray indexes are always compared
with other indexes of the same type. However, this is not necessarily
the case for "meta" indexes (i.e., indexes encapsulating one or more
index objects that may have another type) that are dispatching `equals`
to their wrapped indexes.
@benbovy benbovy mentioned this pull request Feb 21, 2025
9 tasks
@benbovy benbovy merged commit df33a9a into pydata:main Feb 24, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants