Topics

reading hdf4 files with rasterio


Amine Aboufirass <amine.aboufirass@...>
 

Dear All,

Is there a way to read and write hdf4 datasets using rasterio? I am working with DAAC data, for example https://e4ftl01.cr.usgs.gov//DP107/MOLA/MYD13Q1.006/2013.01.09/MYD13Q1.A2013009.h09v07.006.2015254175244.hdf

I found some examples of reading the data using gdal but extracting all relevant subdatasets and writing to a new GeoTiff using gdal would be a headache, I think.

Please let me know your thoughts. Thanks in advance for your help.

Regards,

Amine


Sean Gillies
 

Rasterio doesn't improve the situation with subdatasets very much. You would still need to discover them via a rasterio dataset's subdatasets property. Something like

with rasterio.open("file.hdf4") as dataset:
    for name in dataset.subdatasets:
        with rasterio.open(name) as subdataset:
            print(subdataset.profile)


On Mon, Oct 21, 2019 at 2:39 AM Amine Aboufirass <amine.aboufirass@...> wrote:
Dear All,

Is there a way to read and write hdf4 datasets using rasterio? I am working with DAAC data, for example https://e4ftl01.cr.usgs.gov//DP107/MOLA/MYD13Q1.006/2013.01.09/MYD13Q1.A2013009.h09v07.006.2015254175244.hdf

I found some examples of reading the data using gdal but extracting all relevant subdatasets and writing to a new GeoTiff using gdal would be a headache, I think.

Please let me know your thoughts. Thanks in advance for your help.

Regards,

Amine



--
Sean Gillies