I have a raster file that extends longitudinally from 0° to 360°. Using R, I'd like to wrap the raster at 180°, so that longitudes between 180° and 360° are translated to the interval [-180°, 0°]. Is there an existing function or package that can do this?
library(raster) x <- raster(somefilename) rotate(x)
"rotate" does this task (0/360 to -180/180), and that is all it does.
Otherwise it's reasonably straightforward to
crop() to separate longitude ranges,
shift() one of them in "x", and
merge() them back together.
findMethods("rotate")[["Raster"]] for details of what the function does.