I am using netCDF4 Python package, I know that getattr() can get the value of the attribute of a variable of a dataset, e.g.
root = Dataset(file_name,'r')
for var in root.variables.values():
print 'attrs of this variable:',var.ncattrs()
for attr in var.ncattrs():
print '<<attr name>> =', attr
print '<<attr value>> =',getattr(var,attr)
I can get the name/value pair of the attribute successfully through the above code. Now I want to get the data type(int, float, etc.) of the attribute, but I can't find such method/function, does anyone know? I know there is such API in netCDF C package.