aboutsummaryrefslogtreecommitdiff
path: root/pkg/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-06-12 02:19:01 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2015-06-12 02:19:01 +0200
commit5b32c30549bfa3cb42ffde7e13f75608b98c79c2 (patch)
treed834d613cd093c6f051f105d3120da50365e5be6 /pkg/R
parent9b8e5cb80ba4a89578d979bee134f8342ca0a527 (diff)
Make UK drainage with non-SFO soil degradation work
Diffstat (limited to 'pkg/R')
-rw-r--r--pkg/R/PEC_sw_drainage_UK.R14
1 files changed, 8 insertions, 6 deletions
diff --git a/pkg/R/PEC_sw_drainage_UK.R b/pkg/R/PEC_sw_drainage_UK.R
index 8402d95..43c732e 100644
--- a/pkg/R/PEC_sw_drainage_UK.R
+++ b/pkg/R/PEC_sw_drainage_UK.R
@@ -41,20 +41,22 @@ PEC_sw_drainage_UK_ini <- function(rate, interception = 0, Koc,
amount_available <- rate * (1 - interception) # g/ha
if (!missing(latest_application)) {
+ lct <- Sys.getlocale("LC_TIME")
+ tmp <- Sys.setlocale("LC_TIME", "C")
+ latest <- as.Date(paste(latest_application, "1999"), "%d %b %Y")
+ tmp <- Sys.setlocale("LC_TIME", lct)
+ degradation_time <- as.numeric(difftime(as.Date("1999-10-01"), units = "days", latest))
if (!missing(soil_DT50)) {
k = log(2)/soil_DT50
as.Date(paste(latest_application, "1999"), "%d %B %Y")
- lct <- Sys.getlocale("LC_TIME")
- tmp <- Sys.setlocale("LC_TIME", "C")
- latest <- as.Date(paste(latest_application, "1999"), "%d %b %Y")
- tmp <- Sys.setlocale("LC_TIME", lct)
- degradation_time <- as.numeric(difftime(as.Date("1999-10-01"), units = "days", latest))
amount_available <- amount_available * exp(-k * degradation_time)
if (!missing(model)) stop("You already supplied a soil_DT50 value, implying SFO kinetics")
}
if (!missing(model)) {
- amount_available <- pfm_degradation(model, parms = model_parms, times = degradation_time)
+ fraction_left <- pfm_degradation(model, parms = model_parms,
+ times = degradation_time)[1, "parent"]
+ amount_available <- fraction_left * amount_available
}
}

Contact - Imprint