Skip to content

Cell methods are treated inconsistently after saving and re-loading #3360

@schlunma

Description

@schlunma

Another issue which may prevent the concatenation of cubes:

import iris

# Create 1D cube with coordinate which has a long name with a space
coord = iris.coords.DimCoord([0, 1], long_name='long name')
cube = iris.cube.Cube([1, 2], dim_coords_and_dims=[(coord, 0)])

# Collapse it and print cell_methods
cube = cube.collapsed('long_name', iris.analysis.MEAN)
print(cube.cell_methods)  # gives (CellMethod(method='mean', coord_names=('long name',), intervals=(), comments=()),)

# Save it and check cell methods again
iris.save(cube, 'test.nc')
cube_new = iris.load_cube('test.nc')
print(cube_new.cell_methods)  # gives (CellMethod(method='mean', coord_names=('name',), intervals=(), comments=()),)

Would it be possible to come up with a consistent solution that doesn't change the cell methods? This prevents merge_cube and concatenate_cube operations.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions