Skip to content

Commit

Permalink
align: Avoid reindexing when join="exact" (#7736)
Browse files Browse the repository at this point in the history
* align: Avoid reindexing when join="exact"

xref #7730

* Aligner.copy always copies ecen with join="exact"

* Move logic to Aligner.align

* Add whats-new
  • Loading branch information
dcherian authored Apr 12, 2023
1 parent db2d414 commit 67ff171
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ Breaking changes
Deprecations
~~~~~~~~~~~~

Performance
~~~~~~~~~~~
- Optimize alignment with ``join="exact", copy=False`` by avoiding copies. (:pull:`7736`)
By `Deepak Cherian <https://github.com/dcherian>`_.
- Avoid unnecessary copies of ``CFTimeIndex``. (:pull:`7735`)
By `Deepak Cherian <https://github.com/dcherian>`_.

Bug fixes
~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions xarray/core/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ def align(self) -> None:

if self.join == "override":
self.override_indexes()
elif self.join == "exact" and not self.copy:
self.results = self.objects
else:
self.reindex_all()

Expand Down

0 comments on commit 67ff171

Please sign in to comment.