Last chance! 50% off unlimited learning
Sale ends in
createDistMat(ssn, predpts = NULL, o.write = FALSE, amongpreds = FALSE)
FALSE
.FALSE
.ssn@path
directory, which store the pairwise
distances between sites associated with the SpatialStreamNetwork-class
object. See details section for additional information.A downstream hydrologic distance matrix provides enough information to meet the data requirements for both the tail-up and tail-down models. When two locations are flow-connected, the downstream hydrologic distance from the upstream location to the downstream location is greater than zero, but it is zero in the other direction. When two locations are flow-unconnected the downstream hydrologic distance will be greater than zero in both directions. A site's downstream hydrologic distance to itself is equal to zero. The format of the downstream hydrologic distance matrix is efficient because distance information needed to fit both the tail-up and tail-down models is only stored once. As an example, a matrix containing the total hydrologic distance between sites is easily calculated by adding the downstream distance matrix to its transpose.
The downstream hydrologic distances are calculated based on the binaryIDs and
stored as matrices. The matrices are stored in a directory named
If the argument predpts
is specified in the call to the function, the
downstream hydrologic distances between the observed and prediction sites will
also be computed. A new directory is created within the distance directory, with
the name corresponding to the predpoints ID (e.g. a
and
b
are used in the naming convention to distinguish between the two objects
(e.g. dist.net1.a and dist.net1.b). The matrices that these objects represent
are not necessarily square. In matrices of type a
, rows correspond to
observed locations and columns to prediction locations. In contrast, rows
correspond to prediction locations and columns to observed locations in matrices
of type b
. Direction is also preserved, with columns representing the
FROM site and rows representing the TO site in both object types. Again, row
and column names correspond to the pid attribute for each site.
If the argument amongpreds
is set to TRUE, the downstream hydrologic
distances will also be computed between prediction sites, for each network.
Again these are stored within the distance directory with the name
corresponding to the predpoints ID. The naming convention for these prediction
to prediction site distance matrices is the same as the distance matrices stored
in the
SpatialStreamNetwork-class
, importSSN
, createSSN
, glmssn
library(SSN)
# NOT RUN
# mf04 <- importSSN(system.file("lsndata/MiddleFork04.ssn",
# package = "SSN"), o.write = TRUE)
# use SpatialStreamNetwork object mf04 that was already created
data(mf04)
mf04 <- updatePath(mf04, system.file("lsndata/MiddleFork04.ssn",
package = "SSN"))
# create distance matrix among observed data points
createDistMat(mf04, o.write = TRUE)
# create distance matrix among observed data points
# and between observed and prediction points
data(mf04p)
mf04p <- updatePath(mf04p, system.file("lsndata/MiddleFork04.ssn",
package = "SSN"))
createDistMat(mf04p, predpts = "pred1km", o.write = TRUE)
# NOT RUN include prediction to prediction site distances
# createDistMat(mf04p, predpts = "pred1km", o.write = TRUE, amongpreds = TRUE)
Run the code above in your browser using DataLab