Unidata / netcdf4-python

netcdf4-python: python/numpy interface to the netCDF C library
http://unidata.github.io/netcdf4-python
MIT License
748 stars 261 forks source link

Segmentation Fault When Loading Remote Data #492

Open importmattie opened 8 years ago

importmattie commented 8 years ago

I use anaconda python on a MacBook Pro running OS X El Capitan. I updated my python packages via anaconda this morning and then re-added netCDF4 (1.1.9-np110py27_0).

Afterwards, when I call netCDF4.Dataset to load remote data I get a segmentation fault. Here's the simplest code that will lead to the segmentation fault:

netCDF4.Dataset('https://weather.rsmas.miami.edu/repository/opendap/synth:eab82de2-d682-4dc0-ba8b-2fac7746d269:L2FsbFZhcnNfcjkweDQ1XzMubmM0/entry.das','r')

I did not get the same error when using that call on a file on the local hard drive. If it helps, I've also attached the Mac error report generated when this happens in an IPython Notebook.

errorReport.txt

jswhit commented 8 years ago

Works on my mac. Looks like a segfault in the C lib - perhaps a bug that has been fixed? What version of the netcdf c lib are you using? You can find out using:

>>> import netCDF4
>>> netCDF4.__version__
'1.2.2'
>>> netCDF4.__hdf5libversion__
u'1.8.15-patch1'
>>> netCDF4.__netcdf4libversion__
u'4.4.0-development'
>>> netCDF4.Dataset('https://weather.rsmas.miami.edu/repository/opendap/synth:eab82de2-   d682-4dc0-ba8b-2fac7746d269:L2FsbFZhcnNfcjkweDQ1XzMubmM0/entry.das','r')
<type 'netCDF4._netCDF4.Dataset'>
root group (NETCDF3_CLASSIC data model, file format DAP2):
    CDI: Climate Data Interface version 1.6.4 (http://code.zmaw.de/projects/cdi)
    history: Thu Oct 29 09:47:06 2015: cdo remap,../Weights/r90x45_overlap_source.txt,../Weights    /r90x45_overlap_from2.nc4 allVars_r180x90_1_noHMV.nc4 allVars_r90x45_1.nc4
Thu Oct 29 09:19:11 2015: ncks -x -v HMV allVars_r180x90_1.nc4 allVars_r180x90_1_noHMV.nc4
Wed Oct 28 15:20:51 2015: ncks -x -v KEDOT allVars_r180x90_1.nc4   allVars_r180x90_1_noKEDOT.nc4
Wed Oct 28 15:16:12 2015: ncatted -a units,SKEDOT_ZON,o,c,m2 s-3 /home/niznik/niznik-   data2/shared_repository/allVars_r180x90_1.nc4
Wed Oct 28 15:16:12 2015: ncatted -a long_name,SKEDOT_ZON,o,c,eddy vertical momentum flux     /home/niznik/niznik-data2/shared_repository/allVars_r180x90_1.nc4
Wed Oct 28 15:13:39 2015: ncks -A -v SKEDOT_ZON /home/niznik/niznik-data2/calcVars_3D   /SKEDot_r180x90.nc4 /home/niznik/niznik-data2/shared_repository/allVars_r180x90_1.nc4
Thu Jun  4 14:33:00 2015: ncatted -a long_name,KEDOT,o,c,eddy vertical momentum flux     allVars_r180x90_1.nc4
Thu Jun  4 14:26:07 2015: ncks -x -v KEDot allVars_r180x90_1.nc4 allVars_r180x90_1_fix.nc4
Thu Jun  4 14:22:08 2015: ncks -A -v KEDOT /home/niznik/niznik-data2/calcVars_3D    /KEDot_r180x90.nc4 /home/niznik/niznik-data2/allVars_r180x90_1.nc4
Thu Jun 04 00:22:57 2015: cdo remap,r180x90,Weights/r180x90_fromP5.nc4 calcVars.nc4      allVars_r180x90_1.nc4
    Conventions: CF-1.4
    NCO: 4.3.7
    CDO: Climate Data Operators version 1.6.4 (http://code.zmaw.de/projects/cdo)
    nco_openmp_thread_number: 1
    DODS_EXTRA.Unlimited_Dimension: time
    dimensions(sizes): time(6087), lat(45), lon(90)
    variables(dimensions): float64 lon(lon), float64 lat(lat), float64 time(time), float32 PREC(time,lat,lon), float32 Q(time,lat,lon), float32 SKEDOT_ZON(time,lat,lon), float32 T(time,lat,lon), float32 TEF(time,lat,lon), float32 U(time,lat,lon), float32 UU(time,lat,lon), float32 V(time,lat,lon), float32 VV(time,lat,lon), float32 W(time,lat,lon), float32 WPQP(time,lat,lon), float32 WPTP(time,lat,lon), float32 WPUP(time,lat,lon), float32 WQ(time,lat,lon), float32 WT(time,lat,lon), float32 WU(time,lat,lon), float32 WV(time,lat,lon), float32 HMV(time,lat,lon)
    groups:
importmattie commented 8 years ago

Yeah, it does look like a few of them are out of date. Here's the output, and in the meantime I'll try updating the other libraries and see if that fixes things.

In [6]: netCDF4.version Out[6]: '1.1.9'

In [7]: netCDF4.hdf5libversion Out[7]: u'1.8.15-patch1'

In [8]: netCDF4.netcdf4libversion Out[8]: u'4.3.3.1'

jswhit commented 8 years ago

I just tried here with netcdf 4.3.3.1 and hdf5 1.8.15-patch1, and it works.

importmattie commented 8 years ago

Just to note, downgrading to 1.1.8 worked for me as a temporary fix. I will try 1.2.2 soon.