Page 1 of 1

Georeference Suomi-NPP NRT HDF to GeoTIFF

Posted: Tue Aug 01, 2023 10:41 am America/New_York
by emanuelcast
Hello,

I am trying to georeference Suomi-NPP VNP09_NRT (Near Real Time) data that is in HDF format to GeoTIFF using only GDAL.
File: VNP09_NRT.A2023173.1412.001.2023173180224.hdf

Currently, this is my code:

############################################################################################################

north_bound = in_product_global_metadata["NorthBoundingCoord"]
west_bound = in_product_global_metadata["WestBoundingCoord"]
south_bound = in_product_global_metadata["SouthBoundingCoord"]
east_bound = in_product_global_metadata["EastBoundingCoord"]

x_res = (east_bound-west_bound)/n_col
y_res = (north_bound-south_bound)/n_row
geo_info = (west_bound, x_res, 0, north_bound, 0, -y_res)

output_path = os.path.join("results", product_name+".tif")
dataType = gdal_array.NumericTypeCodeToGDALTypeCode(rgb.dtype)
driver = gdal.GetDriverByName('GTiff')
out_file = driver.Create(output_path, n_col, n_row, 3, dataType, options=["PHOTOMETRIC=RGB", "PROFILE=GeoTIFF"])

for band in range(rgb.shape[2]):
->out_file.GetRasterBand(band+1).WriteArray(rgb[:,:,band])
-> out_file.GetRasterBand(band+1).SetNoDataValue(0)
out_file.GetRasterBand(1).SetColorInterpretation(gdal.GCI_RedBand)
out_file.GetRasterBand(2).SetColorInterpretation(gdal.GCI_GreenBand)
out_file.GetRasterBand(3).SetColorInterpretation(gdal.GCI_BlueBand)
out_file.SetGeoTransform(geo_info)
out_file.SetProjection("EPSG:4326")
outF_file = None

############################################################################################################

The bounds are retrieved using gdal.Info.

I am having trouble georeferencing this product, can anyone help?
HEG NASA software doesn't seem to work with this product.

This is my current output:
Visualisation on QGIS, image compressed.

Re: Georeference Suomi-NPP NRT HDF to GeoTIFF

Posted: Thu Sep 28, 2023 10:24 am America/New_York
by LAADS_UserServices_M
Somehow missed your post. You may want to explore tools available from LAADS DAAC. The information about these tools can be found here:
https://ladsweb.modaps.eosdis.nasa.gov/tools-and-services/#ldope
The User Guide for the Reproject tool has an example of first reprojection of the MODIS/VIIRS data products and then conversion the reprojected data to Geotiff at:
https://ladsweb.modaps.eosdis.nasa.gov/tools-and-services/ldope/projbrowsepythonpkgUG.pdf
Please, let us know if you need more information on these tools.