I would like to port to Julia some code that we have that works on MODIS satellite imagery. The source files are in HDF4 format, and are correctly recognized as MODIS datasets by the system gdalinfo. However, if I try loading them in Julia using ArchGDAL I get the error
AG.read("MOD03.A2019309.1035.061.NRT.hdf")
ERROR: GDALError (CE_Failure, code 4):
`MOD03.A2019309.1035.061.NRT.hdf' not recognized as being in a supported file format.
My understanding is that this is coming directly from the GDAL library used by ArchGDAL, which is apparently compiled without HDF4 support (indeed, find(x -> startswith(x, "HDF"), AG.listdrivers()) only lists HDF5).
So, assuming I would like to have ArchGDAL come with HDF4 support, what would be my best course of action? Would it be possible to have my ArchGDAL be built against my system gdal so that the supported systems match?
The GDAL build now supports HDF4! Since this PR the GDAL_jll.jl starting from v302.1000.200 supports it. I just verified I can open a MODIS file with ArchGDAL.jl.
Thanks for pushing this @visr. Would you maybe share your code? I tried to access MODIS data, I can open the file with ArchGDAL,
const AG = ArchGDAL
filename = "MYD11C1.A2005352.006.2015269073039.hdf"
ds = AG.read(filename)
GDAL Dataset (Driver: HDF4/Hierarchical Data Format Release 4)
File(s):
MYD11C1.A2005352.006.2015269073039.hdf
but it does not seem to contain any raster layers.
AG.nlayer(ds), AG.nraster(ds)
(0, 0)
When opening the same file using PyNio it can see several layers of raster data. Can you confirm that you can actually extract data from your modis file?