Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion xray/core/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def _reindex_variables_against(variables, indexes, copy=False):
"""Reindex all DataArrays in the provided dict, leaving other values alone.
"""
alignable = [k for k, v in variables.items() if hasattr(v, 'indexes')]
aligned = [variables[a].reindex(copy=copy, indexes=indexes)
aligned = [variables[a].reindex(copy=copy, **indexes)
for a in alignable]
new_variables = OrderedDict(variables)
new_variables.update(zip(alignable, aligned))
Expand Down
9 changes: 9 additions & 0 deletions xray/test/test_dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,15 @@ def test_assign_coords(self):
expected.coords['d'] = ('x', [1.5, 1.5, 3.5, 3.5])
self.assertDataArrayIdentical(actual, expected)

def test_coords_alignment(self):
lhs = DataArray([1, 2, 3], [('x', [0, 1, 2])])
rhs = DataArray([2, 3, 4], [('x', [1, 2, 3])])
lhs.coords['rhs'] = rhs

expected = DataArray([1, 2, 3], coords={'rhs': ('x', [np.nan, 2, 3])},
dims='x')
self.assertDataArrayIdentical(lhs, expected)

def test_reindex(self):
foo = self.dv
bar = self.dv[:2, :2]
Expand Down