spectralpython / spectral

Python module for hyperspectral image processing
MIT License
573 stars 139 forks source link

Can't open .hdf ( binary file ) from ASTER 1T #52

Closed brunorpinho closed 7 years ago

brunorpinho commented 8 years ago

First, I would like to thank you for this great code!

My problem is that I can't open an ASTER image (.hdf) with the open_image function. Am missing something? Not supported? Do I need to process the file before?

Thanks

tboggs commented 8 years ago

No, you didn't miss anything. HDF is a general format and the spectral module does not recognize HDF or any particular formats that use it (like HDF-EOS). To read ASTER data, there are a few options. You could use an HDF module (like h5py) to read the image data into an ndarray. If need to retain the image metadata, you could use this tool to convert the HDF to GeoTiff, then use gdal_translate to convert the GeoTiff to ENVI format, which the spectral module will recognize.

brunorpinho commented 8 years ago

Thank you @tboggs ! I will just have to calculate Surface Reflectance and Emissivity before importing it into spectral, right?

tboggs commented 8 years ago

SPy itself doesn't include a reflectance/conversion function so you would either need to do that before converting the file or use a method that can operate on a numpy.ndarray.