Skip to content

Commit

Permalink
Remove redundant check in IndexVariable (#8320)
Browse files Browse the repository at this point in the history
* IndexVariable can only  have pandasindexadapter

* Update variable.py
  • Loading branch information
Illviljan authored Oct 17, 2023
1 parent df0ddaf commit f895dc1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2787,13 +2787,7 @@ def copy(self, deep: bool = True, data: T_DuckArray | ArrayLike | None = None):
data copied from original.
"""
if data is None:
data_old = self._data

if not isinstance(data_old, indexing.MemoryCachedArray):
ndata = data_old
else:
# don't share caching between copies
ndata = indexing.MemoryCachedArray(data_old.array)
ndata = self._data

if deep:
ndata = copy.deepcopy(ndata, None)
Expand Down

0 comments on commit f895dc1

Please sign in to comment.