Skip to content

align: Avoid reindexing when join="exact" #7736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 12, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions xarray/core/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,15 @@ def _reindex_one(
return new_obj

def reindex_all(self) -> None:
self.results = tuple(
self._reindex_one(obj, matching_indexes)
for obj, matching_indexes in zip(
self.objects, self.objects_matching_indexes
if self.join == "exact" and not self.copy:
self.results = self.objects
else:
self.results = tuple(
self._reindex_one(obj, matching_indexes)
for obj, matching_indexes in zip(
self.objects, self.objects_matching_indexes
)
)
)

def align(self) -> None:
if not self.indexes and len(self.objects) == 1:
Expand Down