Re: HDF4 not recognized as a supported file format

Sean Gillies


On Mon, Nov 2, 2020 at 9:16 AM leonidas_liakos via <> wrote:
I have install rasterio with pip3 install rasterio --no-binary rasterio
When I'm trying to read an HDF4 MODIS file I get an error:

Matplotlib created a temporary config/cache directory at /tmp/matplotlib-m5kstvas because the default path (/home/kokkytos/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Traceback (most recent call last):
File "rasterio/_base.pyx", line 216, in rasterio._base.DatasetBase.init
File "rasterio/_shim.pyx", line 67, in rasterio._shim.open_dataset
File "rasterio/_err.pyx", line 205, in rasterio._err.exc_wrap_pointer
rasterio._err.CPLE_OpenFailedError: 'MOD11A1.A2014152.h18v04.006.2016204003609.hdf' not recognized as a supported file format.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/rio", line 8, in
File "/usr/local/lib/python3.7/dist-packages/click/", line 829, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/rasterio/rio/", line 66, in info
with ctx.obj['env'], as src:
File "/usr/local/lib/python3.7/dist-packages/rasterio/", line 433, in wrapper
return f(*args, **kwds)
File "/usr/local/lib/python3.7/dist-packages/rasterio/", line 218, in open
s = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)
File "rasterio/_base.pyx", line 218, in rasterio._base.DatasetBase.init
rasterio.errors.RasterioIOError: 'MOD11A1.A2014152.h18v04.006.2016204003609.hdf' not recognized as a supported file format.

In you reported that you'd previously installed a wheel from PyPI. In that case, I think you need to add an option when reinstalling:

pip3 install rasterio --force-reinstall --no-binary rasterio

Sean Gillies

Join to automatically receive all group messages.