Develop-ShiftLon
I have developed the function for Shifting the longitudes in maps. You can find it here: https://earth.bsc.es/gitlab/es/ClimProjDiags/-/blob/develop-ShiftLon/R/ShiftLon.R
Here there is an example of how to use it:
library(startR)
data <- startR::Start(dat = '/esarchive/recon/jma/jra55/monthly_mean/$var$_f6h/$var$_202001.nc',
var = 'tas', lon = 'all', lat = 'all', time = indices(1),
return_vars = list(lon = NULL, lat = NULL), retrieve = T)
data <- drop(data)
lon <- attr(data,'Variables')$common[['lon']]
lat <- attr(data,'Variables')$common[['lat']]
shifted <- ShiftLon(data = data, lon = lon, westB = -180, ncores = 1)
s2dv::PlotEquiMap(var = data, lon = lon, lat = lat, filled.continents = FALSE, toptitle = 'Original')
s2dv::PlotEquiMap(var = shifted$data, lon = shifted$lon, lat = lat, filled.continents = FALSE, toptitle = 'Shifted')
These are the outputs:
I will open a merge request to discuss if something has to be improved/modified.
Thank you!
Carlos