File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -1607,6 +1607,9 @@ def open_mfdataset(
1607
1607
1608
1608
paths1d : list [str | ReadBuffer ]
1609
1609
if combine == "nested" :
1610
+ if isinstance (concat_dim , str | DataArray ) or concat_dim is None :
1611
+ concat_dim = [concat_dim ] # type: ignore[assignment]
1612
+
1610
1613
# This creates a flat list which is easier to iterate over, whilst
1611
1614
# encoding the originally-supplied structure as "ids".
1612
1615
# The "ids" are not used at all if combine='by_coords`.
@@ -1655,7 +1658,7 @@ def open_mfdataset(
1655
1658
# along each dimension, using structure given by "ids"
1656
1659
combined = _nested_combine (
1657
1660
datasets ,
1658
- concat_dim = concat_dim ,
1661
+ concat_dims = concat_dim ,
1659
1662
compat = compat ,
1660
1663
data_vars = data_vars ,
1661
1664
coords = coords ,
Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ def _new_tile_id(single_id_ds_pair):
352
352
353
353
def _nested_combine (
354
354
datasets ,
355
- concat_dim ,
355
+ concat_dims ,
356
356
compat ,
357
357
data_vars ,
358
358
coords ,
@@ -364,9 +364,6 @@ def _nested_combine(
364
364
if len (datasets ) == 0 :
365
365
return Dataset ()
366
366
367
- if isinstance (concat_dim , str | DataArray ) or concat_dim is None :
368
- concat_dim = [concat_dim ]
369
-
370
367
# Arrange datasets for concatenation
371
368
# Use information from the shape of the user input
372
369
if not ids :
@@ -383,7 +380,7 @@ def _nested_combine(
383
380
# Apply series of concatenate or merge operations along each dimension
384
381
combined = _combine_nd (
385
382
combined_ids ,
386
- concat_dims = concat_dim ,
383
+ concat_dims = concat_dims ,
387
384
compat = compat ,
388
385
data_vars = data_vars ,
389
386
coords = coords ,
@@ -598,10 +595,13 @@ def combine_nested(
598
595
if mixed_datasets_and_arrays :
599
596
raise ValueError ("Can't combine datasets with unnamed arrays." )
600
597
598
+ if isinstance (concat_dim , str | DataArray ) or concat_dim is None :
599
+ concat_dim = [concat_dim ]
600
+
601
601
# The IDs argument tells _nested_combine that datasets aren't yet sorted
602
602
return _nested_combine (
603
603
datasets ,
604
- concat_dim = concat_dim ,
604
+ concat_dims = concat_dim ,
605
605
compat = compat ,
606
606
data_vars = data_vars ,
607
607
coords = coords ,
You can’t perform that action at this time.
0 commit comments