4
4
from io import BytesIO
5
5
from numbers import Number
6
6
from pathlib import Path
7
- from textwrap import dedent
8
7
from typing import (
9
8
TYPE_CHECKING ,
10
9
Callable ,
23
22
from ..core .combine import (
24
23
_infer_concat_order_from_positions ,
25
24
_nested_combine ,
26
- auto_combine ,
27
25
combine_by_coords ,
28
26
)
29
27
from ..core .dataarray import DataArray
@@ -726,14 +724,14 @@ def close(self):
726
724
def open_mfdataset (
727
725
paths ,
728
726
chunks = None ,
729
- concat_dim = "_not_supplied" ,
727
+ concat_dim = None ,
730
728
compat = "no_conflicts" ,
731
729
preprocess = None ,
732
730
engine = None ,
733
731
lock = None ,
734
732
data_vars = "all" ,
735
733
coords = "different" ,
736
- combine = "_old_auto " ,
734
+ combine = "by_coords " ,
737
735
autoclose = None ,
738
736
parallel = False ,
739
737
join = "outer" ,
@@ -746,9 +744,8 @@ def open_mfdataset(
746
744
the datasets into one before returning the result, and if combine='nested' then
747
745
``combine_nested`` is used. The filepaths must be structured according to which
748
746
combining function is used, the details of which are given in the documentation for
749
- ``combine_by_coords`` and ``combine_nested``. By default the old (now deprecated)
750
- ``auto_combine`` will be used, please specify either ``combine='by_coords'`` or
751
- ``combine='nested'`` in future. Requires dask to be installed. See documentation for
747
+ ``combine_by_coords`` and ``combine_nested``. By default ``combine='by_coords'``
748
+ will be used. Requires dask to be installed. See documentation for
752
749
details on dask [1]_. Global attributes from the ``attrs_file`` are used
753
750
for the combined dataset.
754
751
@@ -758,7 +755,7 @@ def open_mfdataset(
758
755
Either a string glob in the form ``"path/to/my/files/*.nc"`` or an explicit list of
759
756
files to open. Paths can be given as strings or as pathlib Paths. If
760
757
concatenation along more than one dimension is desired, then ``paths`` must be a
761
- nested list-of-lists (see ``manual_combine `` for details). (A string glob will
758
+ nested list-of-lists (see ``combine_nested `` for details). (A string glob will
762
759
be expanded to a 1-dimensional list.)
763
760
chunks : int or dict, optional
764
761
Dictionary with keys given by dimension names and values given by chunk sizes.
@@ -768,15 +765,16 @@ def open_mfdataset(
768
765
see the full documentation for more details [2]_.
769
766
concat_dim : str, or list of str, DataArray, Index or None, optional
770
767
Dimensions to concatenate files along. You only need to provide this argument
771
- if any of the dimensions along which you want to concatenate is not a dimension
772
- in the original datasets, e.g., if you want to stack a collection of 2D arrays
773
- along a third dimension. Set ``concat_dim=[..., None, ...]`` explicitly to
774
- disable concatenation along a particular dimension.
768
+ if ``combine='by_coords'``, and if any of the dimensions along which you want to
769
+ concatenate is not a dimension in the original datasets, e.g., if you want to
770
+ stack a collection of 2D arrays along a third dimension. Set
771
+ ``concat_dim=[..., None, ...]`` explicitly to disable concatenation along a
772
+ particular dimension. Default is None, which for a 1D list of filepaths is
773
+ equivalent to opening the files separately and then merging them with
774
+ ``xarray.merge``.
775
775
combine : {'by_coords', 'nested'}, optional
776
776
Whether ``xarray.combine_by_coords`` or ``xarray.combine_nested`` is used to
777
- combine all the data. If this argument is not provided, `xarray.auto_combine` is
778
- used, but in the future this behavior will switch to use
779
- `xarray.combine_by_coords` by default.
777
+ combine all the data. Default is to use ``xarray.combine_by_coords``.
780
778
compat : {'identical', 'equals', 'broadcast_equals',
781
779
'no_conflicts', 'override'}, optional
782
780
String indicating how to compare variables of the same name for
@@ -869,7 +867,6 @@ def open_mfdataset(
869
867
--------
870
868
combine_by_coords
871
869
combine_nested
872
- auto_combine
873
870
open_dataset
874
871
875
872
References
@@ -897,11 +894,8 @@ def open_mfdataset(
897
894
# If combine='nested' then this creates a flat list which is easier to
898
895
# iterate over, while saving the originally-supplied structure as "ids"
899
896
if combine == "nested" :
900
- if str (concat_dim ) == "_not_supplied" :
901
- raise ValueError ("Must supply concat_dim when using " "combine='nested'" )
902
- else :
903
- if isinstance (concat_dim , (str , DataArray )) or concat_dim is None :
904
- concat_dim = [concat_dim ]
897
+ if isinstance (concat_dim , (str , DataArray )) or concat_dim is None :
898
+ concat_dim = [concat_dim ]
905
899
combined_ids_paths = _infer_concat_order_from_positions (paths )
906
900
ids , paths = (list (combined_ids_paths .keys ()), list (combined_ids_paths .values ()))
907
901
@@ -933,30 +927,7 @@ def open_mfdataset(
933
927
934
928
# Combine all datasets, closing them in case of a ValueError
935
929
try :
936
- if combine == "_old_auto" :
937
- # Use the old auto_combine for now
938
- # Remove this after deprecation cycle from #2616 is complete
939
- basic_msg = dedent (
940
- """\
941
- In xarray version 0.15 the default behaviour of `open_mfdataset`
942
- will change. To retain the existing behavior, pass
943
- combine='nested'. To use future default behavior, pass
944
- combine='by_coords'. See
945
- http://xarray.pydata.org/en/stable/combining.html#combining-multi
946
- """
947
- )
948
- warnings .warn (basic_msg , FutureWarning , stacklevel = 2 )
949
-
950
- combined = auto_combine (
951
- datasets ,
952
- concat_dim = concat_dim ,
953
- compat = compat ,
954
- data_vars = data_vars ,
955
- coords = coords ,
956
- join = join ,
957
- from_openmfds = True ,
958
- )
959
- elif combine == "nested" :
930
+ if combine == "nested" :
960
931
# Combined nested list by successive concat and merge operations
961
932
# along each dimension, using structure given by "ids"
962
933
combined = _nested_combine (
0 commit comments