diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2017-01-29 16:58:53 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2017-01-29 18:52:24 +0100 |
commit | a6c13f70f6c6669a8088827a602ac475fdf9b624 (patch) | |
tree | e3bcc3e9ff9e006f3e9d87a1df226752fa4753cc | |
parent | c22143d8ec53026cb1e439bdbba1d725a11b4b0c (diff) |
Setting up PELMO runs, execution and evaluation
It all works!
28 files changed, 1717 insertions, 80 deletions
@@ -1,3 +1,32 @@ +commit 15c1b8c5ddadf938ce13d3dd9da2a09d8749f740 +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2017-01-29 16:58:53 +0100 + + Setting up PELMO runs, execution and evaluation + + It all works! + +commit bc97a35a32c4f47e29364488a3601f94c6e68d45 +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2017-01-27 18:33:45 +0100 + + Really use all scenarios in test data + + Maize, that was used in the last commit, is not parameterised for + Jokioinen + +commit a4081ddfea726283874968c0b62a7f46e4fd1232 +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2017-01-27 18:23:35 +0100 + + Use all scenarios in the test data + +commit 3c82d26206e2f2e74600acd71a49c70eaed555c4 +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2017-01-27 08:17:08 +0100 + + Also test run with metabolites + commit 8fd050e57b7babfbdb1ccfabb468a0398396d466 Author: Johannes Ranke <jranke@uni-bremen.de> Date: 2017-01-27 07:54:53 +0100 diff --git a/DESCRIPTION b/DESCRIPTION index 81f8df2..97b5962 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling Version: 0.4-2 -Date: 2017-01-27 +Date: 2017-01-29 Authors@R: person("Johannes Ranke", email = "jranke@uni-bremen.de", role = c("aut", "cre", "cph")) Description: Utilities for simple calculations of predicted environmental @@ -26,6 +26,8 @@ export(SFO_actual_twa) export(SSLRC_mobility_classification) export(TOXSWA_cwa) export(endpoint) +export(evaluate_PELMO) +export(focus_80th) export(geomean) export(max_twa) export(one_box) diff --git a/R/FOCUS_PELMO_data.R b/R/FOCUS_PELMO_data.R index 28888e7..89fe5f6 100644 --- a/R/FOCUS_PELMO_data.R +++ b/R/FOCUS_PELMO_data.R @@ -2,10 +2,10 @@ #' #' A named character vector with the crop names used in the PELMO 5.5.3 GUI. #' For the names, three letter codes were constructed by generally taking the -#' first three letters in lower case. Only when there is an expression in -#' parentheses, the first letter of this expression becomes the first letter +#' first three letters in lower case. Only when there is an expression in +#' parentheses, the first letter of this expression becomes the first letter #' in the three letter code, i.e. 'Peas (animals)' has the code \code{ape}. -#' +#' #' @docType data #' @export #' @examples @@ -37,13 +37,13 @@ FOCUS_PELMO_crops = c( tom = "Tomatoes", vin = "Vines") -#' FOCUS PELMO crop acronyms used for naming sceneario files +#' FOCUS PELMO crop acronyms used for naming sceneario files #' #' A named character vector with the crop acronyms used in FOCUS PELMO 5.5.3 #' for naming the .sze files located in the FOCUS directory. The crop acronyms #' in the file names are sometimes capitalized, sometimes not. The scenario #' files used for Beans (field) and Beans (vegetable) are the same. -#' +#' #' @docType data #' @export #' @examples @@ -85,6 +85,6 @@ FOCUS_PELMO_crop_sze_names = c( #' @examples #' print(FOCUS_PELMO_location_codes) FOCUS_PELMO_location_codes = c( - Cha = "C", Ham = "H", Jok = "J", - Kre = "K", Oke = "N", Pia = "P", + Cha = "C", Ham = "H", Jok = "J", + Kre = "K", Oke = "N", Pia = "P", Por = "O", Sev = "S", Thi = "T") diff --git a/R/PELMO_runs.R b/R/PELMO_runs.R index f599110..5d401ea 100644 --- a/R/PELMO_runs.R +++ b/R/PELMO_runs.R @@ -1,7 +1,10 @@ #' Set up runs for FOCUS PELMO #' #' Per default, the runs are also executed with FOCUS PELMO, and the results are processed -#' and returned. +#' and returned. Currently, only FOCUS PELMO as installed on Linux (or other Unix systems) +#' using the \code{\link{install_PELMO}} from the \code{PELMO.installeR} package +#' maintained on github is supported. In such installations, FOCUS PELMO is installed into +#' package installation directory of \code{PELMO.installeR} and run with \code{wine}. #' #' @param runs A list of lists. Each inner lists has an element named 'psm' #' that holds the psm string, and elements named using three letter crop acronyms, @@ -15,6 +18,9 @@ #' @param cores The number of cores to execute PELMO runs in parallel #' @param evaluate Should the results be returned? #' @param overwrite Should an existing run directories be overwritten +#' @references PELMO.installeR \url{https://jranke.github.io/PELMO.installeR} +#' +#' Wine \url{https://winehq.org} #' @export PELMO_runs <- function(runs, psm_dir = ".", version = "5.5.3", PELMO_base = "auto", execute = TRUE, cores = getOption("mc.cores", 2L), @@ -80,26 +86,9 @@ PELMO_runs <- function(runs, psm_dir = ".", version = "5.5.3", PELMO_base = "aut add <- function(x) cat(paste0(x, "\r\n"), file = input_file, append = TRUE) - # How many years do we calculate (26, 46 or 66)? - psm <- readLines(psm_file, encoding = "latin1") - number_of_apps_lines <- grep("number of application location", psm) - absolute_apps_line <- grep(location_code, - psm[number_of_apps_lines]) - period <- 1 # application every year - if (length(absolute_apps_line) == 1) { - apps_root <- number_of_apps_lines[absolute_apps_line] - } else { - apps_root <- number_of_apps_lines[1] - } - - number_of_apps <- as.integer(substr(psm[apps_root], 1, 3)) - last_app_line <- psm[apps_root + number_of_apps] - last_app_year <- as.integer(gsub("^.{2,3} .. (..) .*", "\\1", - last_app_line)) - if (last_app_year > 26) period <- 2 - if (last_app_year > 46) period <- 3 + interval <- get_interval(psm_file, location_code) - n_years <- switch(as.character(period), + n_years <- switch(as.character(interval), "1" = 26, "2" = 46, "3" = 66) @@ -145,18 +134,23 @@ PELMO_runs <- function(runs, psm_dir = ".", version = "5.5.3", PELMO_base = "aut # the exe file from this directory file.copy(file.path(PELMO_base, "lf90.eer"), run_dir) } + run_list[[7]] + setup_run(run_list[[7]]) lapply(run_list, setup_run) if (execute) { run_PELMO(runs, version = version, PELMO_base = PELMO_base) } + + if (evaluate) { + evaluate_PELMO(runs, version = version, PELMO_base = PELMO_base) + } } -#' Run PELMO -#' #' @inheritParams PELMO_runs #' @importFrom parallel mclapply +#' @rdname PELMO_runs #' @export run_PELMO <- function(runs, version = "5.5.3", PELMO_base = "auto", cores = getOption("mc.cores", 2L)) @@ -295,3 +289,128 @@ create_run_list <- function(runs, psm_dir = ".", check_psm_files = FALSE) { } return(run_list) } + +#' @rdname PELMO_runs +#' @inheritParams PELMO_runs +#' @importFrom parallel mclapply +#' @export +evaluate_PELMO <- function(runs, version = "5.5.3", PELMO_base = "auto") +{ + + if (PELMO_base[1] == "auto") { + PELMO_base = file.path(system.file(package = "PELMO.installeR"), + paste0("FOCUSPELMO.", gsub("\\.", "", version))) + } + + for (run in runs) { + psm <- run$psm + crops <- setdiff(names(run), "psm") + for (crop in crops) { + for (scenario in run[[crop]]) { + run_dir <- file.path(PELMO_base, "FOCUS", PELMO_path(psm, crop, scenario)) + echo_file <- readLines(file.path(run_dir, "ECHO.PLM"), encoding = "latin1") + parm_lines <- grep("\\*\\*\\* PARAMETERS OF", echo_file, value = TRUE) + acronyms <- gsub(".*\\((.*)\\).*", "\\1", parm_lines) + met_codes <- gsub(".*METABOLITE (..).*", "\\1", parm_lines) + met_codes[1] <- NA + names(met_codes) <- acronyms + + psm_file <- file.path(run_dir, paste0(psm, ".psm")) + location_code <- FOCUS_PELMO_location_codes[scenario] + interval <- get_interval(psm_file, location_code) + + # Get percolate for each period + wasser <- readLines(file.path(run_dir, "WASSER.PLM")) + percolate_lines <- grep("RECHARGE BELOW ROOT ZONE", wasser, value = TRUE) + percolate <- as.numeric(substr(percolate_lines, 40, 46)) + percolate_period <- sum_periods(percolate, interval) + + # Set up results that should match period.plm generated by the PELMO GUI + results_pfm <- list() + for (acronym in acronyms) { + results_pfm[[acronym]] <- list() + periods <- data.frame( + period = 1:20, + flux = NA, + percolate = 10 * percolate_period, + conc = NA) + + if (is.na(met_codes[acronym])) { + chem_file <- file.path(run_dir, "CHEM.PLM") + } else { + chem_file <- file.path(run_dir, paste0("CHEM_", met_codes[acronym], ".PLM")) + } + + annual_flux <- get_flux(chem_file) + periods$flux <- sum_periods(annual_flux, interval) * 1000 + + periods$conc <- 100 * periods$flux / periods$percolate + + results_pfm[[acronym]]$periods <- periods + results_pfm[[acronym]]$focus <- focus_80th(periods$conc) + } + save(results_pfm, file = file.path(run_dir, "period_pfm.rda")) + } + } + } +} + +#' Get the application interval in years from a psm file +get_interval <- function(psm_file, location_code) { + # How many years do we calculate (26, 46 or 66)? + psm <- readLines(psm_file, encoding = "latin1") + number_of_apps_lines <- grep("number of application location", psm) + absolute_apps_line <- grep(location_code, + psm[number_of_apps_lines]) + interval <- 1 # application every year + if (length(absolute_apps_line) == 1) { + apps_root <- number_of_apps_lines[absolute_apps_line] + } else { + apps_root <- number_of_apps_lines[1] + } + + number_of_apps <- as.integer(substr(psm[apps_root], 1, 3)) + last_app_line <- psm[apps_root + number_of_apps] + last_app_year <- as.integer(gsub("^.{2,3} .. (..) .*", "\\1", + last_app_line)) + if (last_app_year > 26) interval <- 2 + if (last_app_year > 46) interval <- 3 + return(interval) +} + +#' Sum up values according to FOCUS periods +sum_periods <- function(annual, interval) { + n_years <- switch(as.character(interval), + "1" = 26, + "2" = 46, + "3" = 66) + period_start_years <- seq(from = 7, to = n_years, by = interval) + sapply(1:20, function(x) { + years_i <- period_start_years[x] + (0 : (interval - 1)) + sum(annual[years_i]) + }) +} + +#' Get the flux of a chemical out of the FOCUS layer from a CHEM*.PLM file +get_flux <- function(chem_file) { + chem <- readLines(chem_file) + lowest_focus_comp_lines <- grep("^ . 21 ", chem, value = TRUE) + lowest_focus_comp <- read.table(text = lowest_focus_comp_lines) + return(lowest_focus_comp$V9) +} + +#' Calculate the 80th percentile according to FOCUS guidance +#' +#' This is nowadays defined as the mean of the 16th and the 17th +#' highest value. Previously, the 17th highest values was used (FOCUS 2014, p. +#' 18). NaN values need to be set to zero in order to reproduce the +#' values obtained by PELMO. +#' @param c_period A numeric vector of values to calculate the percentile from +#' @param old Should the old calculation method be used (the 17th highest value)? +#' @export +focus_80th <- function(c_period, old = FALSE) { + c_period <- ifelse(is.na(c_period), 0, c_period) + c_period_sorted <- sort(c_period) + if (old) return(c_period_sorted[17]) + else return(mean(c_period_sorted[c(16, 17)])) +} diff --git a/_pkgdown.yml b/_pkgdown.yml index ff5f43d..829ba48 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -17,6 +17,9 @@ reference: contents: - PEC_soil - soil_scenario_data_EFSA_2015 + - title: Predicted environmental concentrations in groundwater + contents: + - PELMO_runs - title: Predicted environmental concentrations in surface water contents: - PEC_sw_drift diff --git a/docs/reference/FOCUS_GW_scenarios_2012.html b/docs/reference/FOCUS_GW_scenarios_2012.html index 64b42e9..fbc1649 100644 --- a/docs/reference/FOCUS_GW_scenarios_2012.html +++ b/docs/reference/FOCUS_GW_scenarios_2012.html @@ -70,10 +70,16 @@ </div> - <p>Currently, only a small subset of the soil definitions are provided.</p> + <p>Currently, only scenario names with acronyms and a small subset of the soil definitions are provided. The +soil definitions are from page 46ff. from FOCUS (2012).</p> + <pre><span class='no'>FOCUS_GW_scenarios_2012</span></pre> + <h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2> + + <p>An object of class <code>list</code> of length 2.</p> + <h2 class="hasAnchor" id="references"><a class="anchor" href="#references"></a>References</h2> <p>FOCUS (2012) Generic guidance for Tier 1 FOCUS ground water assessments. Version 2.1. @@ -147,6 +153,8 @@ <h2>Contents</h2> <ul class="nav nav-pills nav-stacked"> + <li><a href="#format">Format</a></li> + <li><a href="#references">References</a></li> <li><a href="#examples">Examples</a></li> diff --git a/docs/reference/FOCUS_PELMO_crop_sze_names.html b/docs/reference/FOCUS_PELMO_crop_sze_names.html new file mode 100644 index 0000000..5777868 --- /dev/null +++ b/docs/reference/FOCUS_PELMO_crop_sze_names.html @@ -0,0 +1,121 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>FOCUS PELMO crop acronyms used for naming sceneario files — FOCUS_PELMO_crop_sze_names • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>FOCUS PELMO crop acronyms used for naming sceneario files</h1> + </div> + + + <p>A named character vector with the crop acronyms used in FOCUS PELMO 5.5.3 +for naming the .sze files located in the FOCUS directory. The crop acronyms +in the file names are sometimes capitalized, sometimes not. The scenario +files used for Beans (field) and Beans (vegetable) are the same.</p> + + + <pre><span class='no'>FOCUS_PELMO_crop_sze_names</span></pre> + + <h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2> + + <p>An object of class <code>character</code> of length 25.</p> + + + <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> + <pre class="examples"><div class='input'><span class='fu'>print</span>(<span class='no'>FOCUS_PELMO_crop_sze_names</span>)</div><div class='output co'>#> app gra pot sug win fbe vbe bus +#> "apples" "grass" "potato" "sbeets" "wcerea" "beans" "beans" "bushb" +#> cab car cit cot lin mai soi woi +#> "cabbag" "carrot" "citrus" "cotton" "linse" "maize" "rapesu" "rapewi" +#> oni ape soy spr str sun tob tom +#> "onions" "peas" "soyb" "scerea" "strawb" "sunflo" "tobacc" "tomato" +#> vin +#> "vines" </div></pre> + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + + <li><a href="#format">Format</a></li> + + <li><a href="#examples">Examples</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/FOCUS_PELMO_crops.html b/docs/reference/FOCUS_PELMO_crops.html new file mode 100644 index 0000000..d9ad8d2 --- /dev/null +++ b/docs/reference/FOCUS_PELMO_crops.html @@ -0,0 +1,132 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>FOCUS PELMO crop names — FOCUS_PELMO_crops • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>FOCUS PELMO crop names</h1> + </div> + + + <p>A named character vector with the crop names used in the PELMO 5.5.3 GUI. +For the names, three letter codes were constructed by generally taking the +first three letters in lower case. Only when there is an expression in +parentheses, the first letter of this expression becomes the first letter +in the three letter code, i.e. 'Peas (animals)' has the code <code>ape</code>.</p> + + + <pre><span class='no'>FOCUS_PELMO_crops</span></pre> + + <h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2> + + <p>An object of class <code>character</code> of length 25.</p> + + + <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> + <pre class="examples"><div class='input'><span class='fu'>print</span>(<span class='no'>FOCUS_PELMO_crops</span>)</div><div class='output co'>#> app gra pot +#> "Apples" "Grass and alfalfa" "Potatoes" +#> sug win fbe +#> "Sugar beets" "Winter cereals" "Beans (field)" +#> vbe bus cab +#> "Beans (vegetables)" "Bushberries" "Cabbage" +#> car cit cot +#> "Carrots" "Citrus" "Cotton" +#> lin mai soi +#> "Linseed" "Maize" "Oil seed rape (summer)" +#> woi oni ape +#> "Oil seed rape (winter)" "Onions" "Peas (animals)" +#> soy spr str +#> "Soybeans" "Spring cereals" "Strawberries" +#> sun tob tom +#> "Sunflower" "Tobacco" "Tomatoes" +#> vin +#> "Vines" </div></pre> + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + + <li><a href="#format">Format</a></li> + + <li><a href="#examples">Examples</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/FOCUS_PELMO_location_codes.html b/docs/reference/FOCUS_PELMO_location_codes.html new file mode 100644 index 0000000..8051d42 --- /dev/null +++ b/docs/reference/FOCUS_PELMO_location_codes.html @@ -0,0 +1,113 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Location codes in FOCUS PELMO — FOCUS_PELMO_location_codes • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Location codes in FOCUS PELMO</h1> + </div> + + + <p>A named character vector of one letter location codes used in FOCUS PELMO, +indexed by three letter acronyms.</p> + + + <pre><span class='no'>FOCUS_PELMO_location_codes</span></pre> + + <h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2> + + <p>An object of class <code>character</code> of length 9.</p> + + + <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> + <pre class="examples"><div class='input'><span class='fu'>print</span>(<span class='no'>FOCUS_PELMO_location_codes</span>)</div><div class='output co'>#> Cha Ham Jok Kre Oke Pia Por Sev Thi +#> "C" "H" "J" "K" "N" "P" "O" "S" "T" </div></pre> + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + + <li><a href="#format">Format</a></li> + + <li><a href="#examples">Examples</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/PELMO_path.html b/docs/reference/PELMO_path.html new file mode 100644 index 0000000..79aa89d --- /dev/null +++ b/docs/reference/PELMO_path.html @@ -0,0 +1,112 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Create a path of run directories as the PELMO GUI does — PELMO_path • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Create a path of run directories as the PELMO GUI does</h1> + </div> + + + <p>Create a path of run directories as the PELMO GUI does</p> + + + <pre><span class='fu'>PELMO_path</span>(<span class='no'>psm</span>, <span class='no'>crop</span>, <span class='no'>scenario</span>)</pre> + + <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a> Arguments</h2> + <dl class="dl-horizontal"> + <dt>psm</dt> + <dd>The psm identifier</dd> + <dt>crop</dt> + <dd>The PELMO crop acronym</dd> + <dt>scenario</dt> + <dd>The scenario</dd> + </dl> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + <li><a href="#arguments">Arguments</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/PELMO_runs.html b/docs/reference/PELMO_runs.html new file mode 100644 index 0000000..e872196 --- /dev/null +++ b/docs/reference/PELMO_runs.html @@ -0,0 +1,144 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Set up runs for FOCUS PELMO — PELMO_runs • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Set up runs for FOCUS PELMO</h1> + </div> + + + <p>Per default, the runs are also executed with FOCUS PELMO, and the results are processed +and returned. Currently, only FOCUS PELMO as installed on Linux (or other Unix systems) +using the <code>install_PELMO</code> from the <code>PELMO.installeR</code> package +maintained on github is supported. In such installations, FOCUS PELMO is installed into +package installation directory of <code>PELMO.installeR</code> and run with <code>wine</code>.</p> + + + <pre><span class='fu'>PELMO_runs</span>(<span class='no'>runs</span>, <span class='kw'>psm_dir</span> <span class='kw'>=</span> <span class='st'>"."</span>, <span class='kw'>version</span> <span class='kw'>=</span> <span class='st'>"5.5.3"</span>, <span class='kw'>PELMO_base</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, + <span class='kw'>execute</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fu'>getOption</span>(<span class='st'>"mc.cores"</span>, <span class='fl'>2L</span>), <span class='kw'>evaluate</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, + <span class='kw'>overwrite</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>) + +<span class='fu'>run_PELMO</span>(<span class='no'>runs</span>, <span class='kw'>version</span> <span class='kw'>=</span> <span class='st'>"5.5.3"</span>, <span class='kw'>PELMO_base</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, + <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fu'>getOption</span>(<span class='st'>"mc.cores"</span>, <span class='fl'>2L</span>)) + +<span class='fu'>evaluate_PELMO</span>(<span class='no'>runs</span>, <span class='kw'>version</span> <span class='kw'>=</span> <span class='st'>"5.5.3"</span>, <span class='kw'>PELMO_base</span> <span class='kw'>=</span> <span class='st'>"auto"</span>)</pre> + + <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a> Arguments</h2> + <dl class="dl-horizontal"> + <dt>runs</dt> + <dd>A list of lists. Each inner lists has an element named 'psm' +that holds the psm string, and elements named using three letter crop acronyms, +as used in <code><a href='FOCUS_PELMO_crops.html'>FOCUS_PELMO_crops</a></code>, +that hold character vectors of three letter scenario acronyms +as used in <code><a href='FOCUS_GW_scenarios_2012.html'>FOCUS_GW_scenarios_2012</a></code>.</dd> + <dt>psm_dir</dt> + <dd>The directory where the psm files are located</dd> + <dt>version</dt> + <dd>The FOCUS PELMO version</dd> + <dt>PELMO_base</dt> + <dd>Where the FOCUS PELMO installation is located</dd> + <dt>execute</dt> + <dd>Should PELMO be executed directly?</dd> + <dt>cores</dt> + <dd>The number of cores to execute PELMO runs in parallel</dd> + <dt>evaluate</dt> + <dd>Should the results be returned?</dd> + <dt>overwrite</dt> + <dd>Should an existing run directories be overwritten</dd> + </dl> + + <h2 class="hasAnchor" id="references"><a class="anchor" href="#references"></a>References</h2> + + <p>PELMO.installeR <a href = 'https://jranke.github.io/PELMO.installeR'>https://jranke.github.io/PELMO.installeR</a></p> + <p>Wine <a href = 'https://winehq.org'>https://winehq.org</a></p> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + <li><a href="#arguments">Arguments</a></li> + + <li><a href="#references">References</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/create_run_list.html b/docs/reference/create_run_list.html new file mode 100644 index 0000000..b2c9798 --- /dev/null +++ b/docs/reference/create_run_list.html @@ -0,0 +1,116 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Create a list of runs that we can traverse — create_run_list • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Create a list of runs that we can traverse</h1> + </div> + + + <p>Create a list of runs that we can traverse</p> + + + <pre><span class='fu'>create_run_list</span>(<span class='no'>runs</span>, <span class='kw'>psm_dir</span> <span class='kw'>=</span> <span class='st'>"."</span>, <span class='kw'>check_psm_files</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</pre> + + <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a> Arguments</h2> + <dl class="dl-horizontal"> + <dt>runs</dt> + <dd>A list of lists. Each inner lists has an element named 'psm' +that holds the psm string, and elements named using three letter crop acronyms, +as used in <code><a href='FOCUS_PELMO_crops.html'>FOCUS_PELMO_crops</a></code>, +that hold character vectors of three letter scenario acronyms +as used in <code><a href='FOCUS_GW_scenarios_2012.html'>FOCUS_GW_scenarios_2012</a></code>.</dd> + <dt>psm_dir</dt> + <dd>The directory where the psm files are located</dd> + <dt>check_psm_files</dt> + <dd>Should we check if the psm file exists</dd> + </dl> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + <li><a href="#arguments">Arguments</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/evaluate_PELMO.html b/docs/reference/evaluate_PELMO.html new file mode 100644 index 0000000..58e7843 --- /dev/null +++ b/docs/reference/evaluate_PELMO.html @@ -0,0 +1,116 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Evaluate PELMO runs — evaluate_PELMO • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Evaluate PELMO runs</h1> + </div> + + + <p>Evaluate PELMO runs</p> + + + <pre><span class='fu'>evaluate_PELMO</span>(<span class='no'>runs</span>, <span class='kw'>version</span> <span class='kw'>=</span> <span class='st'>"5.5.3"</span>, <span class='kw'>PELMO_base</span> <span class='kw'>=</span> <span class='st'>"auto"</span>)</pre> + + <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a> Arguments</h2> + <dl class="dl-horizontal"> + <dt>runs</dt> + <dd>A list of lists. Each inner lists has an element named 'psm' +that holds the psm string, and elements named using three letter crop acronyms, +as used in <code><a href='FOCUS_PELMO_crops.html'>FOCUS_PELMO_crops</a></code>, +that hold character vectors of three letter scenario acronyms +as used in <code><a href='FOCUS_GW_scenarios_2012.html'>FOCUS_GW_scenarios_2012</a></code>.</dd> + <dt>version</dt> + <dd>The FOCUS PELMO version</dd> + <dt>PELMO_base</dt> + <dd>Where the FOCUS PELMO installation is located</dd> + </dl> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + <li><a href="#arguments">Arguments</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/focus_80th.html b/docs/reference/focus_80th.html new file mode 100644 index 0000000..8160746 --- /dev/null +++ b/docs/reference/focus_80th.html @@ -0,0 +1,113 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Calculate the 80th percentile according to FOCUS guidance — focus_80th • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Calculate the 80th percentile according to FOCUS guidance</h1> + </div> + + + <p>This is nowadays defined as the mean of the 16th and the 17th +highest value. Previously, the 17th highest values was used (FOCUS 2014, p. +18). NaN values need to be set to zero in order to reproduce the +values obtained by PELMO.</p> + + + <pre><span class='fu'>focus_80th</span>(<span class='no'>c_period</span>, <span class='kw'>old</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</pre> + + <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a> Arguments</h2> + <dl class="dl-horizontal"> + <dt>c_period</dt> + <dd>A numeric vector of values to calculate the percentile from</dd> + <dt>old</dt> + <dd>Should the old calculation method be used (the 17th highest value)?</dd> + </dl> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + <li><a href="#arguments">Arguments</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/get_flux.html b/docs/reference/get_flux.html new file mode 100644 index 0000000..64ea25e --- /dev/null +++ b/docs/reference/get_flux.html @@ -0,0 +1,101 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Get the flux of a chemical out of the FOCUS layer from a CHEM*.PLM file — get_flux • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Get the flux of a chemical out of the FOCUS layer from a CHEM*.PLM file</h1> + </div> + + + <p>Get the flux of a chemical out of the FOCUS layer from a CHEM*.PLM file</p> + + + <pre><span class='fu'>get_flux</span>(<span class='no'>chem_file</span>)</pre> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/get_interval.html b/docs/reference/get_interval.html new file mode 100644 index 0000000..13171c1 --- /dev/null +++ b/docs/reference/get_interval.html @@ -0,0 +1,101 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Get the application interval in years from a psm file — get_interval • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Get the application interval in years from a psm file</h1> + </div> + + + <p>Get the application interval in years from a psm file</p> + + + <pre><span class='fu'>get_interval</span>(<span class='no'>psm_file</span>, <span class='no'>location_code</span>)</pre> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/index.html b/docs/reference/index.html index 8f57cd2..33713b6 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -67,7 +67,7 @@ <div class="col-md-9"> <div class="page-header"> <h1>Function reference</h1> - <h4>version 0.4-1</h4> + <h4>version 0.4-2</h4> </div> <div class="contents"> @@ -117,6 +117,14 @@ <ul> <li><code><a href="soil_scenario_data_EFSA_2015.html">soil_scenario_data_EFSA_2015</a></code></li> </ul> + <h2 id="section-predicted-environmental-concentrations-in-groundwater" class="hasAnchor"><a href="#section-predicted-environmental-concentrations-in-groundwater" class="anchor"></a>Predicted environmental concentrations in groundwater</h2> + <p class="section-desc"></p> + + + <p><a href="PELMO_runs.html">Set up runs for FOCUS PELMO</a></p> + <ul> + <li><code><a href="PELMO_runs.html">PELMO_runs</a></code></li><li><code><a href="PELMO_runs.html">run_PELMO</a></code></li><li><code><a href="PELMO_runs.html">evaluate_PELMO</a></code></li> + </ul> <h2 id="section-predicted-environmental-concentrations-in-surface-water" class="hasAnchor"><a href="#section-predicted-environmental-concentrations-in-surface-water" class="anchor"></a>Predicted environmental concentrations in surface water</h2> <p class="section-desc"></p> @@ -173,6 +181,7 @@ <ul class="nav nav-pills nav-stacked"> <li><a href="#section-general-utility-functions">General utility functions</a></li> <li><a href="#section-predicted-environmental-concentrations-in-soil">Predicted environmental concentrations in soil</a></li> + <li><a href="#section-predicted-environmental-concentrations-in-groundwater">Predicted environmental concentrations in groundwater</a></li> <li><a href="#section-predicted-environmental-concentrations-in-surface-water">Predicted environmental concentrations in surface water</a></li> <li><a href="#section-classifications-and-indicators">Classifications and indicators</a></li> </ul> diff --git a/docs/reference/run_PELMO.html b/docs/reference/run_PELMO.html new file mode 100644 index 0000000..067d3c1 --- /dev/null +++ b/docs/reference/run_PELMO.html @@ -0,0 +1,119 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Run PELMO — run_PELMO • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Run PELMO</h1> + </div> + + + <p>Run PELMO</p> + + + <pre><span class='fu'>run_PELMO</span>(<span class='no'>runs</span>, <span class='kw'>version</span> <span class='kw'>=</span> <span class='st'>"5.5.3"</span>, <span class='kw'>PELMO_base</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, + <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fu'>getOption</span>(<span class='st'>"mc.cores"</span>, <span class='fl'>2L</span>))</pre> + + <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a> Arguments</h2> + <dl class="dl-horizontal"> + <dt>runs</dt> + <dd>A list of lists. Each inner lists has an element named 'psm' +that holds the psm string, and elements named using three letter crop acronyms, +as used in <code><a href='FOCUS_PELMO_crops.html'>FOCUS_PELMO_crops</a></code>, +that hold character vectors of three letter scenario acronyms +as used in <code><a href='FOCUS_GW_scenarios_2012.html'>FOCUS_GW_scenarios_2012</a></code>.</dd> + <dt>version</dt> + <dd>The FOCUS PELMO version</dd> + <dt>PELMO_base</dt> + <dd>Where the FOCUS PELMO installation is located</dd> + <dt>cores</dt> + <dd>The number of cores to execute PELMO runs in parallel</dd> + </dl> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + <li><a href="#arguments">Arguments</a></li> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/docs/reference/sum_periods.html b/docs/reference/sum_periods.html new file mode 100644 index 0000000..66466ac --- /dev/null +++ b/docs/reference/sum_periods.html @@ -0,0 +1,101 @@ +<!-- Generated by pkgdown: do not edit by hand --> +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +<title>Sum up values according to FOCUS periods — sum_periods • pfm</title> + +<!-- jquery --> +<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script> +<!-- Bootstrap --> + +<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> + +<!-- Font Awesome icons --> +<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> + + +<!-- pkgdown --> +<link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script> +<script src="../pkgdown.js"></script> + +<!-- mathjax --> +<script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> + +<!--[if lt IE 9]> +<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> +<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> +<![endif]--> + </head> + + <body> + <div class="container template-reference-topic"> + <header> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../index.html">pfm</a> + </div> + <div id="navbar" class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li> + <a href="../reference/index.html">Reference</a> +</li> + </ul> + + <ul class="nav navbar-nav navbar-right"> + + </ul> + </div><!--/.nav-collapse --> + </div><!--/.container --> +</div><!--/.navbar --> + + + </header> + + <div class="row"> + <div class="col-md-9 contents"> + <div class="page-header"> + <h1>Sum up values according to FOCUS periods</h1> + </div> + + + <p>Sum up values according to FOCUS periods</p> + + + <pre><span class='fu'>sum_periods</span>(<span class='no'>annual</span>, <span class='no'>interval</span>)</pre> + + + </div> + <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> + <h2>Contents</h2> + <ul class="nav nav-pills nav-stacked"> + </ul> + + </div> +</div> + + <footer> + <div class="copyright"> + <p>Developed by Johannes Ranke.</p> +</div> + +<div class="pkgdown"> + <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> +</div> + + </footer> + </div> + + </body> +</html> diff --git a/man/FOCUS_PELMO_crops.Rd b/man/FOCUS_PELMO_crops.Rd index f6a41b4..91a010a 100644 --- a/man/FOCUS_PELMO_crops.Rd +++ b/man/FOCUS_PELMO_crops.Rd @@ -11,8 +11,8 @@ FOCUS_PELMO_crops \description{ A named character vector with the crop names used in the PELMO 5.5.3 GUI. For the names, three letter codes were constructed by generally taking the -first three letters in lower case. Only when there is an expression in -parentheses, the first letter of this expression becomes the first letter +first three letters in lower case. Only when there is an expression in +parentheses, the first letter of this expression becomes the first letter in the three letter code, i.e. 'Peas (animals)' has the code \code{ape}. } \examples{ diff --git a/man/PELMO_runs.Rd b/man/PELMO_runs.Rd index 71fe6ef..1d81e6d 100644 --- a/man/PELMO_runs.Rd +++ b/man/PELMO_runs.Rd @@ -2,11 +2,18 @@ % Please edit documentation in R/PELMO_runs.R \name{PELMO_runs} \alias{PELMO_runs} +\alias{run_PELMO} +\alias{evaluate_PELMO} \title{Set up runs for FOCUS PELMO} \usage{ PELMO_runs(runs, psm_dir = ".", version = "5.5.3", PELMO_base = "auto", execute = TRUE, cores = getOption("mc.cores", 2L), evaluate = TRUE, overwrite = FALSE) + +run_PELMO(runs, version = "5.5.3", PELMO_base = "auto", + cores = getOption("mc.cores", 2L)) + +evaluate_PELMO(runs, version = "5.5.3", PELMO_base = "auto") } \arguments{ \item{runs}{A list of lists. Each inner lists has an element named 'psm' @@ -31,5 +38,13 @@ as used in \code{\link{FOCUS_GW_scenarios_2012}}.} } \description{ Per default, the runs are also executed with FOCUS PELMO, and the results are processed -and returned. +and returned. Currently, only FOCUS PELMO as installed on Linux (or other Unix systems) +using the \code{\link{install_PELMO}} from the \code{PELMO.installeR} package +maintained on github is supported. In such installations, FOCUS PELMO is installed into +package installation directory of \code{PELMO.installeR} and run with \code{wine}. +} +\references{ +PELMO.installeR \url{https://jranke.github.io/PELMO.installeR} + +Wine \url{https://winehq.org} } diff --git a/man/focus_80th.Rd b/man/focus_80th.Rd new file mode 100644 index 0000000..8436791 --- /dev/null +++ b/man/focus_80th.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/PELMO_runs.R +\name{focus_80th} +\alias{focus_80th} +\title{Calculate the 80th percentile according to FOCUS guidance} +\usage{ +focus_80th(c_period, old = FALSE) +} +\arguments{ +\item{c_period}{A numeric vector of values to calculate the percentile from} + +\item{old}{Should the old calculation method be used (the 17th highest value)?} +} +\description{ +This is nowadays defined as the mean of the 16th and the 17th +highest value. Previously, the 17th highest values was used (FOCUS 2014, p. +18). NaN values need to be set to zero in order to reproduce the +values obtained by PELMO. +} diff --git a/man/get_flux.Rd b/man/get_flux.Rd new file mode 100644 index 0000000..93778cb --- /dev/null +++ b/man/get_flux.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/PELMO_runs.R +\name{get_flux} +\alias{get_flux} +\title{Get the flux of a chemical out of the FOCUS layer from a CHEM*.PLM file} +\usage{ +get_flux(chem_file) +} +\description{ +Get the flux of a chemical out of the FOCUS layer from a CHEM*.PLM file +} diff --git a/man/get_interval.Rd b/man/get_interval.Rd new file mode 100644 index 0000000..a751996 --- /dev/null +++ b/man/get_interval.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/PELMO_runs.R +\name{get_interval} +\alias{get_interval} +\title{Get the application interval in years from a psm file} +\usage{ +get_interval(psm_file, location_code) +} +\description{ +Get the application interval in years from a psm file +} diff --git a/man/run_PELMO.Rd b/man/run_PELMO.Rd deleted file mode 100644 index a286c5c..0000000 --- a/man/run_PELMO.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/PELMO_runs.R -\name{run_PELMO} -\alias{run_PELMO} -\title{Run PELMO} -\usage{ -run_PELMO(runs, psm_dir = ".", version = "5.5.3", PELMO_base = "auto", - cores = getOption("mc.cores", 2L)) -} -\arguments{ -\item{runs}{A list of lists. Each inner lists has an element named 'psm' -that holds the psm string, and elements named using three letter crop acronyms, -as used in \code{\link{FOCUS_PELMO_crops}}, -that hold character vectors of three letter scenario acronyms -as used in \code{\link{FOCUS_GW_scenarios_2012}}.} - -\item{psm_dir}{The directory where the psm files are located} - -\item{version}{The FOCUS PELMO version} - -\item{PELMO_base}{Where the FOCUS PELMO installation is located} - -\item{cores}{The number of cores to execute PELMO runs in parallel} -} -\description{ -Run PELMO -} diff --git a/man/sum_periods.Rd b/man/sum_periods.Rd new file mode 100644 index 0000000..5051af4 --- /dev/null +++ b/man/sum_periods.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/PELMO_runs.R +\name{sum_periods} +\alias{sum_periods} +\title{Sum up values according to FOCUS periods} +\usage{ +sum_periods(annual, interval) +} +\description{ +Sum up values according to FOCUS periods +} diff --git a/tests/testthat/test_PELMO.R b/tests/testthat/test_PELMO.R index 7b7e2b6..ab0e37a 100644 --- a/tests/testthat/test_PELMO.R +++ b/tests/testthat/test_PELMO.R @@ -17,40 +17,33 @@ runs <- list( pot = c("Cha", "Ham")), list( psm = "Pesticide_D_1_May_every_other_year_mets", - mai = c("Cha"))) - + win = names(FOCUS_GW_scenarios_2012$names))) test_that("PELMO paths are correctly created", { psm_paths = c( PELMO_path(runs[[1]]$psm, "fbe", "Por"), PELMO_path(runs[[2]]$psm, "pot", "Ham"), - PELMO_path(runs[[3]]$psm, "mai", "Cha")) + PELMO_path(runs[[3]]$psm, "win", "Cha")) - # Check for psm files and put them into PELMO_base - psm_new_locations <- character(0) for (i in seq_along(psm_paths)) { psm_file <- file.path(test_dir, psm_paths[i], paste0(runs[[i]]$psm, ".psm")) expect_true(file.exists(psm_file)) psm_new_location <- file.path(PELMO_base, basename(psm_file)) - psm_new_locations[i] <- psm_new_location - file.copy(psm_file, psm_new_location) + file.copy(psm_file, psm_new_location, overwrite = TRUE) } }) test_that("PELMO runs are correctly set up", { # Prepare runs in analogy to the test archive - PELMO_runs(runs, psm_dir = PELMO_base, execute = FALSE, overwrite = TRUE) + PELMO_runs(runs, psm_dir = PELMO_base, execute = FALSE, evaluate = FALSE, overwrite = TRUE) # Check that input files are correctly generated in the right location for (run in runs) { psm <- run$psm - # message(psm) crops <- setdiff(names(run), "psm") for (crop in crops) { - # message(crop) for (scenario in run[[crop]]) { - # message(scenario) pp <- PELMO_path(psm, crop, scenario) input_new <- readLines(file.path(PELMO_base, "FOCUS", pp, "pelmo.inp")) @@ -64,7 +57,7 @@ test_that("PELMO runs are correctly set up", { }) test_that("PELMO runs can be run and give the expected result files", { - run_PELMO(runs, cores = 5) + run_PELMO(runs, cores = 7) plm_files <- c("CHEM.PLM", "ECHO.PLM", "KONZCHEM.PLM", "KONZC_A1", "KONZC_B1", @@ -75,9 +68,7 @@ test_that("PELMO runs can be run and give the expected result files", { psm <- run$psm crops <- setdiff(names(run), "psm") for (crop in crops) { - # message(crop) for (scenario in run[[crop]]) { - # message(scenario) pp <- PELMO_path(psm, crop, scenario) for (plm in plm_files) { @@ -95,10 +86,57 @@ test_that("PELMO runs can be run and give the expected result files", { }) test_that("PELMO runs are correctly evaluated", { - evaluate_PELMO(runs, psm_dir = PELMO_base) + results <- evaluate_PELMO(runs) + # Check that if output is the same as in the test archive + for (run in runs) { + psm <- run$psm + crops <- setdiff(names(run), "psm") + for (crop in crops) { + for (scenario in run[[crop]]) { + pp <- PELMO_path(psm, crop, scenario) -}) + period_file <- readLines(file.path(test_dir, pp, "period.plm"), encoding = "latin1") + + result_lines <- grep("^\tResults for.*in the percolate at 1 m soil depth$", period_file) + acronyms <- gsub(".*\\((.*)\\).*", "\\1", period_file[result_lines]) + names(result_lines) <- acronyms + + results <- list() + for (acronym in acronyms) { + results[[acronym]] <- list() + conc_lines <- result_lines[acronym] + 5:24 + tmp <- read.table(text = period_file[conc_lines], sep = "\t") + results[[acronym]]$periods <- data.frame( + period = as.integer(tmp$V2), + flux = tmp$V3, + percolate = tmp$V4, + conc = tmp$V5) + tmp80 <- read.table(text = period_file[result_lines[acronym] + 27], sep = "\t") + results[[acronym]]$focus <- tmp80[[1, "V5"]] + } -# Clean up -unlink(psm_new_locations) + period_pfm_file <- file.path(PELMO_base, "FOCUS", pp, "period_pfm.rda") + load(period_pfm_file) + + # Test for equality of all the components separately, + # as we need to adapt the tolerance + for (acronym in acronyms) { + p_pelmo <- results[[acronym]]$periods + p_test <- results_pfm[[acronym]]$periods + expect_equal(p_test$flux, p_pelmo$flux, tol = 1e-6, scale = 1) + expect_equal(p_test$percolate, p_pelmo$percolate) + # PELMO sets the concentration to 0 when the percolate is zero. + # We get NaN, which is more reasonable, but we need to + # take this into account for testing + p_test$conc <- ifelse(is.na(p_test$conc), 0, p_test$conc) + expect_equal(p_test$conc, p_pelmo$conc, tol = 1e-3, scale = 1) + + # FOCUS PEC + expect_equal(results_pfm[[acronym]]$focus, results[[acronym]]$focus, + tol = 1e-3, scale = 1) + } + } + } + } +}) |