-
Notifications
You must be signed in to change notification settings - Fork 300
Closed
Labels
Description
🐛 Bug Report
In #5096, I missed to update the scalar coordinates of the new concatenated cube correctly. As a result, operations like indexing a cube fail with cryptic errors like
KeyError: 140737037761168How To Reproduce
Steps to reproduce the behaviour:
import iris
import iris.util
from iris.cube import CubeList
from iris.coords import DimCoord
print(iris.__version__)
print("")
# Load sample data
path = iris.sample_data_path('hybrid_height.nc')
cube = iris.load(path)[0]
cube.remove_coord('time')
time_coord = DimCoord(10.0, units='days since 2000-01-01', standard_name='time')
cube_0 = iris.util.new_axis(cube)
cube_0.add_dim_coord(time_coord.copy(), 0)
cube_1 = iris.util.new_axis(cube)
cube_1.add_dim_coord(time_coord.copy(), 0)
cube_1.coord('time').points = [20.0]
cubes = CubeList([cube_0, cube_1])
concat_cube = cubes.concatenate_cube()
print(concat_cube[0, 0, 0])Running this leads to the aforementioned KeyError.
Expected behaviour
No error.
Environment
- OS & Version: Red Hat Enterprise Linux 8.6 (Ootpa)
- Iris Version: 3.6.0
I will provide a fix for this shortly.