The following python script triggers the error:
from netCDF4 import Dataset
import numpy as np
nc = Dataset('test_att_convert.nc','w')
nc.foo = np.array('bar','S')
nc.close()
nc = Dataset('test_att_convert.nc','a')
nc.foo = np.array('bar','U')
nc.close()
The attribute is first written using nc_put_att_text, but then is rewritten using nc_put_att_string. On the other hand, this works
from netCDF4 import Dataset
import numpy as np
nc = Dataset('test_att_convert.nc','w')
nc.foo = np.array(1,np.int8)
nc.close()
nc = Dataset('test_att_convert.nc','a')
nc.foo = np.array(1,np.float64)
nc.close()
So the C lib is able to handle conversions of numeric types.
The following python script triggers the error:
The attribute is first written using
nc_put_att_text, but then is rewritten usingnc_put_att_string. On the other hand, this worksSo the C lib is able to handle conversions of numeric types.