Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenVw committed Dec 13, 2023
2 parents 70aca34 + d1d8c3f commit 69b798e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: OBIC
Type: Package
Title: Calculate the Open Bodem Index (OBI) Score
Version: 3.0.0
Version: 3.0.1
Authors@R: c(
person(given = "Sven",
family = "Verweij",
Expand All @@ -27,7 +27,7 @@ Authors@R: c(
family = "van den Dool",
email = 'kees.vandendool@nmi-agro.nl',
role = "aut",
comment = c(ORCHID = '0009-0003-8963-2556')),
comment = c(ORCID = '0009-0003-8963-2556')),
person(given = "Job",
family = "de Pater",
email = "job.depater@nmi-agro.nl",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
@@ -1,3 +1,7 @@
# OBIC 3.0.1 2023-11-24
## Fixed
* Fixes calculation of N surplus used for I_H_NGW and I_H_NSW

# OBIC 3.0.0 2023-10-16
## Added
* Add `calc_permeability` for calculating top soil permeability
Expand Down
2 changes: 1 addition & 1 deletion R/nitrogen_efficiency.R
Expand Up @@ -132,7 +132,7 @@ calc_n_efficiency <- function(B_LU_BRP, B_SOILTYPE_AGR, B_GWL_CLASS, B_AER_CBS,
dt[,catchcrop := fifelse(M_GREEN, 75,0)]

# Calculate deviation from N surplus
dt[,n_sp := max(0,((1 - NUE * cf_pkph) * n_app) - catchcrop)]
dt[,n_sp := pmax(0,((1 - NUE * cf_pkph) * n_app) - catchcrop)]

# compute (potential and soil derived) N leaching to groundwater D_NGW (mg NO3/L)
dt[, D_NLEACH := nf * n_sp]
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-nitrogen_efficiency.R
Expand Up @@ -13,7 +13,7 @@ test_that("test whether calc_nitrogen_efficiency works", {
B_FERT_NORM_FR = c(1,1,1,0.8),
leaching_to = 'gw'
),
expected = c(10.00, 11.25, 10.00, 10.00),
expected = c(3.92, 7.20, 10.00, 0.96),
tolerance = 0.01
)

Expand All @@ -31,7 +31,7 @@ test_that("test whether calc_nitrogen_efficiency works", {
B_FERT_NORM_FR = c(1,0.8,1,1),
leaching_to = 'gw'
),
expected = c(1.90,2.09,1.90,1.90),
expected = c(0.0, 0.0, 1.9, 0.0),
tolerance = 0.01
)

Expand Down

0 comments on commit 69b798e

Please sign in to comment.