Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated concat kwargs. #3288

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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