-
Notifications
You must be signed in to change notification settings - Fork 298
Closed
Labels
Description
🐛 Bug Report
If a variable in a netCDF file contains a um_stash_source attribute that is not in MSI format mXXsXXiXXX (for example (28.97/48.0)*m01s34i001) then ValueError is raised when loading.
How To Reproduce
Steps to reproduce the behaviour:
import iris
from netCDF4 import Dataset
from iris.tests.stock import realistic_3d
cube = realistic_3d()
iris.save(cube, 'cube.nc')
rootgrp = Dataset('cube.nc', 'a')
apt = rootgrp.variables['air_potential_temperature']
apt.um_stash_source = '(28.97/48.0)*m01s34i001'
rootgrp.close()
cube = iris.load_cube('cube.nc')
Expected behaviour
ValueError seems excessive here. If the STASH code isn't in the correct format then perhaps a warning and storing the attribute value in cube.attributes would be nicer to users.
Environment
- OS & Version: RHEL7
- Iris Version: 3.0.0rc0
(but behaviour is probably OS and version independent)
Additional context
Fix probably needs to go into https://github.com/SciTools/iris/blob/master/lib/iris/fileformats/_pyke_rules/fc_rules_cf.krb#L1014 but I'm not sure how to handle an execption in Pyke myself.