Skip to content

Iris causes ValueError for empty spaces in long_name  #3351

@JuliaKukulies

Description

@JuliaKukulies

When using iris.load_cube(file, constraint) to read in a variable of a netCDF4 file which has an empty space in its long_name, iris raises ValueError: 'substring not found' when using the long_name as a constraint. The ValueError does not give any clear message how to solve the problem, which in this case is straight forward: the long_name should not contain any empty spaces or special characters. To solve this problem, one can define a new long_name, e.g. with NCO:

ncatted -a long_name,'varname',o,c,'new_long_name' in.nc out.nc

When, however, using the variable name as a constraint in iris.load_cube, no ValueError appears until you display the cube. In contrast to #3261, it worked to read in the data based on the variable name (instead of standard_name or long_name)m but any further operations with the cube object fail.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions