Skip to contents

Computes 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.

Usage

flood3Points(x, seq)

Arguments

x

has to by type sf possibly including columns csa (cross section areas) and dem (digital elevation model). To compute water levels along the River Elbe, x has 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") or Date and have a length larger than 0. If seq is type c("POSIXct", "POSIXt"), values must be in the temporal range between 31 days ago (Sys.time() - 2678400) and now (Sys.time()). Then waterLevelPegelonline is used internally for the water level computations. If seq is type Date, 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())
  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
# }