Skip to content

Aux factories are not properly updated after concatenation #5339

@schlunma

Description

@schlunma

🐛 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: 140737037761168

How 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions