| Title: | R Package with Functions for Working with Water Balance Model ABIMO |
|---|---|
| Description: | R Package with functions for working with water balance bodel ABIMO https://www.stadtentwicklung.berlin.de/umwelt/umweltatlas/download/goedecke_et_al_abimo2019_doku.pdf). |
| Authors: | Andreas Matzinger [aut, cre] (ORCID: <https://orcid.org/0000-0001-5483-4594>), Michael Rustler [ctb] (ORCID: <https://orcid.org/0000-0003-0647-7726>), Hauke Sonnenberg [ctb] (ORCID: <https://orcid.org/0000-0001-9134-2871>), KEYS [fnd], Kompetenzzentrum Wasser Berlin gGmbH (KWB) [cph] |
| Maintainer: | Andreas Matzinger <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.4.0 |
| Built: | 2026-06-06 06:57:11 UTC |
| Source: | https://github.com/KWB-R/kwb.abimo |
changes order in dbf-file to match geographical shape file of Berlin "Stadtstruktur"
ABIMO_adapt_map(ABIMO_out, file_georef, out_file)ABIMO_adapt_map(ABIMO_out, file_georef, out_file)
ABIMO_out |
data.frame of ABIMO output file |
file_georef |
path of dbf file that matches existing shape (incl. path) |
out_file |
file path and file name for ordered ABIMO output file (to be linked to shape files) |
ordered dbf returned and written to out_file
multiplies each water balance component by area, sums them up and divides the sum by the total surface
abimo_Berlin_average(abimo_df)abimo_Berlin_average(abimo_df)
abimo_df |
data.frame of ABIMO output file, merged with input file |
table with averages in mm of water balance components
join ABIMO in- and output files
abimo_comb_in_out(file_ABIMO_out, file_ABIMO_in)abimo_comb_in_out(file_ABIMO_out, file_ABIMO_in)
file_ABIMO_out |
path of ABIMO output file in dbf format (incl. path) |
file_ABIMO_in |
path of ABIMO input file in dbf format (incl. path) |
data.frame with matched ABIMO in- and output data
Compares two ABIMO-output-files by plotting parameters compared to 1:1 line into pdf-File and by doing a simple column statistics.
abimo_compare_output(x_reference, x_new)abimo_compare_output(x_reference, x_new)
x_reference |
reference data frame with ABIMO output (can be ABIMO output or downloaded from Berlin geoportal) |
x_new |
new ABIMO output to be compared to reference |
data.frame of column statistics; plots and evaluation open as pdf
uses correction factor to calculate groundwater recharge
from infiltration RI. Difference is interflow.
Requires a combined data.frame of ABIMO output and input,
e.g. by using function abimo_comb_in_out
abimo_grwater_interflow(abimo_df)abimo_grwater_interflow(abimo_df)
abimo_df |
data.frame of ABIMO output file, merged with input file |
input data.frame with two new columns "RI_K" and "INTERF"
The data was read from a file called "abimo_2019_mitstrassen.dbf"
using read.dbf.
For a description of the input data, see the URL below.
abimo_input_2019abimo_input_2019
A data frame with 25352 observations of 34variables:
Variable 'CODE', see URL below
Variable 'BEZIRK', see URL below
Variable 'STAGEB', see URL below
Variable 'BLOCK', see URL below
Variable 'TEILBLOCK', see URL below
Variable 'NUTZUNG', see URL below
Variable 'TYP', see URL below
Variable 'FLGES', see URL below
Variable 'VG', see URL below
Variable 'PROBAU', see URL below
Variable 'PROVGU', see URL below
Variable 'REGENJA', see URL below
Variable 'REGENSO', see URL below
Variable 'BELAG1', see URL below
Variable 'BELAG2', see URL below
Variable 'BELAG3', see URL below
Variable 'BELAG4', see URL below
Variable 'VGSTRASSE', see URL below
Variable 'STR_BELAG1', see URL below
Variable 'STR_BELAG2', see URL below
Variable 'STR_BELAG3', see URL below
Variable 'STR_BELAG4', see URL below
Variable 'KANAL', see URL below
Variable 'KANART', see URL below
Variable 'KAN_BEB', see URL below
Variable 'KAN_VGU', see URL below
Variable 'KAN_STR', see URL below
Variable 'FELD_30', see URL below
Variable 'FELD_150', see URL below
Variable 'FLUR', see URL below
Variable 'STR_FLGES', see URL below
Variable 'KOR_FL_N', see URL below
Variable 'AGEB1_NR', see URL below
Variable 'AGEB1', see URL below
https://www.berlin.de/umweltatlas/_assets/literatur/goedecke_et_al_abimo2019_doku.pdf
Reads a new ABIMO output file in dbase format. In addition the original SENSTADTUM output file is read and made comparable. Alternatively two new ABIMO output files can be read. Output are two comparable (same dimensions and column names) data frames.
ABIMO_read_output(SENSTADTUM_dbf, new_dbf)ABIMO_read_output(SENSTADTUM_dbf, new_dbf)
SENSTADTUM_dbf |
path of original SENSTADTUM-database |
new_dbf |
path of new output-database |
output are two comparable (same dimensions and column names) data frames.
as default irrigation of pervious areas is assumed based on "Nutzung" and "Typ". This function turns of irrigation for all areas (BERtoZero = true)
abimo_xml_BER(file_in = default_config(), file_out, line_BER = 56)abimo_xml_BER(file_in = default_config(), file_out, line_BER = 56)
file_in |
path and file name of abimo xml-input file, default is
|
file_out |
path and file name to write changed abimo xml-input file |
line_BER |
line number in xml-file, where BERtoZero is defined, default is 56 |
abimo xml-input file with changed BERtoZero-setting
potential evaporation (annual and summer) is a boundary condition defined in config.xml. This function sets potential evaporation to a given value for all surfaces (except lakes and rivers)
abimo_xml_evap(file_in = default_config(), file_out, evap_annual, evap_summer)abimo_xml_evap(file_in = default_config(), file_out, evap_annual, evap_summer)
file_in |
path and file name of abimo xml-input file, default is
|
file_out |
path and file name to write changed abimo xml-input file |
evap_annual |
annual potential evaporation |
evap_summer |
potential evaporation for summer months |
abimo xml-input file with changed potential evaporation
the ID is an unambiguous identifier for all blocks of the Berlin Geoportal but is usually hidden
add_ISU5_ID( x_no_ID, ID_dbf = "C:/Aendu_lokal/ABIMO_Paper/Daten/Karten/Basis_ISU5_Daten_2015/ISU5_ID.dbf" )add_ISU5_ID( x_no_ID, ID_dbf = "C:/Aendu_lokal/ABIMO_Paper/Daten/Karten/Basis_ISU5_Daten_2015/ISU5_ID.dbf" )
x_no_ID |
data.frame created from dbf file, downloaded from Berlin geoportal |
ID_dbf |
path of dbf file including ids, default is set to local folder with ISU5-Ids |
data.frame of x_no_ID with a new column "ID"
Adds "SUB" field to the end of an existing file, as expected by some older applications (such as input-dbf-file for ABIMO) function by grandmaster HAUKESON
appendSubToFile(filename)appendSubToFile(filename)
filename |
Path of file name of data.frame |
dbf file with sub field
Calculate the curve(s) of the Bagrov relation
calculate_bagrov_curve( effectivity, P_over_Ep_max = 4, Ep = 650, delta_Ea = 0.1, dbg = FALSE )calculate_bagrov_curve( effectivity, P_over_Ep_max = 4, Ep = 650, delta_Ea = 0.1, dbg = FALSE )
effectivity |
Bagrov effectivity value (= n-value) |
P_over_Ep_max |
maximum value of the ratio P/Ep with precipitation P and potential evaporation Ep. |
Ep |
potential evaporation in mm/a (default: 650) |
delta_Ea |
step of actual evaporation (default: 0.1) |
dbg |
logical indicating whether or not to show debug messages |
data frame with columns P_over_Ep (P/Ep), Ea_over_Ep
(Ea/Ep), effectivity (n-value)
## Not run: bagrov_data <- calculate_bagrov_curve(1:2) plot(bagrov_data$P_over_Ep, bagrov_data$Ea_over_Ep) ## End(Not run)## Not run: bagrov_data <- calculate_bagrov_curve(1:2) plot(bagrov_data$P_over_Ep, bagrov_data$Ea_over_Ep) ## End(Not run)
Create Configuration Object from Abimo Configuration File
create_configurator(xml_file = NULL)create_configurator(xml_file = NULL)
xml_file |
path to "config.xml". By default a configuration file that is
stored in this package ( |
object of class "abimo_config"
Default ABIMO config.xml path
default_config()default_config()
kwb.abimo::default_config()kwb.abimo::default_config()
Get Path to File in This Package
extdata_file(..., must_exist = TRUE, dbg = FALSE)extdata_file(..., must_exist = TRUE, dbg = FALSE)
... |
parts of the file path to be passed to |
must_exist |
if |
dbg |
if |
Call Abimo with the –write-bagrov-table argument being set and convert the console output to a data frame
get_bagrov_curves_from_abimo()get_bagrov_curves_from_abimo()
data frame with columns P_over_Ep (P/Ep), Ea_over_Ep
(Ea/Ep), effectivity (n-value)
Return List of XPath Expressions to Address Config Elements
get_xpaths()get_xpaths()
List structure containing XPath expressions (see e.g. https://www.w3schools.com/xml/xpath_intro.asp)
Install ABIMO
install_abimo( tag = latest_abimo_version(), arch = get_architecture_suffix(), ... )install_abimo( tag = latest_abimo_version(), arch = get_architecture_suffix(), ... )
tag |
tag of ABIMO version to be installed, e.g. "v3.2.2" |
arch |
target system architecture, one of "windows", "linux", "macos" |
... |
further arguments passed to |
Read Abimo Configuration from XML File
read_config(file = default_config())read_config(file = default_config())
file |
path to XML file |
Read Intermediate Results from Log File
read_intermediate_results_from_log( file = file.path(tempdir(), "abimo_input_result.log"), pattern_remove = "Start|unknown|angenommen|nicht definiert|std::" )read_intermediate_results_from_log( file = file.path(tempdir(), "abimo_input_result.log"), pattern_remove = "Start|unknown|angenommen|nicht definiert|std::" )
file |
path to log file |
pattern_remove |
regular expression matching lines to remove from the log file before looking for "variable=expression" assignments |
searches string for parameter=<pattern_value> and replaces with parameter=<new_value> for all found entries
replace_value( string, new_value, parameter = "etp", pattern_value = "\"[0-9]+?\\.?[0-9]+?\"" )replace_value( string, new_value, parameter = "etp", pattern_value = "\"[0-9]+?\\.?[0-9]+?\"" )
string |
string with ABIMO config |
new_value |
new parameter value |
parameter |
parameter name to search for (default: "etp") |
pattern_value |
pattern of value field (default: '\"[0-9]+?\.?[0-9]+?\"') |
returns string with modified parameter = value
### Simple string string <- '<item bezirke="15,16,18,19,20" etp="807" etps="600" />' replace_value(string, new_value = 100, parameter = "etp") replace_value(string, new_value = 100, parameter = "etps") ### Default ABIMO config config <- readLines(kwb.abimo::default_config()) replace_value(config, new_value = 100, parameter = "etp")### Simple string string <- '<item bezirke="15,16,18,19,20" etp="807" etps="600" />' replace_value(string, new_value = 100, parameter = "etp") replace_value(string, new_value = 100, parameter = "etps") ### Default ABIMO config config <- readLines(kwb.abimo::default_config()) replace_value(config, new_value = 100, parameter = "etp")
Run Abimo with Input Data or Input File
run_abimo( input_file = NULL, input_data = NULL, output_file = NULL, config_file = NULL, config = NULL, tag = latest_abimo_version(), read_intermediates = FALSE )run_abimo( input_file = NULL, input_data = NULL, output_file = NULL, config_file = NULL, config = NULL, tag = latest_abimo_version(), read_intermediates = FALSE )
input_file |
path to input dbf file |
input_data |
data frame from which a temporary input file is to be generated |
output_file |
path to output file. By default the output file has the same name as the input file with "_result" appended |
config_file |
optional. Path to config.xml file |
config |
optional. Configuration object of class "abimoConfig", as
returned by |
tag |
version tag of Abimo release to be used, see https://github.com/KWB-R/abimo/releases. |
read_intermediates |
if |
data frame, read from dbf file that was created by Abimo.exe.
If read_intermediates is TRUE, intermediate results are
returned in the attribute "intermediates"
Run Abimo on the Command Line
run_abimo_command_line(args, tag = latest_abimo_version())run_abimo_command_line(args, tag = latest_abimo_version())
args |
vector of arguments to be passed to Abimo |
tag |
version tag of Abimo release to be used, see https://github.com/KWB-R/abimo/releases |
The function returns what Abimo.exe sent to the standard output (as a vector of character).
Saves an existing data.frame into dBase-format and adds "SUB" field to the end of the file as required by ABIMO
write.dbf.abimo(df_name, new_dbf)write.dbf.abimo(df_name, new_dbf)
df_name |
name of data.frame |
new_dbf |
path of new ABIMO-input file to be written (.dbf) |
dbf file that can be processed by ABIMO