We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a09d91a commit 5f301f4Copy full SHA for 5f301f4
10 files changed
R/generate_rabimo_area.R
@@ -33,11 +33,9 @@ generate_rabimo_area <- function(code, ..., column_info = read_column_info())
33
# Compose a one-row data frame from the key-value pairs
34
result <- kwb.utils::callWith(data.frame, key_value_pairs, ...)
35
36
- # Add columns "code", "main_frac", "sealed"
+ # Add columns "code", "main_frac"
37
fetch <- create_accessor(result)
38
result["code"] <- code
39
result["main_frac"] <- round(fetch("area_main")/fetch("total_area") , 2L)
40
- result["sealed"] <- round(fetch("roof") + fetch("pvd"), 2L)
41
-
42
result
43
}
R/natural-scenario.R
@@ -26,7 +26,7 @@ data_to_natural <- function(data, type = "undeveloped")
26
stop_on_invalid_data(data)
27
28
# Columns related to urbanisation
29
- urban_columns <- grep("pv|swg|roof|sealed", names(data), value = TRUE)
+ urban_columns <- grep("pv|swg|roof", names(data), value = TRUE)
30
31
# non urbanized state: no building, no pavements
32
nat_data <- data
R/prepare_input_data.R
@@ -98,9 +98,6 @@ prepare_input_data <- function(data, config, dbg = TRUE)
98
# Convert percentages to fractions
99
data <- calculate_fractions(data)
100
101
- # insert column with total sealed area
102
- data[["sealed"]] <- with(data, roof + pvd)
103
104
# insert empty to_swale column (fraction of the area connected to a swale)
105
data[["to_swale"]] <- 0
106
R/run_rabimo.R
@@ -179,11 +179,10 @@ run_rabimo <- function(data, config, controls = define_controls())
179
with(data, road_frac * (1 - pvd_r)) *
180
runoff_sealed[, ncol(runoff_sealed)] # last (less sealed) surface class
181
182
- fraction_unsealed <- if (control("reproduce_abimo_error")) {
183
- with(data, 1 - sealed)
184
- } else {
185
- with(data, main_frac * (1 - sealed))
186
- }
+ fraction_unsealed <- with(
+ data,
+ ifelse(control("reproduce_abimo_error"), 1, main_frac) * (1 - (roof + pvd))
+ )
187
188
infiltration_unsealed_surfaces <- fraction_unsealed * runoff_unsealed
189
R/run_rabimo_with_measures.R
@@ -21,7 +21,8 @@ run_rabimo_with_measures <- function(
21
22
run_rabimo(
23
distribute_measures(blocks = blocks, targets = rescaled_targets),
24
- config = config)
+ config = config
25
# config_file = kwb.abimo::default_config()
inst/extdata/column-names.csv
@@ -26,7 +26,6 @@ srf1_pvd_r,STR_BELAG1,x,Fraction of road area belonging to surface class 1,0..1,
srf2_pvd_r,STR_BELAG2,x,Fraction of road area belonging to surface class 2,0..1,required,numeric,0.1
srf3_pvd_r,STR_BELAG3,x,Fraction of road area belonging to surface class 3,0..1,required,numeric,0.0
srf4_pvd_r,STR_BELAG4,x,Fraction of road area belonging to surface class 4,0..1,required,numeric,0.0
-sealed,,,Fraction of sealed non-road area including buildings,0..1,required,numeric,
to_swale,,,Fraction of total area connected to an infiltration swale,0..1,required,numeric,0.0
gw_dist,FLUR,,Depth to the water table,m,required,numeric,3.0
ufc30,FELD_30,,Usable field capacity 0..30 cm,% by volume,required,numeric,13.0
tests/testthat/test-function-get_column_selection.R
@@ -5,6 +5,7 @@ test_that("get_column_selection() works", {
5
f <- kwb.rabimo:::get_column_selection
6
7
expect_silent(result <- f())
8
- expect_length(result, 36L)
9
expect_identical(result[1L], "code")
+ expect_false("sealed" %in% result)
10
})
11
+
tests/testthat/test-function-prepare_berlin_inputs.R
@@ -22,7 +22,7 @@ test_that("prepare_berlin_inputs() works", {
"pvd", "swg_pvd",
"srf1_pvd", "srf2_pvd", "srf3_pvd", "srf4_pvd", "srf5_pvd",
"road_frac", "pvd_r", "swg_pvd_r", "srf1_pvd_r", "srf2_pvd_r",
- "srf3_pvd_r", "srf4_pvd_r", "sealed", "to_swale", "gw_dist", "ufc30",
+ "srf3_pvd_r", "srf4_pvd_r", "to_swale", "gw_dist", "ufc30",
"ufc150", "land_type", "veg_class", "irrigation", "block_type"
))
tests/testthat/test-function-run_rabimo.R
@@ -36,7 +36,6 @@ test_that("run_rabimo() works", {
road_frac = 0.1,
pvd_r = 0,
swg_pvd_r = c(0.2, 1, 0),
- sealed = 0.1,
to_swale = 0.0,
total_area = 100
)
tests/testthat/test-function-run_rabimo_with_measures.R
@@ -36,7 +36,7 @@ test_that("run_rabimo_with_measures() works", {
to_swale = measures_max$to_swale + 0.01
- result <- f(blocks, measures = measures_max)
+ expect_output(result <- f(blocks, measures = measures_max))
expect_true(all(result$surface_runoff == 0))
expect_error(f(blocks, measures = measures_too_big_1))
0 commit comments