diff --git a/esmvalcore/preprocessor/_io.py b/esmvalcore/preprocessor/_io.py index d0d1339e8a..fff3548539 100644 --- a/esmvalcore/preprocessor/_io.py +++ b/esmvalcore/preprocessor/_io.py @@ -134,7 +134,6 @@ def load(file, callback=None, ignore_warnings=None): ------ ValueError Cubes are empty. - """ logger.debug("Loading:\n%s", file) if ignore_warnings is None: @@ -501,6 +500,9 @@ def _concatenate_overlapping_cubes(cubes): data_start_1.month, data_start_1.day, start_overlap.year, start_overlap.month, start_overlap.day) + # convert c1_delta scalar cube to vector cube, if needed + if c1_delta.data.shape == (): + c1_delta = iris.util.new_axis(c1_delta, scalar_coord="time") cubes = iris.cube.CubeList([c1_delta, cubes[1]]) logger.debug("Attempting concatenatenation of %s with %s", c1_delta, cubes[1]) diff --git a/tests/integration/preprocessor/_io/test_concatenate.py b/tests/integration/preprocessor/_io/test_concatenate.py index 681463f21b..8fca36fe90 100644 --- a/tests/integration/preprocessor/_io/test_concatenate.py +++ b/tests/integration/preprocessor/_io/test_concatenate.py @@ -14,7 +14,6 @@ ) from iris.coords import AuxCoord, DimCoord from iris.cube import Cube, CubeList -from iris.exceptions import ConcatenateError from esmvalcore.preprocessor import _io @@ -375,8 +374,10 @@ def test_concatenate_with_iris_exception(self): var_name='sample', dim_coords_and_dims=((time_coord_2, 0), )) cubes_single_ovlp = [cube2, cube1] - with self.assertRaises(ConcatenateError): - _io.concatenate(cubes_single_ovlp) + cubess = _io.concatenate(cubes_single_ovlp) + # this tests the scalar to vector cube conversion too + time_points = cubess.coord("time").core_points() + np.testing.assert_array_equal(time_points, [1., 1.5, 5., 7.]) def test_concatenate_no_time_coords(self): """Test a more generic case."""