warpGrid | R Documentation |
Warp grid to allow plotting in a different projection.
warpGrid(
data,
original.CRS = "+init=epsg:4326",
new.CRS = "+init=epsg:3995",
int.method = "bilinear"
)
data |
A C4R grid (or multimember C4R grid) object, or climatology C4R grid. |
original.CRS |
character as passed to function |
new.CRS |
character string, as passed to function |
int.method |
Resampling method. Default to |
This function is a wrapper of the gdal warping capabilities via gdalwarp.
int.method
By default bilinear interpolation is applied to get a complete grid in the target projection. Other options are "near"
, "cubic"
,
"cubicspline"
etc., passed to the argument r
in gdalUtils::gdalwarp
.
Warped grid with the structure of a C4R grid.
A. Casanueva, J. Bedia, M. Iturbide
library(climate4R.datasets)
data(ncep_hgt500_2000)
grid <- warpGrid(climatology(ncep_hgt500_2000))
# Example of application: plot in polar stereographic projection
library(visualizeR)
l1 <- get(load(paste0(find.package("visualizeR"), "/countries.rda"))) # world coastline
l1 <- sp::spTransform(l1[[2]], CRSobj = attr(grid$xyCoords, "projection"))
visualizeR::spatialPlot(grid, sp.layout = list(list(l1, first = FALSE)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.