Skip to content

iris.save crashes for NetCDF for cube with no cell_methods #3288

@volcan01010

Description

@volcan01010

I have cube where cube.cell_methods == (None,). When I try to save it to NetCDF, Iris crashes with the following exception:

-> 1728             for name in cm.coord_names:
   1729                 coord = cube.coords(name)
   1730 

AttributeError: 'NoneType' object has no attribute 'coord_names'

The error occurs within the NetCDF Saver._create_cf_cell_methods() function.

I think this is a bug. Unfortunately I don't know enough about NetCDF to suggest a fix.

The following code reproduces the error using the NAME_No_time_averaging.txt file.

import iris
cubes = iris.load('NAME_No_time_averaging.txt')
iris.save(cubes, 'test.nc')

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions