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[]
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.
- difference between the reprojected image and a shp.
- PYMXr.png (5.29 KiB) Not viewed yet
- User Services
- Posts: 266
- Joined: Mon Sep 30, 2019 8:33 am America/New_York
- Has thanked: 1 time
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 –
LAADS User Services
To receive news from LAADS DAAC direct to your inbox, email firstname.lastname@example.org with “subscribe” in the subject line.