Skip to contents

Get reach number from node number

Usage

get_xml_reach_num_by_node_num(
  node_num,
  upstream = TRUE,
  xp = xml2::read_xml(cfg$project$path),
  cfg
)

Arguments

node_num

numeric node number in the SIC model

upstream

logical if TRUE, get the reach number from the upstream node, otherwise downstream

xp

A xml_document of the XML project file. Default is the one in the configuration

cfg

a config object. Configuration to use. See loadConfig for details

Value

integer the reach number in the XML project file

Details

In case of several XML nodes are matching, the first one is returned. Providing cfg is not necessary if xp is provided.

Examples

xp <- xml2::read_xml(system.file("sic_project_test1.xml", package = "rsic2"))
get_xml_reach_num_by_node_num(1, upstream = TRUE, xp)
#> [1] 1
get_xml_reach_num_by_node_num(2, upstream = FALSE, xp)
#> [1] 1