Skip to content

Commit

Permalink
Remove deprecated concat kwargs. (#3288)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian authored and max-sixty committed Sep 9, 2019
1 parent 9e1c690 commit e38ca0f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 43 deletions.
5 changes: 4 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ Breaking changes
By `Maximilian Roos <https://github.com/max-sixty>`_
- The ``inplace`` kwarg for public methods now raises an error, having been deprecated
since v0.11.0.
By `Maximilian Roos <https://github.com/max-sixty>`_
By `Maximilian Roos <https://github.com/max-sixty>`_
- :py:func:`~xarray.concat` now requires the ``dim`` argument. Its ``indexers``, ``mode``
and ``concat_over`` kwargs have now been removed.
By `Deepak Cherian <https://github.com/dcherian>`_
- Most xarray objects now define ``__slots__``. This reduces overall RAM usage by ~22%
(not counting the underlying numpy buffers); on CPython 3.7/x64, a trivial DataArray
has gone down from 1.9kB to 1.5kB.
Expand Down
38 changes: 1 addition & 37 deletions xarray/core/concat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from collections import OrderedDict

import pandas as pd
Expand All @@ -11,14 +10,11 @@

def concat(
objs,
dim=None,
dim,
data_vars="all",
coords="different",
compat="equals",
positions=None,
indexers=None,
mode=None,
concat_over=None,
fill_value=dtypes.NA,
join="outer",
):
Expand Down Expand Up @@ -111,38 +107,6 @@ def concat(
except StopIteration:
raise ValueError("must supply at least one object to concatenate")

if dim is None:
warnings.warn(
"the `dim` argument to `concat` will be required "
"in a future version of xarray; for now, setting it to "
"the old default of 'concat_dim'",
FutureWarning,
stacklevel=2,
)
dim = "concat_dims"

if indexers is not None: # pragma: no cover
warnings.warn(
"indexers has been renamed to positions; the alias "
"will be removed in a future version of xarray",
FutureWarning,
stacklevel=2,
)
positions = indexers

if mode is not None:
raise ValueError(
"`mode` is no longer a valid argument to "
"xarray.concat; it has been split into the "
"`data_vars` and `coords` arguments"
)
if concat_over is not None:
raise ValueError(
"`concat_over` is no longer a valid argument to "
"xarray.concat; it has been split into the "
"`data_vars` and `coords` arguments"
)

if isinstance(first_obj, DataArray):
f = _dataarray_concat
elif isinstance(first_obj, Dataset):
Expand Down
5 changes: 0 additions & 5 deletions xarray/tests/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ def test_concat_errors(self):
with raises_regex(ValueError, "coordinate in some datasets but not others"):
concat([Dataset({"x": 0}), Dataset({}, {"x": 1})], dim="z")

with raises_regex(ValueError, "no longer a valid"):
concat([data, data], "new_dim", mode="different")
with raises_regex(ValueError, "no longer a valid"):
concat([data, data], "new_dim", concat_over="different")

def test_concat_join_kwarg(self):
ds1 = Dataset({"a": (("x", "y"), [[0]])}, coords={"x": [0], "y": [0]})
ds2 = Dataset({"a": (("x", "y"), [[0]])}, coords={"x": [1], "y": [0.0001]})
Expand Down

0 comments on commit e38ca0f

Please sign in to comment.