Project

General

Profile

Segmentation fault in cdo python bindings

Added by Neil Swart over 9 years ago

Since upgrading to scipy 0.14 (Anaconda v2.1.0) I've been having trouble with cdo.setrtomiss and other operators. The following code snippet results in a python segmentation fault:

import cdo; cdo = cdo.Cdo()  
ifile="gistemp1200_ERSST.nc"
varname='tempanomaly'
var = cdo.setrtomiss(1e34,1.1e34, input=ifile, returnMaArray=varname)
Segmentation fault (core dumped)

The cdo binary does not have any problems with this operation, but python seg faults on the return. I noticed the comment on the github page, and tried following the recomendation there,
but the problem persists:

cdf = cdo.setrtomiss(1e34,1.1e34, input=ifile, returnCdf=True)
var = cdf.variables[varname][:]
print var
Segmentation fault (core dumped)

Is this known and reproducible by others? Is there a solution? The above all works fine with scipy 0.13.

Thanks
Neil


Replies (1)

RE: Segmentation fault in cdo python bindings - Added by Ralf Mueller about 9 years ago

Hi!

It's seems to be a bug, I recomment using the netcdf4 library: https://github.com/Try2Code/cdo-bindings/issues/4
the current version of cdo.py has a work around for this.

cheers
ralf

    (1-1/1)