0

I already asked this question @stackoverflow however, perhaps it fits better here, due to the spatial nature of VIIRS data and the hdf5-eos file format.

Im looking into how to handle .h5 (hdf-eos) VIIRS DNB raster data in R (or any other opensource software). I know that GeoTIFF products are available, for monthly composites, however I need daily data, that is why I need to work with the .h5.

My data is ordered and downloaded through https://www.class.ngdc.noaa.gov/saa/products/welcome

Preferably I want to be able to plot and create time series of the data in R, but if that is not possible, then I want to export it as GeoTIFF to handle it in ArcGIS or QGIS (which is maybe also necessary to work with it in R?).

So far I am able to read in the file with

hdf<- h5file("mypath/GDNBO-SVDNB_npp_d20171101_t0110370_e0116174_b31151_c20180208224859630066_nobc_ops.h5", mode = "r")

But I cannot figure out how to access the "radiance" band, let alone plot it. I have read the "h5" package documentation without any progress.

As another option I have tried to export the h5 file to geotiff with

sds <- get_subdatasets("subset_1_d20171101_t0110370.h5")
gdal_translate(sds[17], dst_dataset = "radiance.tif", overwrite=T) #subset 17 is the radiance band i need

however the file has lost its geolocation during the transformation, when the geotiff is opened in e.g. QGIS, it does not have any location or projection.

I understand that the geolocation is stored in separate bands (latitude, longitude) however I don't understand how I can access meta data on the corner coordinates and the projection, and then pass this on to gdal_translate() or a software like ArcGIS?

Anyone knows how to deal with these type of files in R?

I seek an example in R how to plot or export this data file.

0

@dtanon, did you find any solution? I'm also interested. You can use polargrid or satpy to reproject and convert to geotiff your data. Did you use gdal_translate? You can try something like this but I don't know if it is the best solution:

gdal_translate -of VRT  HDF5:<yourhdffile>://<pathofdataset> <output.vrt>

and then to reproject to your AOI:

gdalwarp -te <xmin>, <ymin>, <xmax>, <ymax> -tr <xres> <yres> -r <resample method> -s_srs <sourceEPSG> -t_srs EPSG:<destinationEPSG> <output.vrt> <outputf.tif>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.