jranke / mkin
1
utils::globalVariables("D24_2014")
2

3
#' Normalisation factors for aerobic soil degradation according to FOCUS guidance
4
#'
5
#' Time step normalisation factors for aerobic soil degradation as described
6
#' in Appendix 8 to the FOCUS kinetics guidance (FOCUS 2014, p. 369).
7
#'
8
#' @param object An object containing information used for the calculations
9
#' @param temperature Numeric vector of temperatures in °C
10
#' @param moisture Numeric vector of moisture contents in \\% w/w
11
#' @param field_moisture Numeric vector of moisture contents at field capacity
12
#'   (pF2) in \\% w/w
13
#' @param study_moisture_ref_source Source for the reference value
14
#'   used to calculate the study moisture. If 'auto', preference is given
15
#'   to a reference moisture given in the meta information, otherwise
16
#'   the focus soil moisture for the soil class is used
17
#' @param Q10 The Q10 value used for temperature normalisation
18
#' @param walker The Walker exponent used for moisture normalisation
19
#' @param f_na The factor to use for NA values. If set to NA, only factors
20
#'  for complete cases will be returned.
21
#' @param \dots Currently not used
22
#' @references
23
#' FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence
24
#'   and Degradation Kinetics from Environmental Fate Studies on Pesticides in
25
#'   EU Registration} Report of the FOCUS Work Group on Degradation Kinetics,
26
#'   EC Document Reference Sanco/10058/2005 version 2.0, 434 pp,
27
#'   \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics}
28
#' FOCUS (2014) \dQuote{Generic guidance for Estimating Persistence
29
#'   and Degradation Kinetics from Environmental Fate Studies on Pesticides in
30
#'   EU Registration} Report of the FOCUS Work Group on Degradation Kinetics,
31
#'   Version 1.1, 18 December 2014
32
#'   \url{http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics}
33
#' @seealso [focus_soil_moisture]
34
#' @examples
35
#' f_time_norm_focus(25, 20, 25) # 1.37, compare FOCUS 2014 p. 184
36
#'
37
#' D24_2014$meta
38
#' # No moisture normalisation in the first dataset, so we use f_na = 1 to get
39
#' # temperature only normalisation as in the EU evaluation
40
#' f_time_norm_focus(D24_2014, study_moisture_ref_source = "focus", f_na = 1)
41
#' @export
42
f_time_norm_focus <- function(object, ...) {
43 1
  UseMethod("f_time_norm_focus")
44
}
45

46
#' @rdname f_time_norm_focus
47
#' @export
48
f_time_norm_focus.numeric <- function(object,
49
  moisture = NA, field_moisture = NA,
50
  temperature = object,
51
  Q10 = 2.58, walker = 0.7, f_na = NA, ...)
52
{
53 1
  f_temp <- ifelse(is.na(temperature),
54 1
    f_na,
55 1
    ifelse(temperature <= 0,
56 1
      0,
57 1
      Q10^((temperature - 20)/10)))
58 1
  f_moist <- ifelse(is.na(moisture),
59 1
    f_na,
60 1
    ifelse(moisture >= field_moisture,
61 1
      1,
62 1
      (moisture / field_moisture)^walker))
63 1
  f_time_norm <- f_temp * f_moist
64 1
  f_time_norm
65
}
66

67
#' @rdname f_time_norm_focus
68
#' @export
69
f_time_norm_focus.mkindsg <- function(object,
70
  study_moisture_ref_source = c("auto", "meta", "focus"),
71
  Q10 = 2.58, walker = 0.7, f_na = NA, ...) {
72

73 1
  study_moisture_ref_source <- match.arg(study_moisture_ref_source)
74 1
  meta <- object$meta
75

76 1
  if (is.null(meta$field_moisture)) {
77 1
    field_moisture <- focus_soil_moisture[meta$usda_soil_type, "pF2"]
78
  } else {
79 0
    field_moisture <- ifelse(is.na(meta$field_moisture),
80 0
      focus_soil_moisture[meta$usda_soil_type, "pF2"],
81 0
      meta$field_moisture)
82
  }
83

84 1
  study_moisture_ref_focus <-
85 1
    focus_soil_moisture[as.matrix(meta[c("usda_soil_type", "study_moisture_ref_type")])]
86

87 1
  if (study_moisture_ref_source == "auto") {
88 1
    study_moisture_ref <- ifelse (is.na(meta$study_ref_moisture),
89 1
      study_moisture_ref_focus,
90 1
      meta$study_ref_moisture)
91
  } else {
92 1
    if (study_moisture_ref_source == "meta") {
93 0
      study_moisture_ref <- meta$study_moisture_ref
94
    } else {
95 1
      study_moisture_ref <- study_moisture_ref_focus
96
    }
97
  }
98

99 1
  if ("study_moisture" %in% names(meta)) {
100 0
    study_moisture <- ifelse(is.na(meta$study_moisture),
101 0
      meta$rel_moisture * study_moisture_ref,
102 0
      meta$study_moisture)
103
  } else {
104 1
    study_moisture <- meta$rel_moisture * study_moisture_ref
105
  }
106

107 1
  object$f_time_norm <- f_time_norm_focus(meta$temperature,
108 1
    moisture = study_moisture, field_moisture = field_moisture,
109 1
    Q10 = Q10, walker = walker, f_na = f_na)
110 1
  cat("$time_norm was set to\n")
111 1
  print(object$f_time_norm)
112 1
  invisible(object$f_time_norm)
113
}

Read our documentation on viewing source code .

Loading