Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Bug fixes
- Line plots with the ``x`` or ``y`` argument set to a 1D non-dimensional coord
now plot the correct data for 2D DataArrays.
(:issue:`3334`). By `Tom Nicholas <http://github.com/TomNicholas>`_.
- Fix error in concatenating unlabeled dimensions (:pull:`3362`).
By `Deepak Cherian <https://github.com/dcherian/>`_.

Documentation
~~~~~~~~~~~~~
Expand Down
2 changes: 0 additions & 2 deletions xarray/core/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ def _calc_concat_over(datasets, dim, dim_names, data_vars, coords, compat):
if dim not in ds.dims:
if dim in ds:
ds = ds.set_coords(dim)
else:
raise ValueError("%r is not present in all datasets" % dim)
concat_over.update(k for k, v in ds.variables.items() if dim in v.dims)
concat_dim_lengths.append(ds.dims.get(dim, 1))

Expand Down
9 changes: 5 additions & 4 deletions xarray/tests/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ def test_concat_compat():
for var in ["has_x", "no_x_y"]:
assert "y" not in result[var]

with raises_regex(ValueError, "'q' is not present in all datasets"):
concat([ds1, ds2], dim="q", data_vars="all", compat="broadcast_equals")


class TestConcatDataset:
@pytest.fixture
Expand Down Expand Up @@ -89,7 +86,11 @@ def test_concat_coords_kwarg(self, data, dim, coords):
assert_equal(data["extra"], actual["extra"])

def test_concat(self, data):
split_data = [data.isel(dim1=slice(3)), data.isel(dim1=slice(3, None))]
split_data = [
data.isel(dim1=slice(3)),
data.isel(dim1=3),
data.isel(dim1=slice(4, None)),
]
assert_identical(data, concat(split_data, "dim1"))

def test_concat_dim_precedence(self, data):
Expand Down