HDF5 Package can't open HDF file

Hey

I am new to julia programming. Actually, not just to julia but to programming as a whole. I am currently investigating the MODIS product in a .hdf format. I used HDF5 package but it can’t recognize the file. Here are my commands in the julia REPL with the corresponding output.

julia> using HDF5

julia> x=h5open(“MOD16A2.A2002M01.h30v07.105.2013121125445.hdf”)
ERROR: This does not appear to be an HDF5 file
Stacktrace:
[1] #h5open#3(::Bool, ::Function, ::String, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::HDF5.HDF5Properties, ::HDF5.HDF5Properties) at /root/.julia/v0.6/HDF5/src/HDF5.jl:593
[2] (::HDF5.#kw##h5open)(::Array{Any,1}, ::HDF5.#h5open, ::String, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::HDF5.HDF5Properties, ::HDF5.HDF5Properties) at ./:0
[3] #h5open#4(::Bool, ::Function, ::String, ::String) at /root/.julia/v0.6/HDF5/src/HDF5.jl:643
[4] h5open(::String) at /root/.julia/v0.6/HDF5/src/HDF5.jl:625

Do you know which version of HDF it is? If the data is old enough it might be HDF4. You can check the version by downloading HDFView from the HDF Group and open your file. With the file open look at the root folder. It will have a 4 or 5 for the version of HDF that it uses.

1 Like

If I’m correct it is MODIS data from 2002 and it is indeed HDF4 as @Daneel pointed out as probable cause.
At following page HDF-EOS Tools you’ll find some tools to do the HDF4 → HDF5 conversion. Then it should be possible to open it with HDF5.jl.

Hi Guys

I’ll check that tools out, maybe tomorrow. I’m having problem with low
internet connection. Thank you so much.

This video introduces a tool to get data from MOD16A2 HDF Files