flow,GRaster-method | R Documentation |
The flow()
function uses a raster representing elevation to compute other rasters representing:
Flow accumulation;
Direction of flow;
Watershed basins;
Flooded areas; and/or
Topographic convergence (log of flow accumulation divided by local slope).
More details about the computations can be found at the help page for the GRASS module r.terraflow
] (see grassHelp("r.terraflow")
)
## S4 method for signature 'GRaster'
flow(
x,
direction = "multi",
return = "accumulation",
dirThreshold = Inf,
scratchDir = NULL
)
x |
A |
direction |
Character: Either |
return |
Character vector: Indicates what rasters to return. Partial matching is used and case is ignored. Options include:
|
dirThreshold |
Numeric (default is |
scratchDir |
Character or |
A GRaster
.
flowPath()
, streams()
, the GRASS module r.terraflow
(see grassHelp("r.terraflow")
)
if (grassStarted()) {
# Setup
library(terra)
# Example data
madElev <- fastData("madElev")
elev <- fast(madElev)
# Calculate flow accumulation and watershed basins
water <- flow(elev, return = c("accum", "basins"))
water
elevWater <- c(elev, water)
plot(elevWater)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.