CheckConn: CheckConn checks a re-expressed network.

Description Usage Arguments Value Examples

View source: R/network_expression.R

Description

CheckConn checks that a re-expressed network matches it's original expression.

Usage

1
CheckConn(ind, upstream = TRUE, printInds = FALSE)

Arguments

ind

The indices to check.

upstream

Logical, check connectivity upstream (TRUE) or downstream (FALSE).

printInds

Logical, print the indices checked.

Value

Logical, code halts at first FALSE.

Examples

 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
## Not run: 
  for (ii in seq(1,2720000,1000)) { print(ii); print(CheckConn(ii)) }
  for (ii in seq(1,2720000,1000)) { print(ii); print(CheckConn(ii), up=FALSE) }
  for (ii in seq(1,2000)) { print(ii); print(CheckConn(ii)) }
  for (ii in seq(1,2000)) { print(ii); print(CheckConn(ii),up=FALSE) }

load("/home/jamesmcc/WRF_Hydro/DOMAIN_library/BoCr_100m_1km_NHDPlus_2015_08_11/Route_Link.reInd.Rdb")

load("/home/jamesmcc/WRF_Hydro/CONUS_IOC/DOMAIN/RouteLink_2015_07_31.reExpFrom.Rdb")
load("/home/jamesmcc/WRF_Hydro/DOMAIN_library/BoCr_100m_1km_NHDPlus_2015_08_11/Route_Link.reExpFrom.Rdb")
## number of contributing/upstream links.
nContrib<-from$end-from$start
nContrib[which(from$start>0)] <-nContrib[which(from$start>0)] +1
table(nContrib) 
for (ii in which(nContrib >3)) { print(ii); print(CheckConn(ii),up=FALSE) } 
comIdWhContribGt3 <-
  data.frame(nContrib = nContrib[which(nContrib > 16)],
             comId = reInd$comId[which(nContrib > 16)] )
comIdWhContribGt3 <- comIdWhContribGt3[order(comIdWhContribGt3$nContrib),]
write.table(comIdWhContribGt3, row.names=FALSE,
            file='~/WRF_Hydro/CONUS_IOC/DOMAIN/RouteLink4.comIdWhContribGt3.txt')

load("/home/jamesmcc/WRF_Hydro/CONUS_IOC/DOMAIN/RouteLink_2015_07_31.reExpTo.Rdb")
load("/home/jamesmcc/WRF_Hydro/DOMAIN_library/BoCr_100m_1km_NHDPlus_2015_08_11/Route_Link.reExpFrom.Rdb")
## number of downstream/outflow links.
nOut<-to$end-to$start
nOut[which(to$start>0)] <-nOut[which(to$start>0)] +1
table(nOut)
for (ii in which(nOut >1)) { print(ii); print(CheckConn(ii),up=FALSE) }
comIdWhOutGt1 <-
  data.frame(nOut = nOut[which(nOut > 1)],
             comId = reInd$comId[which(nOut > 1)] )
comIdWhOutGt1 <- comIdWhOutGt1[order(comIdWhOutGt1$nOut),]
write.table(comIdWhOutGt1, row.names=FALSE,
            file='~/WRF_Hydro/CONUS_IOC/DOMAIN/RouteLink4.comIdWhOutGt1.txt')

load("/home/jamesmcc/WRF_Hydro/CONUS_IOC/DOMAIN/RouteLink_2015_07_31.reInd.Rdb")

## End(Not run)  #dontrun

mccreigh/rwrfhydro documentation built on May 12, 2018, 3:08 a.m.