Menu

#4 Segmentation fault when reading vdata from HDF4 file

v1.0 (example)
open
nobody
None
5
2014-05-07
2014-05-07
No

I am attempting to read a vdata field from an HDF file (version 4) using the pyhdf module.

The field is called "Lidar_Data_Altitudes" and is stored in the vdata called "metadata". So I do:

from pyhdf import VS
from pyhdf.HDF import *

hdffile = HDF(filename, HC.READ)
vs = hdffile.vstart()
vd = vs.attach('metadata', write=0)
alt = vd.field('Lidar_Data_Altitude')
the code segfaults at the last line, but any attempt to access the contents of vd (e.g. vd.read()) will segfault.

I have found a similar issue reported and resolved here: http://proj.badc.rl.ac.uk/cedaservices/ticket/37
apparently it involves a small patch to the file hdfext_wrap.c part of pyhdf.

The file I'm trying to read Lidar_Data_Altitudes from is too big to link here, but here is another HDF file from which attempting to read vdata segfaults: http://www.lmd.polytechnique.fr/~noel/Files/CAL_LID_L2_05kmCLay-Prov-V3-30.2013-08-26T14-52-35ZN.hdf

replace the last line of the sample code above with data = vd.read(), and it segfaults.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.