Description Usage Arguments Value Author(s) See Also Examples
This code was includes bicubic interpolation and bilinear interpolation
adapted from Numerical Recipes in C: The are of scientific computing
http://www.nrbook.com/nr3/ (chapter 3... bicubic interpolation) and a
bicubic interpolation from http://www.paulinternet.nl/?page=bicubic in
java code.
Inputs are a list of points to interpolate to from raster
objects of class 'asc' (adehabitat package), 'RasterLayer' (raster package)
or 'SpatialGridDataFrame' (sp package).
1 | interp2pnt(mat, xout, yout, xin = NULL, yin = NULL, type = 2)
|
mat |
a matrix of data that can be a raster matrix of class 'asc'
(adehabitat package), 'RasterLayer' (raster package) or
'SpatialGridDataFrame' (sp package) |
xout |
a vector of data representing x coordinates of the output grid. Resulting grid must have square cell sizes if mat is of class 'asc', 'RasterLayer' or 'SpatialGridDataFrame'. |
yout |
a vector of data representing x coordinates of the output grid. Resulting grid must have square cell sizes if mat is of class 'asc', 'RasterLayer' or 'SpatialGridDataFrame'. |
xin |
a vector identifying the locations of the columns of the input data matrix. These are automatically populated if mat is of class 'asc', 'RasterLayer' or 'SpatialGridDataFrame'. |
yin |
a vector identifying the locations of the rows of the input data matrix. These are automatically populated if mat is of class 'asc', 'RasterLayer' or 'SpatialGridDataFrame'. |
type |
an integer value representing the type of interpolation method
used. |
A vector of values in the same order and length of the inputs
xout
and yout
.
Jeremy VanDerWal jjvanderwal@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
#create some data
tx = seq(0,3,0.1)
ty = seq(0,3,0.1)
txy = data.frame(x=tx,y=ty)
#create a matrix
tmat = matrix(runif(16,1,16),nr=4)
#do the interpolations
txy$bilinear1 = interp2pnt(tmat,tx,ty,type=1)
txy$bicubic2 = interp2pnt(tmat,tx,ty,type=2)
txy$bicubic3 = interp2pnt(tmat,tx,ty,type=3)
#look at the data
head(txy)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.