Skip to content

Commit b9f40cc

Browse files
fujiisoupshoyer
authored andcommitted
Fix a bug introduced in #2087 (#2100)
* Bugfix introduced by #2087 * flake8 * Remove trailing whitespaces
1 parent 0cc64a0 commit b9f40cc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

xarray/core/merge.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def dataset_update_method(dataset, other):
561561
coord_names = [c for c in obj.coords
562562
if c not in obj.dims and c in dataset.coords]
563563
if coord_names:
564-
other[k] = obj.drop(*coord_names)
564+
other[k] = obj.drop(coord_names)
565565

566566
return merge_core([dataset, other], priority_arg=1,
567567
indexes=dataset.indexes)

xarray/tests/test_dataset.py

+7
Original file line numberDiff line numberDiff line change
@@ -2366,6 +2366,13 @@ def test_setitem_with_coords(self):
23662366
actual['numbers'] = other
23672367
assert actual['numbers'][0] == 10
23682368

2369+
# GH: 2099
2370+
ds = Dataset({'var': ('x', [1, 2, 3])},
2371+
coords={'x': [0, 1, 2], 'z1': ('x', [1, 2, 3]),
2372+
'z2': ('x', [1, 2, 3])})
2373+
ds['var'] = ds['var'] * 2
2374+
assert np.allclose(ds['var'], [2, 4, 6])
2375+
23692376
def test_setitem_align_new_indexes(self):
23702377
ds = Dataset({'foo': ('x', [1, 2, 3])}, {'x': [0, 1, 2]})
23712378
ds['bar'] = DataArray([2, 3, 4], [('x', [1, 2, 3])])

0 commit comments

Comments
 (0)