Skip to content

C lib segfaults when re-writing text attribute as string #149

@jswhit

Description

@jswhit

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions