this line just caused on my system:
Traceback (most recent call last):
File "/home/user/Code/Python/nc-checkers/cf-checker/.venv/bin/cfchecks", line 10, in <module>
sys.exit(main())
~~~~^^
File "/home/user/Code/Python/nc-checkers/cf-checker/.venv/lib/python3.13/site-packages/cfchecker/cfchecks.py", line 3402, in main
inst.checker(file)
~~~~~~~~~~~~^^^^^^
File "/home/user/Code/Python/nc-checkers/cf-checker/.venv/lib/python3.13/site-packages/cfchecker/cfchecks.py", line 531, in checker
return self._checker()
~~~~~~~~~~~~~^^
File "/home/user/Code/Python/nc-checkers/cf-checker/.venv/lib/python3.13/site-packages/cfchecker/cfchecks.py", line 823, in _checker
self.chkTimeVariableAttributes(var)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "/home/user/Code/Python/nc-checkers/cf-checker/.venv/lib/python3.13/site-packages/cfchecker/cfchecks.py", line 2931, in chkTimeVariableAttributes
varUnits = Units(var.units)
^^^^^^^^^
File "src/netCDF4/_netCDF4.pyx", line 5030, in netCDF4._netCDF4.Variable.__getattr__
File "src/netCDF4/_netCDF4.pyx", line 4752, in netCDF4._netCDF4.Variable.getncattr
File "src/netCDF4/_netCDF4.pyx", line 1667, in netCDF4._netCDF4._get_att
File "src/netCDF4/_netCDF4.pyx", line 2164, in netCDF4._netCDF4._ensure_nc_success
AttributeError: NetCDF: Attribute not found
...which basically means that the Units class returns an AttributeError, not a TypeError. This might be a version thing (I'm using cfunits 3.3.7 as the requirements.txt does not specify a specific version). I worked around by using except (AttributeError, TypeError): instead of just the TypeError in the line quoted at the start of this post.
Edit: here's a file to reproduce the issue: https://thredds.atmohub.kit.edu/thredds/fileServer/iagos-caribic/IAGOS-CARIBIC_WSM_files_collection_20240717/CARIBIC-1/WSM_19980109_012_CMB_MUC_V01.nc
cf-checker/src/cfchecker/cfchecks.py
Line 3037 in c0486c6
this line just caused on my system:
...which basically means that the
Unitsclass returns an AttributeError, not a TypeError. This might be a version thing (I'm using cfunits 3.3.7 as the requirements.txt does not specify a specific version). I worked around by usingexcept (AttributeError, TypeError):instead of just the TypeError in the line quoted at the start of this post.Edit: here's a file to reproduce the issue: https://thredds.atmohub.kit.edu/thredds/fileServer/iagos-caribic/IAGOS-CARIBIC_WSM_files_collection_20240717/CARIBIC-1/WSM_19980109_012_CMB_MUC_V01.nc