Error in reading hdf file using h5py package for python -
i want extract data hdf files downloaded modis website. sample file provided in link. reading hdf file using following lines of code:
>>> import h5py >>> f = h5py.file( 'myd08_m3.a2002182.051.2008334061251.psgscs_000500751197.hdf', 'r' )
the error getting:
traceback (most recent call last): file "<pyshell#3>", line 1, in <module> f = h5py.file( 'myd08_m3.a2002182.051.2008334061251.psgscs_000500751197.hdf', 'r' ) file "c:\python27\lib\site-packages\h5py\_hl\files.py", line 165, in __init__ fid = make_fid(name, mode, userblock_size, fapl) file "c:\python27\lib\site-packages\h5py\_hl\files.py", line 57, in make_fid fid = h5f.open(name, h5f.acc_rdonly, fapl=fapl) file "h5f.pyx", line 70, in h5py.h5f.open (h5py\h5f.c:1640) ioerror: unable open file (file accessability: unable open file)
i have tried several other hdf files different sources getting same error. seems fault here?
i think there 2 possible problems:
1) file extension "hdf", maybe hdf4 file. hdf5 files have ".hdf5" or ".h5·" extension. not sure if h5py able read hdf4 files.
2) perhaps have change permissions file itself. if in linux machine try: chmod +r file.hdf
you can try open file hdfview. software available in several platforms. can check properties of files it.
Comments
Post a Comment