I have two rasters, with same dimensions (nrow, ncol, and ncell) and same coordinate system. They differ however by their extent, x min/max points:
Raster 1: has xmin/max -180, 180, i.e. Americas left, Russia right
Raster 2: has 0, 360, i.e. central Africa/Europe left, West Africa/Europe right
I want to align them in R, so that both have -180, 180. I tried several functions such as
alignExtent() but all seem to give the right extent, but will basically show only half of the values, i.e. it looks like half of the world disappeared in the new plot.
Which function should I use instead? What is the name of the operation I want to do?
library(raster) r1 <- raster(nrows=360, ncols=720) r2 <- raster(nrows=360, ncols=720, xmn=0, xmx=360) r1 <- 1:(360*720) r2 <- 1:(360*720) ## use projectRaster? r2_in1 <- projectRaster(r2,r1) plot(r2_in1)