Page 1 of 1

NASA's Black Marble monthly data: Reprojection isn't accurate

Posted: Sat Sep 09, 2023 11:07 am America/New_York
by nikos_geography
I downloaded NASA's Black Marble monthly nighttime light NTL data, VNP46A3. Ι am trying to set the projection to EPSG:4326 but the resulting product (All_Angles_Snow_Free) seems to go go way off. For example, I wanted to download NTL data for the city of Mumbai, India. After reprojecting the NTL (product 5 (All_Angles_Snow_Free) from the .h5) the result is shown in the attachement.

At the bottom if the image is a shp of Mumbai and the red circle in the top indicates where Mumbai is in the NTL image. Clearly something's not right.

I downloaded the image from here (LAADS-DAAC, Level-1 and Atmosphere Archive & Distribution System Distributed Active Archive Center). The code I used to extract the NTL radiance image is:


wd <- "path/"

r <- rast(paste0(wd, "VNP46A3.A2018091.h25v07.001.2021125122857.h5"))
crs(r) <- "epsg:4326"


h = 25
v = 7

ext(r) = c(-180+h*10,-180+(h+1)*10, (v-2)*10,(v-1)*10)

ntl <- r[[5]]
writeRaster(ntl, paste0(wd, "ntl.tif"), overwrite = TRUE)

What's wrong with the code? From here ( you can download the .h5 image if you don't want to use NASA's website. I am using R 4.3.1 and RStudio 2023.06.2+561.

Re: NASA's Black Marble monthly data: Reprojection isn't accurate

Posted: Mon Sep 11, 2023 12:42 pm America/New_York
by LAADS_UserServices_M
Hi Nikolaos,
Yes, it appears that the issue lies in how you're calculating the spatial extent. This is how you calculate the bounding box using the horizontal (h) and vertical(v) time number –

WestBoundCoord = (10*HorizontalTileNumber) - 180
NorthBoundCoord = 90-(10*VerticalTileNumber)

EastBoundCoord = WestBoundCoord + 10
SouthBoundCoord = NorthBoundCoord - 10

I've noticed that you're using the R program to extract the VNP46A3 layer. We actually have a Python script that accomplishes the same task. Here is a script for you reference –