Skip to contents

Functions that allow calling local models spwb_day or growth_day, for a set of forest stands distributed in specific locations and a given date. No spatial processes are simulated.

Usage

spwb_spatial_day(
  sf,
  meteo = NULL,
  date,
  SpParams,
  local_control = defaultControl(),
  parallelize = FALSE,
  num_cores = detectCores() - 1,
  chunk_size = NULL,
  progress = TRUE
)

growth_spatial_day(
  sf,
  meteo = NULL,
  date,
  SpParams,
  local_control = defaultControl(),
  parallelize = FALSE,
  num_cores = detectCores() - 1,
  chunk_size = NULL,
  progress = TRUE
)

Arguments

sf

An object of class sf with landscape information (see spwb_spatial).

meteo

Meteorology data (see spwb_spatial).

date

A string with the date to be simulated.

SpParams

A data frame with species parameters (see SpParamsMED).

local_control

A list of local model control parameters (see defaultControl).

parallelize

Boolean flag to try parallelization (will use all clusters minus one).

num_cores

Integer with the number of cores to be used for parallel computation.

chunk_size

Integer indicating the size of chunks to be sent to different processes (by default, the number of spatial elements divided by the number of cores).

progress

Boolean flag to display progress information for simulations.

Value

An object of class sf the same name as the function called containing three elements:

  • geometry: Spatial geometry.

  • id: Stand id, taken from the input.

  • state: A list of model input objects for each simulated stand, to be used in subsequent simulations.

  • result: A list of model output for each simulated stand.

Details

Simulation functions accept different formats for meteorological input (described in spwb_spatial).

Author

Miquel De Cáceres Ainsa, CREAF

Examples

# \donttest{
#Load example landscape data
data("example_ifn")

#Load example meteo data frame from package meteoland
data("examplemeteo")
  
#Load default medfate parameters
data("SpParamsMED")
  
#Perform simulation
date <- "2001-03-01"
res <- spwb_spatial_day(example_ifn, examplemeteo, date, SpParamsMED)
#> 
#> ── Simulation of model 'spwb' for date '2001-03-01' ────────────────────────────
#>  Checking sf input
#>  Checking sf input [8ms]
#> 
#>  Checking meteo object input
#>  Checking meteo object input [29ms]
#> 
#>  Creating '100' input objects.
#>  Creating '100' input objects. [1.8s]
#> 
#> • Performing 'spwb' simulations.
# }