Skip to main content

The HDF to GeoTIFF tool provides Python scripts to help users read NASA's Black Marble VNP46 files, convert them to GeoTIFF, and display them in QGIS. For those who do not have Geospatial Data Abstraction Library (GDAL) installed, the QGIS python console (Plugins -> Python Console) can be used to run the script.

Download the source code to convert NASA's Black Marble HDF5 product to GeoTIFF or HDF4 product to GeoTIFF.

Location of the Input Folder Containing HDF Images

os.chdir('C:\\InputFolder')

The current script only reads the first file (if there are multiple files in the input folder). The rasterFiles[ ] index can be modified to select one specific file or iterate through all files within the input folder.

hdflayer = gdal.Open(rasterFiles[0], gdal.GA_ReadOnly)

Reading a specific raster layer: GetSubDatasets()[0][0] for first layer, GetSubDatasets()[1][0] for second layer, and so on.

hdflayer.GetSubDatasets()[0][0]

Location of the Folder for Output Images

outputFolder = "C:\\OutputFolder\\"

Display Output GeoTiff Image in QGIS 

This command works only if the script is executed within QGIS Python Console.

iface.addRasterLayer(outputRaster, outputNameFinal)

Join Our Community of NASA Data Users

While NASA data are openly available without restriction, an Earthdata Login is required to download data and to use some tools with full functionality.

Learn About the Benefits of Earthdata Login

Frequently Asked Questions

Earthdata Forum

Our online forum provides a space for users to browse thousands of FAQs about research needs, data, and data applications. You can also submit new questions for our experts to answer.

Submit Questions to Earthdata Forumand View Expert Responses

Earthdata
Forum