vis_river: Visialize DEM river as lines (not raster)

Description Usage Arguments Value Author(s) See Also Examples

Description

Convert flow accumulation raster to line segments and plot it. This enables much faster drawing, making it suitable e.g. for drawing small maps with the river added on top in the corner of plots, e.g. with berryFunctions::smallPlot as in the example.

Usage

1
2
3
vis_river(dem, proj = NA, prop = 0.98, col = rivPal(n = 150), lwd = 1:6,
  add = FALSE, legend = TRUE, title = "Catchment area  [1000 km^2]",
  legargs = NULL, quiet = FALSE, ...)

Arguments

dem

List returned by read_dem or character string giving a directory (passed to read_dem).

proj

Projection passed to read_asc. DEFAULT: NA

prop

Proportion of catchment areas (of each raster cell) beyond which a channel counts as river. Lower values mean longer stretches identified as rivers. DEFAULT: 0.98

col

Color scale. DEFAULT: rivPal(n=150)

lwd

Line width range. DEFAULT: 1:6

add

Logical: add to existing plot? DEFAULT: FALSE

legend

Logical: add colPointsLegend? DEFAULT: TRUE

title

Character: Legend title. DEFAULT: "Catchment area [1000 km^2]"

legargs

List of arguments passed to colPointsLegend.

quiet

Logical: should progress messages be suppressed? DEFAULT: FALSE

...

Further arguments passed to segments.

Value

data.frame with segment indices

Author(s)

Berry Boessenkool, berry-b@gmx.de, Mar 2017

See Also

vis_dem, read_dem

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
# To be added

if(FALSE){
dem <- read_dem("U:/mHM_shared/basel_6935051/input/morph", proj=3035)
op <- par(no.readonly=TRUE)
vis_dem(dem, png=FALSE)
riv <- vis_river(dem)
par(op)
ca <- riverlines(dem, riv, col="orange")
# for large catchments, computing is time consuming, so plotting can be outsourced

library(berryFunctions)
logHist(dem$facc*(facc$cellsize/1000)^2, breaks=30) # km^2
}

# Add rivers as small plot
## Not run:  ## Not run in CRAN checks to avoid downloading background map
library(OSMscale)
map <- pointsMap(lat=riv$y, lon=riv$x, zoom=7, proj=pll(), plot=F)
par(mar=c(0,0,0,0))
plot(map, removeMargin=FALSE)
vis_river(facc, add=TRUE, lwd=1:3)

par(op)
plot(cumsum(rnorm(300)), type="l") # some gauge properties, e.g.
smallPlot({
        plot(map, removeMargin=FALSE)
        vis_river(facc, add=TRUE, lwd=1:3, legend=FALSE)
        points(8, 47.55, col="red", pch=3, lwd=3, cex=2)
        }, x1=0, x2=0.4, y1=0.77, y2=1, mar=0, border=NA, bg=NA)


## End(Not run) # end dontrun

brry/mhmVis documentation built on May 13, 2019, 7:53 a.m.