Detects braiding (multiple flow channels between two locations) within a river network object, and returns a logical value for specifying braiding within a river network object.

checkbraidedTF(rivers, toreturn = "rivers", progress = TRUE)

Arguments

rivers

The river network object to check.

toreturn

Specifying toreturn="rivers" (the default) will return a river network object with a value of TRUE or FALSE assigned to the $braided element of the river network object. Specifying toreturn="logical" will just return TRUE if braiding is detected or FALSE if no braiding is detected. Specifying toreturn="routes" will return the first two differing routes detected, which may be useful in identifying where the problem lies.

progress

Whether to show the progress bar. Defaults to TRUE.

Note

This function is called within cleanup, which is recommended in most cases.

Examples

data(Gulk,KilleyW) Gulk <- setmouth(seg=1, vert=1, rivers=Gulk) plot(x=Gulk)
checkbraidedTF(rivers=Gulk, toreturn="logical")
#> | | | 0% | |================== | 25% | |========================== | 38% | |=================================== | 50% | |============================================ | 62% | |==================================================== | 75% | |============================================================= | 88% | |======================================================================| 100%
#> [1] FALSE
KilleyW <- setmouth(seg=1, vert=288, rivers=KilleyW) plot(x=KilleyW)
checkbraidedTF(rivers=KilleyW, toreturn="logical")
#> | | | 0% | |======================================================================| 100%
#> [1] TRUE
checkbraidedTF(rivers=KilleyW, toreturn="routes")
#> | | | 0% | |======================================================================| 100%
#> $route1 #> [1] 16 15 4 2 1 #> #> $route2 #> [1] 16 14 12 11 9 8 6 5 4 2 1 #>
KilleyW.1 <- checkbraidedTF(rivers=KilleyW, toreturn="rivers")
#> | | | 0% | |======================================================================| 100%
str(KilleyW.1)
#> List of 12 #> $ sp :Formal class 'SpatialLinesDataFrame' [package "sp"] with 4 slots #> .. ..@ data :'data.frame': 1 obs. of 1 variable: #> .. .. ..$ Id: num 0 #> .. ..@ lines :List of 1 #> .. .. ..$ :Formal class 'Lines' [package "sp"] with 2 slots #> .. .. .. .. ..@ Lines:List of 16 #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:288, 1:2] 183650 183646 183639 183586 183550 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:21, 1:2] 183628 183618 183618 183613 183592 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:23, 1:2] 183628 183629 183659 183716 183746 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:17, 1:2] 184055 184054 184052 184033 184009 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:32, 1:2] 183486 183497 183514 183530 183558 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:9, 1:2] 183641 183610 183583 183555 183535 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:18, 1:2] 183641 183622 183602 183580 183561 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:12, 1:2] 183944 183933 183913 183870 183839 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:21, 1:2] 183942 183935 183923 183909 183896 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:31, 1:2] 183942 183943 183954 183954 184025 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:3, 1:2] 183934 183940 183942 1165897 1165938 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:28, 1:2] 184230 184228 184226 184235 184242 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:35, 1:2] 184230 184220 184209 184209 184176 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:11, 1:2] 184385 184379 184365 184355 184338 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:107, 1:2] 184385 184384 184384 184384 184381 ... #> .. .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot #> .. .. .. .. .. .. .. ..@ coords: num [1:50, 1:2] 185089 185088 185089 185084 185069 ... #> .. .. .. .. ..@ ID : chr "0" #> .. ..@ bbox : num [1:2, 1:2] 163092 1161675 195751 1188421 #> .. .. ..- attr(*, "dimnames")=List of 2 #> .. .. .. ..$ : chr [1:2] "x" "y" #> .. .. .. ..$ : chr [1:2] "min" "max" #> .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot #> .. .. .. ..@ projargs: chr "+proj=aea +lat_1=55 +lat_2=65 +lat_0=50 +lon_0=-154 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0" #> $ lineID :'data.frame': 16 obs. of 3 variables: #> ..$ rivID : int [1:16] 1 2 3 4 5 6 7 8 9 10 ... #> ..$ sp_line: int [1:16] 1 1 1 1 1 1 1 1 1 1 ... #> ..$ sp_seg : int [1:16] 1 2 3 4 5 6 7 8 9 10 ... #> $ lines :List of 16 #> ..$ : num [1:288, 1:2] 183650 183646 183639 183586 183550 ... #> ..$ : num [1:21, 1:2] 183628 183618 183618 183613 183592 ... #> ..$ : num [1:23, 1:2] 183628 183629 183659 183716 183746 ... #> ..$ : num [1:17, 1:2] 184055 184054 184052 184033 184009 ... #> ..$ : num [1:32, 1:2] 183486 183497 183514 183530 183558 ... #> ..$ : num [1:9, 1:2] 183641 183610 183583 183555 183535 ... #> ..$ : num [1:18, 1:2] 183641 183622 183602 183580 183561 ... #> ..$ : num [1:12, 1:2] 183944 183933 183913 183870 183839 ... #> ..$ : num [1:21, 1:2] 183942 183935 183923 183909 183896 ... #> ..$ : num [1:31, 1:2] 183942 183943 183954 183954 184025 ... #> ..$ : num [1:3, 1:2] 183934 183940 183942 1165897 1165938 ... #> ..$ : num [1:28, 1:2] 184230 184228 184226 184235 184242 ... #> ..$ : num [1:35, 1:2] 184230 184220 184209 184209 184176 ... #> ..$ : num [1:11, 1:2] 184385 184379 184365 184355 184338 ... #> ..$ : num [1:107, 1:2] 184385 184384 184384 184384 184381 ... #> ..$ : num [1:50, 1:2] 185089 185088 185089 185084 185069 ... #> $ connections: num [1:16, 1:16] NA 3 3 NA NA NA NA NA NA NA ... #> $ lengths : num [1:16] 9824 522 625 602 956 ... #> $ names : logi [1:16] NA NA NA NA NA NA ... #> $ mouth :List of 2 #> ..$ mouth.seg : num 1 #> ..$ mouth.vert: num 288 #> $ sequenced : logi FALSE #> $ tolerance : num 5 #> $ units : chr "m" #> $ braided : logi TRUE #> $ cumuldist :List of 16 #> ..$ : num [1:288] 0 14.1 28.1 100.5 138.8 ... #> ..$ : num [1:21] 0 15.4 15.4 33.4 61.9 ... #> ..$ : num [1:23] 0 2.23 31.62 88.99 119.78 ... #> ..$ : num [1:17] 0 12.7 28.7 59.9 88.2 ... #> ..$ : num [1:32] 0 21.1 43.4 60.9 88.6 ... #> ..$ : num [1:9] 0 33 61 90.5 127.1 ... #> ..$ : num [1:18] 0 20.4 49.7 75.2 96.2 ... #> ..$ : num [1:12] 0 12.4 32.9 77.8 108.4 ... #> ..$ : num [1:21] 0 13.4 40.7 70.2 101.5 ... #> ..$ : num [1:31] 0 1.45 14.19 14.19 123.5 ... #> ..$ : num [1:3] 0 40.9 49 #> ..$ : num [1:28] 0 21.9 39.7 57.3 69.5 ... #> ..$ : num [1:35] 0 13 30.8 30.8 74.1 ... #> ..$ : num [1:11] 0 8.19 33.81 53.99 78.67 ... #> ..$ : num [1:107] 0 17.8 29.8 29.8 78.3 ... #> ..$ : num [1:50] 0 3.01 21.61 57.28 93.19 ... #> - attr(*, "class")= chr "rivernetwork"