Georeference Suomi-NPP NRT HDF to GeoTIFF

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
emanuelcast
Posts: 1
Joined: Tue Aug 01, 2023 10:25 am America/New_York
Answers: 0

Georeference Suomi-NPP NRT HDF to GeoTIFF

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

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.
Attachments
wx4dv-min.png
wx4dv-min.png (479.88 KiB) Not viewed yet

Tags:

LAADS_UserServices_M
User Services
User Services
Posts: 289
Joined: Mon Sep 30, 2019 8:33 am America/New_York
Answers: 1
Has thanked: 3 times

Re: Georeference Suomi-NPP NRT HDF to GeoTIFF

by LAADS_UserServices_M » Thu Sep 28, 2023 10:24 am America/New_York

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.
Regards,
LAADS User Services

To receive news from LAADS DAAC direct to your inbox, email laadsdaac-join@lists.nasa.gov with “subscribe” in the subject line.

Post Reply