cedadev/cf-checker

UnboundLocalError raised when running CF-checker via browser

Closed this issue · 2 comments

When testing a COARDS compliant NetCDF4 file (downloadable here), an UnboundLocalError is raised. The was raised whilst using the online browser version of cf-checker (linked).

The final section of error message pasted below and the full output linked too (linked here).

I have tested this fine with a script I normally use (linked), which raises no notable issues (output linked here).

"
...


Checking variable: EmisACET_Total


Checking variable: DryDep_SOAS

Traceback (most recent call last):
File "/home/ros/anaconda2/bin/cfchecks", line 10, in
sys.exit(main())
File "/home/ros/anaconda2/lib/python2.7/site-packages/cfchecker/cfchecks.py", line 3021, in main
inst.checker(file)
File "/home/ros/anaconda2/lib/python2.7/site-packages/cfchecker/cfchecks.py", line 488, in checker
return self._checker()
File "/home/ros/anaconda2/lib/python2.7/site-packages/cfchecker/cfchecks.py", line 728, in _checker
self.chkUnits(var,allCoordVars)
File "/home/ros/anaconda2/lib/python2.7/site-packages/cfchecker/cfchecks.py", line 2251, in chkUnits
varUnit = Units(units)
File "/home/ros/anaconda2/lib/python2.7/site-packages/cfunits/units.py", line 728, in init
units = _bytes_to_str(units)
File "/home/ros/anaconda2/lib/python2.7/site-packages/cfunits/units.py", line 27, in _bytes_to_str
return str(as_string)
UnboundLocalError: local variable 'as_string' referenced before assignment

"

Note to self: This should be fixed when online checker upgrade soon.

Confirm checker no longer crashes with this file.