check_config: Check the validity of LPJmL config JSON files

View source: R/check_config.R

check_configR Documentation

Check the validity of LPJmL config JSON files

Description

Check if created LPJmL config JSON files (write_config()) are valid and are ready to be used for simulations using lpjcheck for multiple files.

Usage

check_config(
  x,
  model_path = ".",
  sim_path = NULL,
  return_output = FALSE,
  raise_error = FALSE,
  output_path = NULL
)

Arguments

x

job_details object returned by write_config() or character vector providing the config file names (hint: returns x as a list entry).

model_path

Character string providing the path to LPJmL (equal to LPJROOT environment variable). Defaults to ".".

sim_path

Character string defining path where all simulation data are written, including output, restart and configuration files. If NULL, model_path is used. See also write_config

return_output

Parameter affecting the output. If FALSE print stdout/stderr message. If TRUE, return the result of the check. Defaults to FALSE.

raise_error

Logical. Whether to raise an error if sub-process has non-zero exit status. Defaults to FALSE.

output_path

Argument is deprecated as of version 1.0; use sim_path instead.

Value

NULL.

Examples

## Not run: 
library(tibble)
library(lpjmlkit)

model_path <- "./LPJmL_internal"
sim_path <-"./my_runs"


# Basic usage
my_params <- tibble(
  sim_name = c("scen1", "scen2"),
  random_seed = c(12, 404),
  pftpar.1.name = c("first_tree", NA),
  param.k_temp = c(NA, 0.03),
  new_phenology = c(TRUE, FALSE)
)

config_details <- write_config(
  x = my_params,
  model_path = model_path,
  sim_path = sim_path
)

check_config(x = config_details,
  model_path = model_path,
  sim_path = sim_path,
  return_output = FALSE
)

## End(Not run)

lpjmlkit documentation built on March 31, 2023, 9:35 p.m.