Description Usage Arguments Value Examples
View source: R/stackRasterList.R
This function is intended to be used prior to passing covariates to krigeLgm in order for the rasters for all covariates to have the same projection and same resolution.
1 2 3 4 5 6 | stackRasterList(x, template = x[[1]], method = "ngb", mc.cores=NULL)
spdfToBrick(x,
template,
logSumExpected=FALSE,
pattern = '^expected_[[:digit:]]+$'
)
|
x |
A list of |
template |
A raster whose projection and resolution all other rasters will be aligned with. |
method |
The method to use, either "ngb", or "bilinear". Can be a vector of the same length as x to specify different methods for each raster. If |
mc.cores |
If non-null, |
logSumExpected |
return the log of the sum of offsets |
pattern |
expression to identify layers to rasterize in |
A raster brick, with one layer for each variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | myCrs = CRS("+proj=utm +zone=17 +ellps=GRS80 +units=m +no_defs")
mylist = list(a=raster(matrix(1:9, 3, 3), 0,1,0,1,
crs=myCrs),
b=raster(matrix(1:25, 5, 5), -1, 2, -1, 2,
crs=myCrs)
)
mystack = stackRasterList(mylist)
mystack
mylist = list(
a=raster(matrix(1:36, 6, 6,byrow=TRUE), 0,1000,0,1000,
crs=myCrs),
b=raster(matrix(1:144, 12, 12), -200, 200, -200, 200,
crs=myCrs),
c=raster(matrix(1:100, 10, 10), -5000,5000,-5000,5000,
crs=myCrs)
)
if(.Platform$OS.type=='unix' & require('rgdal', quietly=TRUE)) {
mystack = stackRasterList(mylist,mc.cores=2)
mystack
}
plot(mystack[["b"]], main="stack b")
plot(mystack[['a']],add=TRUE,col=grey(seq(0,1,len=12)),alpha=0.8,legend=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.