Skip to content

Commit e38ca0f

Browse files
dcherianmax-sixty
authored andcommitted
Remove deprecated concat kwargs. (#3288)
1 parent 9e1c690 commit e38ca0f

File tree

3 files changed

+5
-43
lines changed

3 files changed

+5
-43
lines changed

doc/whats-new.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ Breaking changes
3030
By `Maximilian Roos <https://github.com/max-sixty>`_
3131
- The ``inplace`` kwarg for public methods now raises an error, having been deprecated
3232
since v0.11.0.
33-
By `Maximilian Roos <https://github.com/max-sixty>`_
33+
By `Maximilian Roos <https://github.com/max-sixty>`_
34+
- :py:func:`~xarray.concat` now requires the ``dim`` argument. Its ``indexers``, ``mode``
35+
and ``concat_over`` kwargs have now been removed.
36+
By `Deepak Cherian <https://github.com/dcherian>`_
3437
- Most xarray objects now define ``__slots__``. This reduces overall RAM usage by ~22%
3538
(not counting the underlying numpy buffers); on CPython 3.7/x64, a trivial DataArray
3639
has gone down from 1.9kB to 1.5kB.

xarray/core/concat.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import warnings
21
from collections import OrderedDict
32

43
import pandas as pd
@@ -11,14 +10,11 @@
1110

1211
def concat(
1312
objs,
14-
dim=None,
13+
dim,
1514
data_vars="all",
1615
coords="different",
1716
compat="equals",
1817
positions=None,
19-
indexers=None,
20-
mode=None,
21-
concat_over=None,
2218
fill_value=dtypes.NA,
2319
join="outer",
2420
):
@@ -111,38 +107,6 @@ def concat(
111107
except StopIteration:
112108
raise ValueError("must supply at least one object to concatenate")
113109

114-
if dim is None:
115-
warnings.warn(
116-
"the `dim` argument to `concat` will be required "
117-
"in a future version of xarray; for now, setting it to "
118-
"the old default of 'concat_dim'",
119-
FutureWarning,
120-
stacklevel=2,
121-
)
122-
dim = "concat_dims"
123-
124-
if indexers is not None: # pragma: no cover
125-
warnings.warn(
126-
"indexers has been renamed to positions; the alias "
127-
"will be removed in a future version of xarray",
128-
FutureWarning,
129-
stacklevel=2,
130-
)
131-
positions = indexers
132-
133-
if mode is not None:
134-
raise ValueError(
135-
"`mode` is no longer a valid argument to "
136-
"xarray.concat; it has been split into the "
137-
"`data_vars` and `coords` arguments"
138-
)
139-
if concat_over is not None:
140-
raise ValueError(
141-
"`concat_over` is no longer a valid argument to "
142-
"xarray.concat; it has been split into the "
143-
"`data_vars` and `coords` arguments"
144-
)
145-
146110
if isinstance(first_obj, DataArray):
147111
f = _dataarray_concat
148112
elif isinstance(first_obj, Dataset):

xarray/tests/test_concat.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,6 @@ def test_concat_errors(self):
163163
with raises_regex(ValueError, "coordinate in some datasets but not others"):
164164
concat([Dataset({"x": 0}), Dataset({}, {"x": 1})], dim="z")
165165

166-
with raises_regex(ValueError, "no longer a valid"):
167-
concat([data, data], "new_dim", mode="different")
168-
with raises_regex(ValueError, "no longer a valid"):
169-
concat([data, data], "new_dim", concat_over="different")
170-
171166
def test_concat_join_kwarg(self):
172167
ds1 = Dataset({"a": (("x", "y"), [[0]])}, coords={"x": [0], "y": [0]})
173168
ds2 = Dataset({"a": (("x", "y"), [[0]])}, coords={"x": [1], "y": [0.0001]})

0 commit comments

Comments
 (0)