Skip to content

Commit

Permalink
Merge branch 'main' into move-co-var-rr
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty authored Oct 17, 2023
2 parents 5c7f036 + f895dc1 commit 892a8c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 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
4 changes: 2 additions & 2 deletions xarray/tests/test_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def add_one(a, core_dims, on_missing_core_dim):

# `raise` — should raise on a missing dim
with pytest.raises(ValueError):
add_one(ds, core_dims=[["y"]], on_missing_core_dim="raise"),
add_one(ds, core_dims=[["y"]], on_missing_core_dim="raise")

# `drop` — should drop the var with the missing dim
assert_identical(
Expand Down Expand Up @@ -1249,7 +1249,7 @@ def check(x, y):
assert actual.data.chunks == array.chunks
assert_identical(data_array, actual)

check(data_array, 0),
check(data_array, 0)
check(0, data_array)
check(data_array, xr.DataArray(0))
check(data_array, 0 * data_array)
Expand Down

0 comments on commit 892a8c8

Please sign in to comment.