| flowdir | R Documentation |
Computes nondispersive flow/drainage direction according to path-based methods over grid-based digital elevation models.
This is an alternative to terrain(v="flowdir").
## S4 method for signature 'SpatRaster'
flowDir(x, lambda=0.5, deviation_type=c("ltd","lad"), max_iters=10^6, filename="", ...)
x |
SpatRaster with elevation data |
lambda |
Parameter between 0 and 1 |
deviation_type |
Character. Available options are |
max_iters |
maximum iterations for drainage path starting points detection |
filename |
character. Output filename |
... |
additional arguments for writing files as in |
The algorithm is an adaptation of the one proposed by Li et al. (2022) and Orlandini et al. (2003). This function is experimental and under development: results are to be verified.
SpatRaster
Emanuele Cordano
Orlandini, S., G. Moretti, M. Franchini, B. Aldighieri, and B. Testa (2003). Path-based methods for the determination of nondispersive drainage directions in grid-based digital elevation models, Water Resour. Res., 39, 1144, doi:10.1029/2002WR001639, 6. https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2002WR001639
Li, Z., Shi, P., Yang, T., Wang, C., Yong, B., & Song, Y. (2022). An improved D8-LTD for the extraction of total contributing area (TCA) by adopting the strategies of path independency and local dispersion. Water Resources Research, 58, e2021WR030948. https://doi.org/10.1029/2021WR030948 https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2021WR030948
Useful presentation: http://www.idrologia.unimore.it/orlandini/web-archive/seminars/nyc-2008-2.pdf
terrain, watershed, flowAccumulation
elev1 <- array(NA,c(9,9))
elev2 <- elev1
dx <- 1
dy <- 1
for (r in 1:nrow(elev1)) {
y <- (r-5)*dx
for (c in 1:ncol(elev1)) {
x <- (c-5)*dy
elev1[r,c] <- 5*(x^2+y^2)
elev2[r,c] <- 10+5*(abs(x))-0.001*y
}
}
## Elevation raster
elev1 <- rast(elev1)
elev2 <- rast(elev2)
t(array(elev1[],rev(dim(elev1)[1:2])))
t(array(elev2[],rev(dim(elev2)[1:2])))
plot(elev1)
plot(elev2)
## Flow direction raster
fdir1 <- flowDir(elev1, lambda=1)
fdir2 <- flowDir(elev2, lambda=1)
elev <- rast(system.file('ex/elev.tif',package="terra"))
fdirlad1 <- flowDir(elev, lambda=0.5, deviation_type="lad")
fdirlad2 <- flowDir(elev, lambda=0.5, deviation_type="lad")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.