I am working with NOAA Files: https://psl.noaa.gov/data/gridded/data.cpc.globaltemp.html
They have the projection EPSG:9001.
> extent(raster.nc)
class : Extent
xmin : 0
xmax : 360
ymin : -90
ymax : 90
So the central point is somewhere in the Pacific. All other files I work with are EPSG:4326, like Shapefiles of the World: https://hub.arcgis.com/datasets/esri::world-countries-generalized
extent(world.shape)
class : Extent
xmin : -180
xmax : 180
ymin : -89
ymax : 83.6236
I cannot seem to get those two together.
projectRaster(raster.nc, crs=CRS(projection(world.shape)),method = "bilinear")
leads to
Error in if (yn == yx) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In `dim<-`(`*tmp*`, value = c(nr, nc)) :
NAs introduced by coercion to integer range
(also if I do not use CRS())
How can I solve this problem? I would like to work with EPSG:4326
You can use
terra::rotate(or its outdated "raster" equivalent)Some example data
Solution
Illustration