HDF4 not recognized as a supported file format


leonidas_liakos@...
 

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
sys.exit(main_group())
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/rasterio/rio/info.py", line 66, in info
with ctx.obj['env'], rasterio.open(input) as src:
File "/usr/local/lib/python3.7/dist-packages/rasterio/env.py", line 433, in wrapper
return f(*args, **kwds)
File "/usr/local/lib/python3.7/dist-packages/rasterio/init.py", 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.





Sean Gillies
 

Hi,

On Mon, Nov 2, 2020 at 9:16 AM leonidas_liakos via groups.io <leonidas_liakos=yahoo.gr@groups.io> 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
sys.exit(main_group())
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/rasterio/rio/info.py", line 66, in info
with ctx.obj['env'], rasterio.open(input) as src:
File "/usr/local/lib/python3.7/dist-packages/rasterio/env.py", line 433, in wrapper
return f(*args, **kwds)
File "/usr/local/lib/python3.7/dist-packages/rasterio/init.py", 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 https://github.com/mapbox/rasterio/issues/2026 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


leonidas_liakos@...
 

Thank you!
pip3 install rasterio --force-reinstall --no-binary rasterio  did the job.