Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix verslemping #57

Merged
merged 4 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* pF of field capacity is changed from 2.2 to 2.0 #53
* Bulk density in the default PTF is now aggregated into 1 continous function #53
* Parameters of evaluation for PAW are adjusted #53
* Parameters for the evaluation of sealing is adjusted #57

## Version 0.10.0 2019-12-13
### Added
Expand Down
3 changes: 2 additions & 1 deletion R/sealing.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ calc_sealing_risk <- function(A_CLAY_MI, A_OS_GV) {

# Calculate the value
dt[is.na(value), value := value.A_CLAY_MI + cor.A_OS_GV * A_OS_GV]
dt[value > 10, value := 10]
value <- dt[, value]

return(value)
Expand Down Expand Up @@ -82,7 +83,7 @@ ind_sealing <- function(D_SE, B_LU_BRP) {
setorder(dt, id)

# Evaluate the sealing for grassland and all other crops
dt[crop_sealing == "overig", value := OBIC::evaluate_logistic(x = D_SE, b = 1.5, x0 = 0.3, v = 0.35)]
dt[crop_sealing == "overig", value := OBIC::evaluate_logistic(x = D_SE, b = 0.71, x0 = 4, v = 0.94)]
dt[crop_sealing == "gras", value := 1]

value <- dt[, value]
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-sealing.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test_that("calc_sealing works", {
A_CLAY_MI = c(25, 20),
A_OS_GV = c(1.5, 8)
),
expected = c(8.6, 10.2),
expected = c(8.6, 10),
tolerance = 0.001
)
})
Expand All @@ -23,15 +23,15 @@ test_that("ind_sealing works", {
D_SE = 8.6,
B_LU_BRP = 2014
),
expected = 0.9999,
expected = 0.9609441,
tolerance = 0.001
)
expect_equal(
ind_sealing(
D_SE = c(8.6, 2),
B_LU_BRP = c(2014, 265)
),
expected = c(0.9999, 1),
expected = c(0.9609441, 1),
tolerance = 0.001
)
})