View source: R/function_AllUpstreamSubids.R
AllUpstreamSubids | R Documentation |
Function to find all SUBIDs of upstream sub-catchments for a single sub-catchment.
AllUpstreamSubids(
subid,
gd,
bd = NULL,
sort = FALSE,
get.weights = FALSE,
write.arcgis = FALSE
)
subid |
SUBID of a target sub-catchment (must exist in |
gd |
A data frame, containing 'SUBID' and 'MAINDOWN' columns, e.g. an imported 'GeoData.txt' file. Mandatory argument. See 'Details'. |
bd |
A data frame, containing 'BRANCHID' and 'SOURCEID' columns, and 'MAINPART' with argument |
sort |
Logical. If |
get.weights |
Logical. If |
write.arcgis |
Logical. If |
AllUpstreamSubids
finds all upstream SUBIDs of a given SUBID (including itself but not
including potential irrigation links or groundwater flows) using GeoData columns 'SUBID' and 'MAINDOWN', i.e the full upstream catchment.
If a BranchData file is provided, the function will also include upstream areas which are connected through an upstream bifurcation. The
results can be directly used as 'partial model setup file' ('pmsf.txt') using the export function WritePmsf
.
If argument get.weights
is set to TRUE
, weighting fractions are returned along with upstream SUBIDs. The fractions are based
on column 'MAINPART' in argument bd
. The function considers fractions from bifurcation branches which flow into the basin, and
fractions where bifurcation branches remove discharge from the basin. Fractions are incrementally updated, i.e. nested bifurcation fractions
are multiplied.
For details on bifurcation handling in HYPE, see the HYPE online documentation for BranchData.txt.
If get.weights
is FALSE
, AllUpstreamSubids
returns a vector of SUBIDs, otherwise a two-column data frame with SUBIDs in
the first, and flow weight fractions in the second column.
UpstreamGeoData
, AllDownstreamSubids
te <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
AllUpstreamSubids(subid = 63794, gd = te)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.