
Function to compute flood duration for point coordinates along the German federal waterways Elbe and Rhine using the 1d water level algorithms hyd1d::waterLevel() and hyd1d::waterLevelPegelonline()
Source: R/flood3Points.R
flood3Points.RdComputes flood duration for points located in the active
floodplains along the German federal waterways Elbe and Rhine based on 1d
water levels computed by waterLevel or
waterLevelPegelonline provided by package hyd1d.
Arguments
- x
has to by type
sfpossibly including columnscsa(cross section areas) anddem(digital elevation model). To compute water levels along the River Elbe,xhas to be in the coordinate reference system ETRS 1989 UTM 33N, for the River Rhine in ETRS 1989 UTM 32N. Other coordinate reference systems are not permitted.- seq
has to be type
c("POSIXct", "POSIXt")orDateand have a length larger than 0. Ifseqis typec("POSIXct", "POSIXt"), values must be in the temporal range between 31 days ago (Sys.time() - 2678400) and now (Sys.time()). ThenwaterLevelPegelonlineis used internally for the water level computations. Ifseqis typeDate, values must be in the temporal range between 1960-01-01 and yesterday (Sys.Date() - 1)
Value
sf object with flood duration stored in column
flood3 in the range of [0, length(seq)], elevation stored in
column dem and cross section areas stored in column csa.
Details
For every time step provided in seq, flood3Points()
computes a 1d water level along the requested river section. This 1d water
level is transfered to a temporary wl (water level) column and then
compared to the dem (digital elevation model) column. Where the
wl is higher than the dem flood duration flood3 is
increased by 1.
Since the underlying tiled digital elevation models (dem) are rather
large datasets hydflood provides options to permanentely cache these
datasets. options("hydflood.datadir" = tempdir()) is the default. To
modify the location of your raster cache to your needs set the respective
options() prior to loading the package, e.g.
options("hydflood.datadir" = "~/.hydflood");library(hydflood). The
location can also be determined through the environmental variable
hydflood_datadir.
Examples
# \donttest{
options("hydflood.datadir" = tempdir())
options("timeout" = 200)
library(hydflood)
# create a random points object
c <- st_crs(25833)
e <- st_as_sfc(st_bbox(c(xmin = 309000, xmax = 310000,
ymin = 5749000, ymax = 5750000)))
st_crs(e) <- c
set.seed(123)
points <- st_sample(e, size = 10, "random")
p <- data.frame(id = 1:10)
st_geometry(p) <- points
# create a temporal sequence
seq <- seq(as.Date("2016-12-01"), as.Date("2016-12-31"), by = "day")
# compute a flood duration
p <- flood3Points(x = p, seq = seq)
#> Warning: attribute variables are assumed to be spatially constant throughout all geometries
# }