ShiftLon | R Documentation |
Shift the longitudes of a data array. Only reasonable for global longitude shifting. It is useful for map plotting or aligning datasets.
ShiftLon(data, lon, westB, lon_dim = "lon", ncores = NULL)
data |
A named multidimensional array with at least 'lon_dim' dimension. |
lon |
A numeric vector of longitudes. The values are expected to be monotonic increasing. |
westB |
A number indicating the west boundary of the new longitudes. |
lon_dim |
A character string indicating the name of the longitude dimension in 'data'. The default value is 'lon'. |
ncores |
An integer indicating the number of cores used for computation. The default value is NULL (use only one core). |
A list of 2:
data |
Array of the shifted data with the same dimensions as parameter 'data'. |
lon |
The monotonic increasing new longitudes with the same length as parameter 'lon' and start at 'westB'. |
data <- array(data = 1:50, dim = c(lon = 360, lat = 181))
lon <- array(data = 0:359, dim = c(lon = 360))
lat <- -90:90 ## lat does not change
shifted <- ShiftLon(data = data, lon = lon, westB = -180, ncores = 1)
## Not run:
s2dv::PlotEquiMap(var = data, lon = lon, lat = lat, filled.continents = FALSE)
s2dv::PlotEquiMap(var = shifted$data, lon = shifted$lon, lat = lat, filled.continents = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.