Search code examples
pythonhdfsatpy

Could not load HDF Modis data with satpy


one maybe silly question. I want to load MODIS hdf data with python. The datasets are available at Earthdata. First of all a generated a list of data, which match the datestemp.

filenames_Aqua=glob(sat_path+MODIS_AQUA+'*.hdf')
filenames_Aqua.sort()

Now i have a list of 10 files. Following the introduction from Satpy:

global_scene = Scene(reader="modis_l1b", filenames=filenames_Aqua)

The following error message happen:

ValueError: Could not load data from file /MODIS_Aqua/Calibrated_Radiances_5-Min_L1B_1km/MYD021KM.A2017131.1320.061.2018032101913.hdf: SD (15): File is supported, must be either hdf, cdf, netcdf

Any ideas?

Thanks.


Solution

  • I'll repeat my comment here so this question can be considered resolved (you'll need to select this as the accepted answer).

    The error message you are getting is coming from the underlying pyhdf library and not Satpy. This suggests your HDF4 file is corrupt in some way or maybe not actually an HDF4 file. You could try running ncdump -h your_file.hdf on the command line and if it succeeds then that suggests the file is NOT corrupt.

    As you commented, it seems the files from Earthdata are corrupt in some way. The same files from LAADS are fine. If you're up for it, I would recommend contacting the Earthdata group about the issues you've discovered.