Skip to content

Commit

Permalink
Clarify index inference condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Feb 26, 2019
1 parent 97ac4a6 commit e0ae758
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xarray/core/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,11 @@ def _dataarray_concat(arrays, dim, data_vars, coords, compat,
)
datasets = [arr.rename(name)._to_temp_dataset() for arr in arrays]

if isinstance(dim, str) and len(set(names) - {None}) == len(names) \
and not any(dim in a.dims or dim in a.coords for a in arrays):
if (
isinstance(dim, str)
and len(set(names) - {None}) == len(names)
and not any(dim in a.dims or dim in a.coords for a in arrays
):
# We're concatenating arrays with unique non-None names along
# a new dimension, so we use the existing names as coordinates.
dim = pd.Index(names, name=dim)
Expand Down

0 comments on commit e0ae758

Please sign in to comment.