Package 'keys.lid'

Title: R Package for Simulating the Impact of Different LIDs under Varying Climate Boundary Conditions on Annual Volume Rainfall Retention
Description: R Package for Simulating the Impact of Different LIDs (Low Impact Development) under Varying Climate Boundary Conditions in China on annual VRR (Volume Rainfall Retention).
Authors: Michael Rustler [aut, cre] (ORCID: <https://orcid.org/0000-0003-0647-7726>), Roberto Tatis-Muvdi [aut] (ORCID: <https://orcid.org/0000-0003-0490-7999>), KEYS [fnd], Kompetenzzentrum Wasser Berlin gGmbH (KWB) [cph]
Maintainer: Michael Rustler <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-06-24 15:35:36 UTC
Source: https://github.com/KWB-R/keys.lid

Help Index


Boxplot Runoff Maximum per Event

Description

Boxplot Runoff Maximum per Event

Usage

boxplot_runoff_max(
  lid = "bioretention_cell",
  zone_id = 1,
  performances = keys.lid::performances
)

Arguments

lid

tidy name of LID (default: "bioretention_cell")

zone_id

climate zone id to plot (default: 1)

performances

nested tibble (default: performances)

Value

interactive plot of performance results

Examples

## Not run: 
boxplot_runoff_max(lid = "bioretention_cell", zone_id = 1)

## End(Not run)

Boxplot Runoff Volume per Event

Description

Boxplot Runoff Volume per Event

Usage

boxplot_runoff_volume(
  lid = "bioretention_cell",
  zone_id = 1,
  performances = keys.lid::performances
)

Arguments

lid

tidy name of LID (default: "bioretention_cell")

zone_id

climate zone id to plot (default: 1)

performances

nested tibble (default: performances)

Value

interactive plot of performance results

Examples

## Not run: 
boxplot_runoff_volume(lid = "bioretention_cell", zone_id = 1)

## End(Not run)

Boxplot Volume Rainfall Retended per Year

Description

Boxplot Volume Rainfall Retended per Year

Usage

boxplot_vrr(
  lid = "bioretention_cell",
  zone_id = 1,
  performances = keys.lid::performances
)

Arguments

lid

tidy name of LID (default: "bioretention_cell")

zone_id

climate zone id to plot (default: 1)

performances

nested tibble (default: performances)

Value

interactive plot of performance results

Examples

## Not run: 
boxplot_vrr(lid = "bioretention_cell", zone_id = 1)

## End(Not run)

computeVol

Description

compute runoff volume for runoff in mm/s

Usage

computeVol(data, timeColumn, Qcolumn)

Arguments

data

data

timeColumn

timeColumn

Qcolumn

Qcolumn

Value

???


Title

Description

Title

Usage

export_performances(export_dir = tempdir())

Arguments

export_dir

default: tempdir()

Value

write "performances" to "swmm_lid-performances.xlsx" in directory "export_dir" and return path to fike


Get Path to File in This Package

Description

Get Path to File in This Package

Usage

extdata_file(...)

Arguments

...

parts of path passed to system.file


Get Percentiles for Events

Description

Get Percentiles for Events

Usage

get_event_percentiles(performances = keys.lid::performances)

Arguments

performances

nested tibble (default: performances)

Value

list with percentiles for "event_sum" and "event_max"


Convert LID config to SWMM LID controls

Description

Convert LID config to SWMM LID controls

Usage

lidconfig_to_swmm(df)

Arguments

df

data frame for a single scenario of a LID (as returned by read_scenarios)

Value

data frame with SWMM LID controls

Examples

scenarios <- keys.lid::read_scenarios()
unique(scenarios$lid_name_tidy)
lid <- "permeable_pavement"
lid_selected <- scenarios %>%  dplyr::filter(.data$lid_name_tidy == lid)
scenario_names <- unique(lid_selected$scenario_name)
scenario_name <- scenario_names[1]
scenario_name
lid_selected_scenario <- lid_selected[lid_selected$scenario_name == scenario_name,]
lid_controls <- lidconfig_to_swmm(lid_selected_scenario)
str(lid_controls)

makeRainfallRunoffEvents

Description

makeRainfallRunoffEvents

Usage

makeRainfallRunoffEvents(rainfalldata, runoffdata)

Arguments

rainfalldata

rainfalldata

runoffdata

runoffdata

Value

????


monthlyPattern

Description

monthlyPattern

Usage

monthlyPattern(data)

Arguments

data

data

Value

???


Performance results for LIDs

Description

A dataset containing the performance of LIDs for different climate conditions created with R script in /data-raw/performances.R

Usage

performances

Format

A nested tibble with 575 rows and 16 variables:

zone_id

climate zone id

lid_name_tidy

tidy LID name

scenario_name

name of LID scenario

catchment_area_m2

catchment area in squaremeters

lid_area_fraction

fraction of LID compared to total catchment

lid_area_m2

total LID area

lid_usage

tibble with LID usage parameterisation

lid_controls

tibble with LID controls parameterisation

subcatchment

tibble with subcatchment parameterisation

annual

tibble with two columns "year" and "vrr" (volume rainfall retended for each year

events_max

tibble with maximum values for each rainfall event

events_sum

tibble with sum values for each rainfall event

col_eventsep

name of SWMM results used for event separation

model_inp

path to SWMM model input file

model_rpt

path to SWMM model report file

model_out

path to SWMM model output file


Plot Median VRR

Description

Plot Median VRR

Usage

plot_vrr_median(
  lid = "bioretention_cell",
  performances = keys.lid::performances
)

Arguments

lid

tidy name of LID

performances

nested tibble (default: performances)

Value

interactive plot of performance results

Examples

## Not run: 
lids <- unique(keys.lid::performances$lid_name_tidy)
sapply(lids, function(lid) print(keys.lid::plot_vrr_median(lid)))

## End(Not run)

read_scenarios

Description

read_scenarios

Usage

read_scenarios(
  scenarios_xlsx = extdata_file("scenarios/swmm_lid-parameterisation.xlsx")
)

Arguments

scenarios_xlsx

path to LID scenarios Excel file (default: extdata_file with: "scenarios/swmm_lid-parameterisation.xlsx"

Value

tidy scenarios data frame


readObservations

Description

readObservations

Usage

readObservations(
  subfolder,
  rainFile,
  runoffFile,
  temperatureFile,
  dateTimetz,
  dateTimeformat,
  to_mmperhour,
  NAval
)

Arguments

subfolder

subfolder

rainFile

rainFile

runoffFile

runoffFile

temperatureFile

temperatureFile

dateTimetz

dateTimetz

dateTimeformat

dateTimeformat

to_mmperhour

to_mmperhour

NAval

NAval

Value

????


readPredictions

Description

readPredictions

Usage

readPredictions(
  subfolder,
  rainFile,
  runoffFile,
  temperatureFile,
  dateTimetz,
  dateTimeformat,
  to_mmperhour,
  parTcontinuous
)

Arguments

subfolder

subfolder

rainFile

rainFile

runoffFile

runoffFile

temperatureFile

temperatureFile

dateTimetz

dateTimetz

dateTimeformat

dateTimeformat

to_mmperhour

to_mmperhour

parTcontinuous

parTcontinuous

Value

????


Simulate Performance of LID

Description

Simulate Performance of LID

Usage

simulate_performance(
  lid_selected,
  lid_area_fraction = 0,
  catchment_area_m2 = 1000,
  swmm_base_inp = keys.lid::extdata_file("scenarios/models/model_template.inp"),
  swmm_climate_dir = keys.lid::extdata_file("rawdata/weather_sponge_regions"),
  swmm_exe = NULL,
  model_dir = keys.lid::extdata_file("scenarios/models"),
  zone_ids = 1L:5L
)

Arguments

lid_selected

tibble with a selected LID as retrieved by read_scenarios

lid_area_fraction

fraction of LID in subcatchment (default: 0)

catchment_area_m2

catchment area (default: 1000 m2)

swmm_base_inp

path to SWMM model to be used as template for modification (default: keys.lid::extdata_file("scenarios/models/model_template.inp"))

swmm_climate_dir

directory with climate data (default: keys.lid::extdata_file("rawdata/weather_sponge_regions")

swmm_exe

Name and path to swmm5 executable. If not manually set, the following paths are looked up: linux: "/usr/bin/swmm5" darwin: "/Applications/swmm5" windows: "C:/Program Files (x86)/EPA SWMM 5.1/swmm5.exe", (default: NULL)

model_dir

default: keys.lid::extdata_file("scenarios/models")

zone_ids

climate zone ids to be used for simulation (default: 1L:5L)

Value

tibble with nested lists containing all scenario performance

Examples

## Not run: 
scenarios <- keys.lid::read_scenarios()
unique(scenarios$lid_name_tidy)
lid <- "permeable_pavement"
lid_selected <- scenarios %>%  dplyr::filter(.data$lid_name_tidy == lid)
pp_0.00 <- keys.lid::simulate_performance(lid_selected,
                                          lid_area_fraction = 0.00)
pp_1.0 <- keys.lid::simulate_performance(lid_selected,
                                         lid_area_fraction = 1.0)
pp <- dplyr::bind_rows(pp_0.00, pp_1.0)

## End(Not run)

Simulate Performances of LID

Description

Simulate Performances of LID

Usage

simulate_performances(
  lid_selected,
  lid_area_fractions = c(0, 1),
  catchment_area_m2 = 1000,
  swmm_base_inp = keys.lid::extdata_file("scenarios/models/model_template.inp"),
  swmm_climate_dir = keys.lid::extdata_file("rawdata/weather_sponge_regions"),
  swmm_exe = NULL,
  model_dir = keys.lid::extdata_file("scenarios/models"),
  zone_ids = 1L:5L
)

Arguments

lid_selected

tibble with a selected LID as retrieved by read_scenarios

lid_area_fractions

fractions of LID in subcatchment (default: c(0,1)

catchment_area_m2

catchment area (default: 1000 m2)

swmm_base_inp

path to SWMM model to be used as template for modification (default: keys.lid::extdata_file("scenarios/models/model_template.inp"))

swmm_climate_dir

directory with climate data (default: keys.lid::extdata_file("rawdata/weather_sponge_regions")

swmm_exe

Name and path to swmm5 executable. If not manually set, the following paths are looked up: linux: "/usr/bin/swmm5" darwin: "/Applications/swmm5" windows: "C:/Program Files (x86)/EPA SWMM 5.1/swmm5.exe", (default: NULL)

model_dir

default: keys.lid::extdata_file("scenarios/models")

zone_ids

climate zone ids to be used for simulation (default: 1L:5L)

Value

tibble with nested lists containing all scenario performances for varying lid_area_fractions

Examples

## Not run: 
scenarios <- keys.lid::read_scenarios()
unique(scenarios$lid_name_tidy)
lid <- "permeable_pavement"
lid_selected <- scenarios %>%  dplyr::filter(.data$lid_name_tidy == lid)
pp <- keys.lid::simulate_performances(lid_selected,
                                      lid_area_fractions = c(0,1)
                                      )

## End(Not run)