Jeff Whitaker

Results 531 comments of Jeff Whitaker

I'm going to go ahead and merge the pull request, since it should prevent memory leakage, even if it doesn't fix the segfaults. Seems likely that the segfault is coming...

The fill_value has to be of the same type as the variable, so you can't have a two character fill_value for a single character variable. There is some magic happening...

Can't see how it every would have worked - the C library requires that the fill_value be the same type as the variable. It would like trying to use a...

I guess you could manually pre-fill your array with "N"s, "A"s and blanks so the rows of the matrix are "NA ".

Here's what I mean: ```python import netCDF4 nc = netCDF4.Dataset('stringtest.nc','w',format='NETCDF4') nc.createDimension('nchars',3) nc.createDimension('nstrings',3) v = nc.createVariable('strings','S1',('nstrings','nchars')) v._Encoding = 'ascii' v[:]='NA ' v[0]='FOO' v[1]='BAR' nc.close() ``` which produces ``` netcdf stringtest {...

I think there may have been a change in the C lib to enforce _FillValue (and missing_value) having the same type as the variable.

Can't reproduce on my macos machine with libnetcdf 4.6.2, 4.7.0 or 4.7.2. Can't see how the netcdf4-python version would matter since it's a segfault in the netcdf-c library.

For those trying to run the OP's test script, you have to change the date in the filename - older files age off.

Confirmed on macos x with Ananconda. Must be specific to the Anaconda packages though - if I build netcdf 4.7.1 and netcdf4-python 1.5.3 myself it works fine.

From the traceback, it looks perhaps like the netcdf-c lib is trying to access memory that has already been deallocated by the python garbage collector.