Opened 11 years ago

Closed 8 years ago

#54 closed defect (fixed)

CF Checker crash in chkAttribute

Reported by: ros Owned by: ros
Priority: medium Milestone:
Component: cf-checker Version:
Keywords: vn2.0.0 Cc:

Description

------------------
Checking variable: longitude
------------------
Traceback (most recent call last):
  File "/home/ros/bin/cfchecks_2-0-0.py", line 2194, in 
    inst.checker(file)
  File "/home/ros/bin/cfchecks_2-0-0.py", line 349, in checker
    if not self.chkAttribute(attribute,var,allCoordVars): rc=0
  File "/home/ros/bin/cfchecks_2-0-0.py", line 1019, in chkAttribute
    if var.dtype.char != var.attributes[attribute].dtype.char:
AttributeError: 'function' object has no attribute 'char'

Change History (5)

comment:1 Changed 11 years ago by ros

  • Owner changed from cf-checker@… to ros
  • Status changed from new to assigned

Example files in:

~ros/netcdf_files/nc4/AndrewClegg_Trac54.nc
~ros/netcdf_files/nc4/NanGalbraith_Trac54.nc

comment:2 Changed 11 years ago by ros

With the transition to cdms2 determining variable types changed from arr.typecode() to arr.dtype.char.

However, this only works for FileVariables? and attributes and not for FileAxis? variables.

>>> f.variables.keys()
['l2_flags', 'nLw_413', 'nLw_490', 'nLw_560', 'total_susp', 'mercator',   'nLw_510', 'algal_2', 'algal_1', 'toa_veg', 'nLw_619', 'nLw_443', 'yellow_subs', 'boa_veg']
>>>> 
>>>> f.axes.keys()
['latitude', 'longitude', 'time']
>>>> 
>>>> f['total_susp'].dtype.char
'f'
>>>> 
>>>> f['time'].dtype.char
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
 AttributeError: 'function' object has no attribute 'char'
>>>> 
>>>> f['time'].typecode()
'd'

Emailed cdat-discussion mailing list. The cdat guys hadn't noticed this and will hopefully make it more uniform in due course.

For now I need to determine if the variable is a FileVariable? or FileAxis? and act accordingly.

comment:3 Changed 11 years ago by ros

Fix committed at r123

comment:4 Changed 11 years ago by ros

Whilst fixing this problem I noticed that Andrew Clegg's test file, listed above, was generating ut_are_convertible(): NULL unit argument warnings. This is caused by continuing to run further units checks on an invalid unit.

Solution: Return from chkUnits function if a unit is determined invalid.

r124

comment:5 Changed 8 years ago by ros

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.