Reputation: 25
I have files from ERA5 that have extent from 0 to 360 (lon) and -90 to 90 (lat)
Example:
> era5_sr
class : SpatRaster
dimensions : 721, 1440, 744 (nrow, ncol, nlyr)
resolution : 0.25, 0.25 (x, y)
extent : -0.125, 359.875, -90.125, 90.125 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs
source : ssrd.hh.fc.era5.01.2018.nc
varname : ssrd (Surface solar radiation downwards)
names : ssrd_1, ssrd_2, ssrd_3, ssrd_4, ssrd_5, ssrd_6, ...
unit : J m**-2, J m**-2, J m**-2, J m**-2, J m**-2, J m**-2, ...
time : 2018-01-01 to 2018-01-31 23:00:00 UTC
Is there a way to modify the dimensions from -180 to 180 (lon) using tidy / dplyr ? I know that terra we can do it easily through another raster of the desired extent but I need to find a way through tidy.
Upvotes: 0
Views: 60
Reputation: 47061
The easy approach with terra is not to do what you suggest, but rather do
x <- terra::rotate(era5_sr)
This is a very particular operation. I do not think there is an alterative that is more tidy.
Upvotes: 3