NASA's Black Marble monthly data: Reprojection isn't accurate
Posted: Sat Sep 09, 2023 11:07 am America/New_York
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:
library(terra)
wd <- "path/"
r <- rast(paste0(wd, "VNP46A3.A2018091.h25v07.001.2021125122857.h5"))
crs(r) <- "epsg:4326"
2400*(15/(60*60))
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 (https://drive.google.com/drive/folders/1V115zpdU2-5fXssI6iWv_F6aNu4E5qA7?usp=drive_link) 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.
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:
library(terra)
wd <- "path/"
r <- rast(paste0(wd, "VNP46A3.A2018091.h25v07.001.2021125122857.h5"))
crs(r) <- "epsg:4326"
2400*(15/(60*60))
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 (https://drive.google.com/drive/folders/1V115zpdU2-5fXssI6iWv_F6aNu4E5qA7?usp=drive_link) 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.