cedadev/cf-checker

Checker fails if unit can't be read by cftime

Closed this issue · 0 comments

If a variable has a unit that can't be read by cftime, for example "days since 1989 1 1", the checker fails with an traceback.

Traceback (most recent call last):
  File "/home/ros/software/dev/bin/cfchecks", line 11, in <module>
    load_entry_point('cfchecker==3.1.3', 'console_scripts', 'cfchecks')()
  File "/home/ros/software/dev/lib/python2.7/site-packages/cfchecker-3.1.3-py2.7.egg/cfchecker/cfchecks.py", line 3040, in main
    inst.checker(file)
  File "/home/ros/software/dev/lib/python2.7/site-packages/cfchecker-3.1.3-py2.7.egg/cfchecker/cfchecks.py", line 488, in checker
    return self._checker()
  File "/home/ros/software/dev/lib/python2.7/site-packages/cfchecker-3.1.3-py2.7.egg/cfchecker
/cfchecks.py", line 764, in _checker
    self.chkTimeVariableAttributes(var)
  File "/home/ros/software/dev/lib/python2.7/site-packages/cfchecker-3.1.3-py2.7.egg/cfchecker/cfchecks.py", line 2604, in chkTimeVariableAttributes
    varUnits = Units(var.units)
  File "/home/ros/anaconda2/lib/python2.7/site-packages/cfunits/units.py", line 776, in __init__
    utime = Utime(_calendar, unit_string)
  File "/home/ros/anaconda2/lib/python2.7/site-packages/cfunits/units.py", line 2438, in __init__
    _netCDF4_netcdftime_utime.__init__(self, unit_string, calendar)
  File "cftime/_cftime.pyx", line 733, in cftime._cftime.utime.__init__
  File "cftime/_cftime.pyx", line 124, in cftime._cftime._parse_date_and_units
  File "cftime/_cftime.pyx", line 932, in cftime._cftime._parse_date

This error should be caught so remainder of checks can continue