stack() run a stack of TROLL simulation. The minimal set of input files required for a TROLL run include (i) climate data for the focal location (climate and daily), (ii) functional traits for the list of species at the focal location (species), and (iii) global parameters (global), i.e. parameters that do not depend on species identity.

stack(
  name = NULL,
  simulations,
  path = NULL,
  global,
  species,
  climate,
  daily,
  lidar = NULL,
  forest = NULL,
  load = TRUE,
  cores = NULL,
  verbose = TRUE,
  overwrite = TRUE,
  thin = NULL
)

Arguments

name

char. Stack name (if NULL the timestamp will be used).

simulations

char. Simulation names (corrsponding to simulation indexes in orresponding tables, see example below).

path

char. Path to save the stack of simulation outputs (parent folder), the default is null corresponding to a simulation in memory without saved intermediary files (based on temporary files from option.rcontroll).

global

df. Global parameters (e.g. TROLLv3_input or using generate_parameters()).

species

df. Species parameters (e.g. TROLLv3_species).

climate

df. Climate parameters (e.g. TROLLv3_climatedaytime12).

daily

df. Daily variation parameters (e.g. TROLLv3_daytimevar).

lidar

df. Lidar simulation parameters (e.g. using generate_lidar()), if null not computed (default NULL).

forest

df. TROLL with forest input, if null starts from an empty grid (default NULL) (e.g. using TROLLv3_output with get_forest()).

load

bool. TROLL outputs are loaded in R memory, if not only the path and name of the stack of simulations is kept in the resulting trollstack() object but the content can be accessed later using the load_sim() method.

cores

int. Number of cores for parallelization, if NULL available cores - 1 (default NULL). You can use parallel::detectCores() to know available cores on your machine.

verbose

bool. Show TROLL log in the console.

overwrite

bool. Overwrite previous outputs folder and files.

thin

int. Vector of integers corresponding to the iterations to be kept to reduce output size, default is NULL and corresponds to no thinning.

Value

A trollstack() object.

See also

Examples

if (FALSE) { # \dontrun{
data("TROLLv3_species")
data("TROLLv3_climatedaytime12")
data("TROLLv3_daytimevar")
data("TROLLv3_output")
TROLLv3_input_stack <- generate_parameters(
  cols = 100, rows = 100,
  iterperyear = 12, nbiter = 12 * 1
) %>%
  mutate(simulation = list(c("seed50000", "seed500"))) %>%
  unnest(simulation)
TROLLv3_input_stack[62, 2] <- 500 # Cseedrain
stack(
  name = "teststack",
  simulations = c("seed50000", "seed500"),
  global = TROLLv3_input_stack,
  species = TROLLv3_species,
  climate = TROLLv3_climatedaytime12,
  daily = TROLLv3_daytimevar,
  load = TRUE,
  cores = 2,
  verbose = FALSE,
  thin = c(1, 5, 10)
)
} # }