Description Usage Arguments Value Note Author(s) Examples
Pass values along a river network when the river network has more segments than the prediction polygons.
1 2 | netProp(network, from = "FROMJCT", to = "TOJCT", pred = "pred",
iprint = 1)
|
network |
object of class |
from |
name of the column giving the endpoint ID of each line segment |
to |
name of the column giving the start ID of each line segment |
pred |
name of column with predictions |
iprint |
if iprint >= 1 the function will give some information about the convergence of the value propagation. Use iprint = 0 to suppress this output. |
The function will propagate the predictions upwards along the river network.
The result is a SpatialLinesDataFrame
with
predictions for all line segments, which can easier be plotted.
This function works when the topology of the river network is similar to the
example here, that the from
-column is always the upstream part of a river
segment, and that all segments are actually connected.
Jon Olav Skoien
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 | ## Not run:
library(rgdal)
rpath = system.file("extdata",package="rtop")
observations = readOGR(rpath,"observations")
predictionLocations = readOGR(rpath,"predictionLocations")
observations$obs = observations$QSUMMER/observations$AREASQKM
# Setting some parameters
params = list(geoDist = TRUE, rresol = 25, cloud = FALSE, model = "Sph")
# Build an object
rtopObj = createRtopObject(observations,predictionLocations,
formulaString = obs~1, params = params)
# Fit a variogram (function also creates it)
rtopObj = rtopFitVariogram(rtopObj)
# Check the variogram fit
rtopObj = checkVario(rtopObj, cloud = TRUE, identify = TRUE)
# Predicting at prediction locations
rtopObj = rtopKrige(rtopObj)
# Cross-validation
rtopObj = rtopKrige(rtopObj,cv=TRUE)
cor(rtopObj$predictions$observed, rtopObj$predictions$var1.pred)
rnet = readOGR(".", "rnet")
pred = rtopObj$predictions
rnet$pred =
pred$var1.pred[match(rnet$TOJCT, pred$JCTID)]
# will only plot for a few discontinous river segments
spplot(rnet, "pred", col.regions = bpy.colors())
rnet = netProp(rnet)
# will show a prediction for all segments
spplot(rnet, "pred", col.regions = bpy.colors())
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.