This function is the interpolation routine of the rtop-package.
The simplest way of calling the function is with an rtop-object that
contains the fitted variogram model and all the other necessary data (see
createRtopObject
or rtop-package
).
The function will, if called with covariance matrices between observations
and between observations and prediction locations, use these for the interpolation.
If the function is called without these matrices, varMat
will be
called to create them. These matrices can therefore be reused if necessary,
an advantage as it is computationally expensive to create them.
The interpolation that takes part within rtopKrige.default
is based on
the semivariance matrices between observations and between observations and prediction
locations. It is therefore possible to use this function also to interpolate
data where the matrices have been created in other ways, e.g. based on distances
in physiographical space or distances along a stream.
The function returns the weights rather than the predictions if wret = TRUE
.
This is useful for batch processing of time series, e.g. once the weights are
created, they can be used to compute the interpolated values for each time step.
rtop is able to take some advantage of multiple CPUs, which can be invoked with the
parameter nclus
. When it gets a number larger than one, rtopKrige
will start a cluster with nclus
workers,
if the parallel
-package has been installed.
The parameter singularSolve
can be used when some areas are almost completely overlapping. In this case, the discretization of them might be equal, and the covariances to other areas will also be equal. The kriging matrix will in this case be singular. When singularSolve = TRUE
, rtopKrige
will remove one of the neighbours, and instead work with the mean of the two observations. An overview of removed neighbours can be seen in the resulting object, under the name removed
.
Kriging of time series is possible when observations
and predictionLocations
are spatiotemporal objects of type STSDF
. The interpolation is
still spatial, in the sense that the regularisation of the variograms are just done
using the spatial extent of the observations, not a possible temporal extent, such as
done by Skoien and Bloschl (2007). However, it is possible to make predictions based on observations
from different time steps, through the use of the lag-vectors. These vectors describe a typical "delay"
for each observation and prediction location. This delay could for runoff related variables be similar
to travel time to each gauging location. For a certain prediction location, earlier time steps would be picked for neighbours with shorter travel time and later time steps for neighbours with slower travel times.
The lagExact parameter indicates whether to use a weighted average of two time steps, or just the time step which is closest to the difference in lag times.
The use of lag times should in theory increase the computation time, but might, due to different computation methods, even speed up the computation when the number of neighbours to be used (parameter nmax) is small compared to the number of observations. If computation is slow, it can be useful to test olags = rep(0, dim(observations)[1]) and similar for predictionLocations.