Description Usage Arguments Value Author(s) Examples
interpolate
is a wrapper for idw0
and krige0
to interpolate several maps at once if locations of input values and desired output agree, even if output and maybe even input does not fit into memory. Works by writing output (and maybe input and intermediate results) to raster files.
fitMedianVariogram
is a wrapper of autofitVariogram
: fits variograms to a sample of plumes of a simulations
object and generates a variogram with the median parameters.
1 2 3 4 | interpolate(simulations, locations, kinds = 1, fun_interpolation,
tmpfile = "tmp_interpolate", overwrite = FALSE, chunksize = 1e+7)
fitMedianVariogram(simulations, plumes, locations, kinds = 1)
idw0z(formula = z ~ 1, data, newdata, y, idp = 2)
|
simulations |
|
locations |
indices of |
plumes |
indices of |
kinds |
layer of the |
fun_interpolation |
interpolation |
tmpfile |
filename for the raster file in case the result does not fit into memory; if |
overwrite |
boolean, if the file at |
chunksize |
maximal number of cells to be processed at once – forwarded to |
formula |
formula that defines the dependent variable as linear model of independent variables, forwarded to |
data |
data frame with dependent variable and coordinates, forwarded to |
newdata |
data frame or Spatial object with prediction locations, forwarded to |
y |
matrix, forwarded to |
idp |
, forwarded to |
interpolate
returns a RasterLayer-class
with the interpolations; it has the same size as the values
of the input simulations
and belongs to the same locations and plumes. Also projection is the same, so they can be combined by stack
. If it does not fit into memory it is saved at tmpfile
with the extension "_interpolated.grd"
.
The function may produce intermediate files at tmpfile
(with name extensions) that are deleted in the end.
fitMedianVariogram
returns a variogram model (vgm
).
idw0z
is idw0
with one extra default parameter: formula = z ~ 1
. This way it can directly be used as fun_interpolation
in interpolate
.
Kristina B. Helle, kristina.helle@uni-muenster.de
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ## Not run:
## takes some time
# get data
data(radioactivePlumes)
# generate median variogram from plumes
\dontrun{
## takes some seconds
medianVariogram = fitMedianVariogram(simulations = radioactivePlumes,
plumes = 1:nPlumes(radioactivePlumes),
kinds = 1)
}
## the result is in:
data(medianVariogram)
# prepare interpolation function
krige0var = replaceDefault(krige0, newDefaults = list(
formula = z ~ 1, model = medianVariogram, beta = NA, ... = NA),
type = "fun_interpolation.interpolate")[[1]]
# sample locations: proposed sensors
sampleLocations = sample.int(nLocations(radioactivePlumes), 50)
# interpolate
interpolated = interpolate(
simulations = radioactivePlumes,
kinds = 1,
locations = sampleLocations,
fun_interpolation = krige0var)
# combine plot original and interpolated
originalAndInterpolated = radioactivePlumes
originalAndInterpolated@values = stack(
originalAndInterpolated@values[[1]], interpolated)
OriginalAndInterpolated = extractSpatialDataFrame(
originalAndInterpolated, plumes = 1:4)
samplePoints =
as(OriginalAndInterpolated, "SpatialPointsDataFrame")[sampleLocations,]
spplotLog(OriginalAndInterpolated,
sp.layout = list("sp.points",
samplePoints, col = 3))
spplot(OriginalAndInterpolated,
sp.layout = list("sp.points",
samplePoints, col = 3))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.