Skip to content

Commit 7979079

Browse files
dcherianbenbovy
andauthored
Apply suggestions from code review
Co-authored-by: Benoit Bovy <benbovy@gmail.com>
1 parent a996655 commit 7979079

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

xarray/structure/concat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def _calc_concat_over(datasets, dim, dim_names, data_vars: T_DataVars, coords, c
329329
# variables checked for equality
330330
equals = {}
331331
# skip merging these variables.
332-
# if concatenating over a dimension 'x' that is associated with an indexo ver 2 variables,
332+
# if concatenating over a dimension 'x' that is associated with an index over 2 variables,
333333
# 'x' and 'y', then we assert join="equals" on `y` and don't need to merge it.
334334
# that assertion happens in the align step prior to this function being called
335335
skip_merge = set()
@@ -347,9 +347,9 @@ def _calc_concat_over(datasets, dim, dim_names, data_vars: T_DataVars, coords, c
347347
if dim in ds:
348348
ds = ds.set_coords(dim)
349349
concat_over.update(k for k, v in ds.variables.items() if dim in v.dims)
350-
for index, idx_coords in ds.xindexes.group_by_index():
351-
if dim in idx_coords:
352-
skip_merge.update(idx_coords.keys())
350+
for _, idx_vars in ds.xindexes.group_by_index():
351+
if any(dim in v.dims for v in idx_vars.values()):
352+
skip_merge.update(idx_vars.keys())
353353
concat_dim_lengths.append(ds.sizes.get(dim, 1))
354354

355355
def process_subset_opt(opt, subset):

0 commit comments

Comments
 (0)