aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_exposit.R
blob: 667b4eedb0dd9d9ead861165f6a5b2d8dd84c78d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(pfm)
context("Exposit runoff calculations")

test_that("Runoff PECsw are as in Exposit 3.01", {
  # Expected results are from the Exposit 3.01, downloaded 2017-10-27

  # 100 g/ha, Koc = 1000 L/kg, DT50 = 1000 days
  PEC_spreadsheet_1 <- data.frame(dissolved = c(0.706, 0.612, 0.525, 0.367),
                                  total = c(0.783, 0.679, 0.546, 0.377))

  PEC_pfm_1 <- round(PEC_sw_exposit_runoff(100, Koc = 1000, DT50 = 1000)$PEC_sw_runoff, 3)[c("dissolved", "total")]
  expect_equivalent(PEC_spreadsheet_1, PEC_pfm_1)

  # 10 g/ha, Koc = 300000 L/kg, DT50 = 10 days
  PEC_spreadsheet_2 <- data.frame(dissolved = c(0, 0, 0, 0),
                                  total = c(0.141, 0.122, 0.039, 0.018))
  PEC_pfm_2 <- round(PEC_sw_exposit_runoff(10, Koc = 300000, DT50 = 10)$PEC_sw_runoff, 3)[c("dissolved", "total")]
  expect_equivalent(PEC_spreadsheet_2, PEC_pfm_2)

  # 200 g/ha, Koc = 30 L/kg, DT50 = 100 days
  PEC_spreadsheet_3 <- data.frame(dissolved = c(1.138, 0.986, 0.845, 0.592),
                                  total = c(1.138, 0.986, 0.845, 0.592))
  PEC_pfm_3 <- round(PEC_sw_exposit_runoff(200, Koc = 30, DT50 = 100)$PEC_sw_runoff, 3)[c("dissolved", "total")]
  expect_equivalent(PEC_spreadsheet_3, PEC_pfm_3)
})

Contact - Imprint