spwb_spatial.Rd
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.
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
)
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
)
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
)
An object of class sf
with the following columns:
geometry
: Spatial geometry.
id
: Stand identifiers.
elevation
: Elevation above sea level (in m).
slope
: Slope (in degrees).
aspect
: Aspect (in degrees).
land_cover_type
: Land cover type of each grid cell (values should be 'wildland' or 'agriculture').
forest
: Objects of class forest
.
soil
: Objects of class soil
or data frames of physical properties.
state
: Objects of class spwbInput
or growthInput
(optional).
meteo
: Data frames with weather data (required if parameter meteo = NULL
).
crop_factor
: Crop evapo-transpiration factor. Only required for 'agriculture' land cover type.
management_arguments
: Lists with management arguments. Optional, relevant for fordyn_spatial
only.
represented_area_ha
: Area represented by each stand in hectares. Optional, relevant for fordyn_spatial
when
fire_regime
is supplied only).
ignition_weights
: Relative weights to determine stands to be burned. Optional, relevant for fordyn_spatial
when
fire_regime
is supplied only).
A data frame with species parameters (see SpParamsMED
).
Input meteorological data (see section details). If NULL, the function will expect a column 'meteo' in parameter y
.
A list of control parameters (see defaultControl
) for function spwb_day
or growth_day
.
A Date
object describing the days of the period to be modeled.
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 meteo
).
Boolean flag to indicate that point/cell simulation results are to be returned (set to FALSE
and use summary functions for large data sets).
An appropriate function to calculate summaries (e.g., summary.spwb
).
List with additional arguments for the summary function.
Boolean flag to try parallelization (will use all clusters minus one).
Integer with the number of cores to be used for parallel computation.
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).
Boolean flag to display progress information for simulations.
A list of parameters defining the fire regime (see create_fire_regime
) or
a matrix representing a fire regime instance (see fire_regime_instance
),
to be used in simulations with fordyn_spatial
. If NULL, wildfires are not simulated.
A function that implements forest management actions (see fordyn
).
of such lists, one per spatial unit.
An object of class 'sf' containing four elements:
geometry
: Spatial geometry.
id
: Stand id, taken from the input.
state
: A list of spwbInput
or growthInput
objects for each simulated stand, to be used in subsequent simulations (see update_landscape
) or with NULL values whenever simulation errors occurred.
forest
: A list of forest
objects for each simulated stand (only in function fordyn_spatial
), to be used in subsequent simulations (see update_landscape
) or with NULL values whenever simulation errors occurred.
management_arguments
: A list of management arguments for each simulated stand (only in function fordyn_spatial
if management function was supplied), to be used in subsequent simulations (see update_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) if keep_results = FALSE
.
summary
: A list of model output summaries for each simulated stand (if summary_function
was not NULL
), with NULL values whenever simulation errors occurred.
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 package meteoland
.
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.
spwb
, growth
, fordyn
, spwb_spatial_day
,
simulation_summary
, plot_summary
,
initialize_landscape
, update_landscape
if (FALSE) {
# 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
dates <- seq(as.Date("2001-03-01"), as.Date("2001-03-15"), by="day")
res <- spwb_spatial(example_ifn, SpParamsMED, examplemeteo, dates = dates)
# Generate summaries (these could have also been specified when calling 'spwbspatial')
res_sum <- simulation_summary(res, summary_function = summary.spwb, freq="month")
# Plot summaries
plot_summary(res_sum, "Transpiration", "2001-03-01")
# Perform fordyn simulation for one year (one stand) without management
res_noman <- fordyn_spatial(example_ifn[1,], SpParamsMED, examplemeteo)
# Add management arguments to all stands
example_ifn$management_arguments <- vector("list", nrow(example_ifn))
for(i in 1:nrow(example_ifn)) example_ifn$management_arguments[[i]] <- defaultManagementArguments()
# Change thinning threshold for stand #1
example_ifn$management_arguments[[1]]$thinningThreshold <- 15
# Perform fordyn simulation for one year (one stand) with management
res_man <- fordyn_spatial(example_ifn[1,], SpParamsMED, examplemeteo,
management_function = defaultManagementFunction)
# Compare table of cuttings with vs. without management
res_noman$result[[1]]$CutTreeTable
res_man$result[[1]]$CutTreeTable
# Perform fordyn simulation for one year with fire regime
example_ifn10 <- example_ifn[1:10,]
example_ifn10$represented_area_ha <- 100
regime <- create_fire_regime(c("2001" = 200))
res_fire <- fordyn_spatial(example_ifn10, SpParamsMED, examplemeteo,
fire_regime = regime)
# Perform fordyn simulation for one year with fire regime instance
regime_instance <- fire_regime_instance(example_ifn10, regime)
res_fire <- fordyn_spatial(example_ifn10, SpParamsMED, examplemeteo,
fire_regime = regime_instance)
}