spwb_spatial {medfateland} | R Documentation |
Simulations for spatially-distributed forest stands
Description
Functions that allow calling local models spwb
, growth
or fordyn
, for a set of forest stands distributed in specific locations.
No spatial processes are simulated.
Usage
spwb_spatial(
sf,
SpParams,
meteo = NULL,
local_control = defaultControl(),
dates = NULL,
CO2ByYear = numeric(0),
keep_results = TRUE,
summary_function = NULL,
summary_arguments = NULL,
parallelize = FALSE,
num_cores = detectCores() - 1,
chunk_size = NULL,
progress = TRUE,
local_verbose = FALSE
)
growth_spatial(
sf,
SpParams,
meteo = NULL,
local_control = defaultControl(),
dates = NULL,
CO2ByYear = numeric(0),
fire_regime = NULL,
keep_results = TRUE,
summary_function = NULL,
summary_arguments = NULL,
parallelize = FALSE,
num_cores = detectCores() - 1,
chunk_size = NULL,
progress = TRUE,
local_verbose = FALSE
)
fordyn_spatial(
sf,
SpParams,
meteo = NULL,
local_control = defaultControl(),
dates = NULL,
CO2ByYear = numeric(0),
fire_regime = NULL,
keep_results = TRUE,
management_function = NULL,
summary_function = NULL,
summary_arguments = NULL,
parallelize = FALSE,
num_cores = detectCores() - 1,
chunk_size = NULL,
progress = TRUE,
local_verbose = FALSE
)
Arguments
sf |
An object of class
|
SpParams |
A data frame with species parameters (see |
meteo |
Input meteorological data (see section details). If NULL, the function will expect a column 'meteo' in parameter |
local_control |
A list of control parameters (see |
dates |
A |
CO2ByYear |
A named numeric vector with years as names and atmospheric CO2 concentration (in ppm) as values. Used to specify annual changes in CO2 concentration along the simulation (as an alternative to specifying daily values in |
keep_results |
Boolean flag to indicate that point/cell simulation results are to be returned (set to |
summary_function |
An appropriate function to calculate summaries (e.g., |
summary_arguments |
List with additional arguments for the summary function. |
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 chuncks 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 of simulations. |
local_verbose |
Boolean flag to display detailed progress information in local simulations. |
fire_regime |
A list of parameters defining the fire regime (see |
management_function |
A function that implements forest management actions (see |
Details
Simulation functions accept different formats for meteorological input (parameter meteo
).
The user may supply two kinds of daily weather sources:
A data frame with meteorological data common for all spatial location (spatial variation of weather not considered).
An object or (a list of objects) of class
stars
with reference interpolation data created by packagemeteoland
. If a list of such interpolator objects is supplied, the simulation functions will interpolate on the target locations for the periods covered by each interpolator, but the user will be responsible for supplying interpolators in the correct temporal order.
Alternatively, the user may leave parameter meteo = NULL
and specify a weather data frame for each element of y
in a column named 'meteo'.
Fire regimes are only allowed for function fordyn_spatial
. If an object of class fire_regime
is supplied, the function will call
fire_regime_instance
to generate a realization of the fire regime before conducting simulations. Alternatively,
users can directly supply a fire regime instance matrix, derived from another source (e.g. a fire landscape model). Note that operating
with fire regimes assumes all forest stands share the same period of simulation, but enforcing this is left to the user.
Value
An object of class 'sf' containing four elements:
geometry
: Spatial geometry.id
: Stand id, taken from the input.state
: A list ofspwbInput
orgrowthInput
objects for each simulated stand, to be used in subsequent simulations (seeupdate_landscape
) or with NULL values whenever simulation errors occurred.forest
: A list offorest
objects for each simulated stand (only in functionfordyn_spatial
), to be used in subsequent simulations (seeupdate_landscape
) or with NULL values whenever simulation errors occurred.management_arguments
: A list of management arguments for each simulated stand (only in functionfordyn_spatial
if management function was supplied), to be used in subsequent simulations (seeupdate_landscape
).result
: A list of model output for each simulated stand. Some elements can contain an error condition if the simulation resulted in an error. Values will be NULL (or errors) ifkeep_results = FALSE
.summary
: A list of model output summaries for each simulated stand (ifsummary_function
was notNULL
), with NULL values whenever simulation errors occurred.
Author(s)
Miquel De Cáceres Ainsa, CREAF
See Also
spwb
, growth
, fordyn
, spwb_spatial_day
,
simulation_summary
, plot_summary
,
initialize_landscape
, update_landscape
Examples
# Load example landscape data
data("example_ifn")
# Load example meteo data frame from package meteoland
data("examplemeteo")
# Load default medfate parameters
data("SpParamsMED")
# Subset two plots to speed-up calculations
example_subset <- example_ifn[31:32, ]
# Perform simulation
dates <- seq(as.Date("2001-03-01"), as.Date("2001-03-15"), by="day")
res <- spwb_spatial(example_subset, SpParamsMED, examplemeteo, dates = dates)
# Perform fordyn simulation for one year (one stand) without management
res_noman <- fordyn_spatial(example_subset, SpParamsMED, examplemeteo)