Context
I am using terra::rast()
to read a nc
file and plot it.
But the ploted map is upside down.
When I used raster::raster()
to read the nc
file and plot it. The map is right.
Question
How can I make the upside down map right when using terra::rast()
to read the nc
?
Reproducible code
I have uploaded pm2.5_year_2013.nc
data on my github.
The data can be found at
CodePudding user response:
It looks like this was fixed in the development version of "terra" (or the version of GDAL that it uses on windows)
install.packages('terra', repos='https://rspatial.r-universe.dev')
And now it works as expected.
library(terra)
#terra 1.6.30
f <- "pm2.5_year_2011.nc"
r = rast(f)
plot(r)