cedadev/cf-checker

The checker crashes for variables with one single flag_values or flag_mask case

Closed this issue · 0 comments

The checker seems to crash when running on file like this:

dimensions:
dimension = 1 ;
variables:
byte masked_variable(dimension) ;
masked_variable:_FillValue = -127b ;
masked_variable:long_name = "just an example" ;
masked_variable:flag_masks = 1b ;
masked_variable:flag_meanings = "case1description" ;
byte variable(dimension) ;
variable :_FillValue = -127b ;
variable :long_name = "just an example" ;
variable :flag_values = 1b ;
variable :flag_meanings = "case1description" ;

// global attributes:
:Conventions = "CF-1.6" ;
data:
masked_variable = 1 ;
variable = 1 ;

The output of the checker is:

Using CF Checker Version 3.0.5
Checking against CF Version CF-1.6
Using Standard Name Table Version 65 (2019-04-09T13:32:32Z)
Using Area Type Table Version 9 (07 August 2018)

Checking variable: masked_variable

/usr/lib64/python2.7/site-packages/cfchecker/cfchecks.py:1390: FutureWarning: Conversion of the second argument of issubdtype from int to np.signedinteger is deprecated. In future, it will be treated as np.int64 == np.dtype(int).type.
elif numpy.issubdtype(attrType, numpy.int) or numpy.issubdtype(attrType, numpy.float):
INFO: (3.1): No units attribute set. Please consider adding a units attribute for completeness.
Traceback (most recent call last):
File "/usr/bin/cfchecks", line 9, in
load_entry_point('cfchecker==3.0.5', 'console_scripts', 'cfchecks')()
File "/usr/lib64/python2.7/site-packages/cfchecker/cfchecks.py", line 2407, in main
inst.checker(file)
File "/usr/lib64/python2.7/site-packages/cfchecker/cfchecks.py", line 375, in checker
return self._checker()
File "/usr/lib64/python2.7/site-packages/cfchecker/cfchecks.py", line 606, in _checker
self.chkFlags(var)
File "/usr/lib64/python2.7/site-packages/cfchecker/cfchecks.py", line 2180, in chkFlags
retcode = self.equalNumOfValues(masks,meanings)
File "/usr/lib64/python2.7/site-packages/cfchecker/cfchecks.py", line 2241, in equalNumOfValues
type_arg1 = self.getType(arg1)
File "/usr/lib64/python2.7/site-packages/cfchecker/cfchecks.py", line 2230, in getType
print " ERROR: Unknown Type in getType("+arg+")"
TypeError: cannot concatenate 'str' and 'numpy.int8' objects