| Title: | A Package for Modelling Forest Trait Ecology and Evolution |
|---|---|
| Description: | Solves trait, size and patch structured model from (Falster et al. 2016) using either method of characteristics or as stochastic, finite-sized population. |
| Authors: | Daniel Falster [aut, cre] (ORCID: <https://orcid.org/0000-0002-9814-092X>), Richard FitzJohn [aut], Andrew O'Reilly-Nugent [aut], Mitchell Henry [ctb], Rafael Schouten [ctb], Isaac Towers [ctb], John Wilshire [ctb] |
| Maintainer: | Daniel Falster <[email protected]> |
| License: | GPL-2 |
| Version: | 2.0.0.9000 |
| Built: | 2026-06-04 10:52:16 UTC |
| Source: | https://github.com/traitecoevo/plant |
Build an appropriately refined schedule for node introduction.
build_schedule(p, env = NULL, ctrl = scm_base_control())build_schedule(p, env = NULL, ctrl = scm_base_control())
p |
Parameters object |
env |
Environment object |
ctrl |
Control object |
There are control options (within the Parameters object)
that affect how this function runs, in particular
schedule_nsteps and schedule_eps control how refined
the schedule will end up, and schedule_verbose controls if
details are printed to the screen during construction.
A Parameters object, with schedule components set. The
output offspring produced is also available as an attribute
birth_rate.
Rich FitzJohn
Control parameters that tune various aspects of the numerical solvers.
Control(..., values = list(...))Control(..., values = list(...))
..., values
|
Values to initialise the struct with (either as variadic arguments, or as a list, but not both). |
Base class of representing patch disturbance
Disturbance_Regime()Disturbance_Regime()
Creates an environment object of specified type
environment_type(type) Environment(type = NULL)environment_type(type) Environment(type = NULL)
type |
Any environment name as a string, e.g.: |
The functions expand_parameters and mutant_parameters convert trait values into parametr objects for the model. By default, expand_parameters adds an extra strategy to existing.
expand_parameters( trait_matrix, p, hyperpar = param_hyperpar(p), birth_rate_list = 1, keep_existing_strategies = TRUE ) mutant_parameters(..., keep_existing_strategies = FALSE)expand_parameters( trait_matrix, p, hyperpar = param_hyperpar(p), birth_rate_list = 1, keep_existing_strategies = TRUE ) mutant_parameters(..., keep_existing_strategies = FALSE)
trait_matrix |
A matrix of traits corresponding to the new types to introduce. |
p |
A |
hyperpar |
Hyperparameter function to use. By default links to standard function for this strategy type. |
birth_rate_list |
List object with birth rates for each species in |
keep_existing_strategies |
Should existing residents be retained
x. Birth rates can take the form of a scalar (constant) or a vector.
In either case birth rates are set as |
... |
Arguments to |
Rich FitzJohn
Sets reasonable defaults for fast numerical calculations
fast_control(base = Control())fast_control(base = Control())
base |
An optional |
A Control object with parameters set.
Rich FitzJohn
Create an FF16_Environment object.
FF16_Environment() K93_Environment()FF16_Environment() K93_Environment()
Add additional state variables to the species component in output of a model.
FF16_expand_state(results) K93_expand_state(results) expand_state(results) TF24_expand_state(results)FF16_expand_state(results) K93_expand_state(results) expand_state(results) TF24_expand_state(results)
results |
from 'tidy_patch' |
similar format to input, but with additional columns for additional state variables
Builds a detailed report on stand grown with FF16 strategy, based on the template Rmd file provided. The reports are rendered as html files and saved in the specified output folder.
FF16_generate_stand_report( results, output_file = "FF16_report.html", overwrite = FALSE, target_ages = NA, input_file = system.file("reports", "FF16_report.Rmd", package = "plant"), quiet = TRUE )FF16_generate_stand_report( results, output_file = "FF16_report.html", overwrite = FALSE, target_ages = NA, input_file = system.file("reports", "FF16_report.Rmd", package = "plant"), quiet = TRUE )
results |
results of runnning |
output_file |
name of output file |
overwrite |
logical value to determine whether to overwrite existing report |
target_ages |
Patches ages at which to make plots |
input_file |
report script (.Rmd) file to build study report |
quiet |
An option to suppress printing during rendering from knitr, pandoc command line and others. |
html file of the rendered report located in the specified output folder.
Hyperparameter function for FF16 physiological model
FF16_hyperpar(m, s, filter = TRUE)FF16_hyperpar(m, s, filter = TRUE)
m |
A matrix of trait values, as returned by |
s |
A strategy object |
filter |
A flag indicating whether to filter columns. If TRUE, any numbers that are within eps of the default strategy are not replaced. |
Create a FF16 Individual
FF16_Individual(s = FF16_Strategy())FF16_Individual(s = FF16_Strategy())
s |
A |
pl <- FF16_Individual() pl$heightpl <- FF16_Individual() pl$height
Setup an a model system with default or specified parameters. This function enables you initialize a model system. Use the model name to start different models.
FF16_Parameters(...) K93_Parameters()FF16_Parameters(...) K93_Parameters()
... |
Arguments to be passed to the model constructor. These include *'patch_area': Area of idnividfual patch. Only relevant for stochastic model. Default is 1.0m2. *'max_patch_lifetime': The maximum time in years we want to simulate *'strategies': A list of stratgies to simulate. The default is an empty list. *'strategy_default': Values for the default startegy. The default values are those specified in the C++ code for the model. *'node_schedule_times_default': Default vector of times at which to introduce nodes. The default is chosen to have close spacing at the start of the simulation. *'node_schedule_times': A list with each element containing the vector of times we want to introduce nodes for each strategy. The default is an empty list. *'ode_times': A vector of patch ages we want the ode solver to stop at |
p1 <- FF16_Parameters() p2 <- FF16_Parameters(max_patch_lifetime = 10.0, patch_area = 1.0, strategies = list(FF16_Strategy()), strategy_default = FF16_Strategy(), node_schedule_times_default = node_schedule_times_default(10.0), node_schedule_times = list(node_schedule_times_default(10.0)), ode_times = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))p1 <- FF16_Parameters() p2 <- FF16_Parameters(max_patch_lifetime = 10.0, patch_area = 1.0, strategies = list(FF16_Strategy()), strategy_default = FF16_Strategy(), node_schedule_times_default = node_schedule_times_default(10.0), node_schedule_times = list(node_schedule_times_default(10.0)), ode_times = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
Strategy parameters that tune various aspects of the biological model.
FF16_Strategy(..., values = list(...))FF16_Strategy(..., values = list(...))
..., values
|
Values to initialise the struct with (either as variadic arguments, or as a list, but not both). |
Grow an individual up to particular sizes.
grow_individual_to_size( individual, sizes, size_name, env, time_max = Inf, warn = TRUE, filter = FALSE ) grow_individual_to_height(individual, heights, env, ...)grow_individual_to_size( individual, sizes, size_name, env, time_max = Inf, warn = TRUE, filter = FALSE ) grow_individual_to_height(individual, heights, env, ...)
individual |
An |
sizes |
A vector of sizes to grow the plant to (increasing in size). |
size_name |
The name of the size variable within
|
env |
An |
time_max |
Time to run the ODE out for – only exists to prevent an infinite loop (say, on an unreachable size). |
warn |
Warn if requesting a plant that is too large? |
filter |
Filter individuals that are too large? |
heights |
Heights (when using |
... |
Additional parameters passed to
|
A list with elements time (the time that a given
size was reached), state (the ode state at these
times, as a matrix) and plant a list of individuals grown to the
appropriate size. Note that if only a single size is given,
a list of length 1 is returned.
Grow a plant up for particular time lengths
grow_individual_to_time(individual, times, env)grow_individual_to_time(individual, times, env)
individual |
An |
times |
A vector of times |
env |
An |
Individual object
Individual(T, E)Individual(T, E)
T |
String containing class of plant strategy to create; |
E |
String containing class of environmnet to create; |
Integrate over the size distribution for each species at each time point, to give totals of each variable Integrations are performed using trapezium integration
integrate_over_size_distribution(tidy_species_data)integrate_over_size_distribution(tidy_species_data)
tidy_species_data |
output of either 'tidy_patch' or 'tidy_species' |
a tibble whose columns provide metrics on integrated totals for each variable for each species at each time
Internals class holding vectors of states, thier associated rates and auxiliary (aux) state which is calculated from the state through running compute_rates
Internals(s_size, a_size)Internals(s_size, a_size)
s_size |
??? |
a_size |
??? |
Interpolate data on size distributions for each species to specific heights at every time point
interpolate_to_heights( tidy_species_data, heights, method = "natural", min_log_density = -100 )interpolate_to_heights( tidy_species_data, heights, method = "natural", min_log_density = -100 )
tidy_species_data |
output of either 'tidy_patch' or 'tidy_species' |
heights |
heights to interpolate to |
method |
Method for interpolation. For more info see help on stats::spline |
min_log_density |
Set minimum possible value of log_density |
Returns a tibble of similar format to input, but with all outputs interpolated to specified hieghts.
Interpolate data on size distributions for each species to specific timer points, using specified interpolation method
interpolate_to_times(tidy_species_data, times, method = "natural")interpolate_to_times(tidy_species_data, times, method = "natural")
tidy_species_data |
output of either 'tidy_patch' or 'tidy_species' |
times |
times to interpolate to |
method |
Method for interpolation. For more info see help on stats::spline |
Returns a tibble of similar format to input, but with all outputs interpolated to specified hieghts.
Hyperparameter function for K93 physiological model
K93_hyperpar(m, s, filter = TRUE)K93_hyperpar(m, s, filter = TRUE)
m |
A matrix of trait values, as returned by |
s |
A strategy object |
filter |
A flag indicating whether to filter columns. If TRUE, any numbers that are within eps of the default strategy are not replaced. |
Create a K93 Individual or Node
K93_Individual(s = K93_Strategy())K93_Individual(s = K93_Strategy())
s |
A |
pl <- K93_Individual() pl$heightpl <- K93_Individual() pl$height
Strategy parameters that tune various aspects of the biological model.
K93_Strategy(..., values = list(...))K93_Strategy(..., values = list(...))
..., values
|
Values to initialise the struct with (either as variadic arguments, or as a list, but not both). |
Leaf model
Leaf( vcmax_25, c, b, psi_crit, beta2, jmax_25, hk_s, a, curv_fact_elec_trans, curv_fact_colim, GSS_tol_abs, vulnerability_curve_ncontrol, ci_abs_tol, ci_niter, g0, g1 )Leaf( vcmax_25, c, b, psi_crit, beta2, jmax_25, hk_s, a, curv_fact_elec_trans, curv_fact_colim, GSS_tol_abs, vulnerability_curve_ncontrol, ci_abs_tol, ci_niter, g0, g1 )
vcmax_25 |
Maximum Carboxylation Rate (umol m^-2 s^-1) |
c |
shape parameter of hydraulic vulnerability curve (unitless) |
b |
sensitivity parameter of hydraulic vulnerability curve (MPa) |
psi_crit |
critical psi stem (-MPa ) |
beta2 |
exponent for effect of hydraulic risk (unitless) |
jmax_25 |
maximum rate of electron transport (umol m^-2 s^-1) |
hk_s |
maximum hydraulic-dependent sapwood turnover rate yr ^ -1 |
a |
quantum yield of photosynthetic electron transport (mol mol^-1) |
curv_fact_elec_trans |
curvature factor for the light response curve (unitless) |
curv_fact_colim |
curvature factor for the colimited photosythnthesis equatiom |
GSS_tol_abs |
tolereance parameter for golden section search |
vulnerability_curve_ncontrol |
number of points for pre-calculating vulnerability curve |
ci_abs_tol |
absolute tolerance value for root-solving ci |
ci_niter |
maximum number of iterations for root-solving ci |
g0 |
g0 parameter in the medlyn model umol m^-2 s^-1 |
g1 |
parameter in the medlyn model umol kPa^0.5 |
Hyperparameters for FF16 physiological model
Hyperparameters for TF24 physiological model
make_FF16_hyperpar( lma_0 = 0.1978791, B_kl1 = 0.4565855, B_kl2 = 1.71, rho_0 = 608, B_dI1 = 0.01, B_dI2 = 0, B_ks1 = 0.2, B_ks2 = 0, B_rs1 = 4012, B_rb1 = 2 * 4012, B_f1 = 3, narea = 0.00187, narea_0 = 0.00187, B_lf1 = 5120.738 * 0.00187 * 24 * 3600/1e+06, B_lf2 = 0.5, B_lf3 = 0.04, B_lf4 = 21000, B_lf5 = 1, k_I = 0.5, latitude = 0 ) make_TF24_hyperpar( lma_0 = 0.1978791, B_kl1 = 0.4565855, B_kl2 = 1.71, rho_0 = 608, B_dI1 = 0.01, B_dI2 = 0, B_ks1 = 0.2, B_ks2 = 0, B_rs1 = 4012, B_rb1 = 2 * 4012, B_f1 = 3, narea = 0.00187, narea_0 = 0.00187, B_lf1 = 5120.738 * 0.00187 * 24 * 3600/1e+06, B_lf2 = 0.5, B_lf3 = 0.04, B_lf4 = 21000, B_lf5 = 1, k_I = 0.5, latitude = 0 )make_FF16_hyperpar( lma_0 = 0.1978791, B_kl1 = 0.4565855, B_kl2 = 1.71, rho_0 = 608, B_dI1 = 0.01, B_dI2 = 0, B_ks1 = 0.2, B_ks2 = 0, B_rs1 = 4012, B_rb1 = 2 * 4012, B_f1 = 3, narea = 0.00187, narea_0 = 0.00187, B_lf1 = 5120.738 * 0.00187 * 24 * 3600/1e+06, B_lf2 = 0.5, B_lf3 = 0.04, B_lf4 = 21000, B_lf5 = 1, k_I = 0.5, latitude = 0 ) make_TF24_hyperpar( lma_0 = 0.1978791, B_kl1 = 0.4565855, B_kl2 = 1.71, rho_0 = 608, B_dI1 = 0.01, B_dI2 = 0, B_ks1 = 0.2, B_ks2 = 0, B_rs1 = 4012, B_rb1 = 2 * 4012, B_f1 = 3, narea = 0.00187, narea_0 = 0.00187, B_lf1 = 5120.738 * 0.00187 * 24 * 3600/1e+06, B_lf2 = 0.5, B_lf3 = 0.04, B_lf4 = 21000, B_lf5 = 1, k_I = 0.5, latitude = 0 )
lma_0 |
Central (mean) value for leaf mass per area [kg /m2] |
B_kl1 |
Rate of leaf turnover at lma_0 [/yr] |
B_kl2 |
Scaling slope for phi in leaf turnover [dimensionless] |
rho_0 |
Central (mean) value for wood density [kg /m3] |
B_dI1 |
Rate of instantaneous mortality at rho_0 [/yr] |
B_dI2 |
Scaling slope for wood density in intrinsic mortality [dimensionless] |
B_ks1 |
Rate of sapwood turnover at rho_0 [/yr] |
B_ks2 |
Scaling slope for rho in sapwood turnover [dimensionless] |
B_rs1 |
CO_2 respiration per unit sapwood volume [mol / yr / m3 ] |
B_rb1 |
CO_2 respiration per unit sapwood volume [mol / yr / m3 ] |
B_f1 |
Cost of seed accessories per unit seed mass [dimensionless] |
narea |
nitrogen per leaf area [kg / m2] |
narea_0 |
central (mean) value for nitrogen per leaf area [kg / m2] |
B_lf1 |
Potential CO_2 photosynthesis at average leaf nitrogen [mol / d / m2] |
B_lf2 |
Curvature of leaf photosynthetic light response curve [dimensionless] |
B_lf3 |
Quantum yield of leaf photosynthetic light response curve [dimensionless] |
B_lf4 |
CO_2 respiration per unit leaf nitrogen [mol / yr / kg] |
B_lf5 |
Scaling exponent for leaf nitrogen in maximum leaf photosynthesis [dimensionless] |
k_I |
light extinction coefficient [dimensionless] |
latitude |
degrees from equator (0-90), used in solar model [deg] |
Set a suitable hyperparameter function for chosen physiological model
make_hyperpar(type) param_hyperpar(parameters) hyperpar(type)make_hyperpar(type) param_hyperpar(parameters) hyperpar(type)
type |
Any strategy name as a string, e.g.: |
parameters |
A parameters object |
Construct hyperparameter object for K93 physiological model
make_K93_hyperpar( b_0 = 0.059, b_1 = 0.012, b_2 = 0.00041, c_0 = 0.008, c_1 = 0.00044, d_0 = 0.00073, d_1 = 0.044, eta = 12, k_I = 0.01 )make_K93_hyperpar( b_0 = 0.059, b_1 = 0.012, b_2 = 0.00041, c_0 = 0.008, c_1 = 0.00044, d_0 = 0.00073, d_1 = 0.044, eta = 12, k_I = 0.01 )
b_0 |
Growth intercept year-1 |
b_1 |
Growth asymptote year-1.(ln cm)-1 |
b_2 |
Growth suppression rate m2.cm-2.year-1 |
c_0 |
Mortality intercept year-1 |
c_1 |
Mortality suppression rate m2.cm-2.year-1 |
d_0 |
Recruitment rate (cm2.year-1) |
d_1 |
Recruitment suppression rate (m2.cm-2) |
eta |
Crown shape parameter |
k_I |
Extinction coefficient used when estimating competitive effect |
A disturbance-free regime for running individual patches
No_Disturbance()No_Disturbance()
Generate a suitable set of default node introduction times, biased so that introductions are more closely packed at the beginning of time, become increasingly spread out.
node_schedule_times_default(max_time)node_schedule_times_default(max_time)
max_time |
Time to generate introduction times up to (the
last introduction time will be at least |
The reason for the stepped distribution is to keep step sizes as series of doublings. Doing this limits the range of possible introduction times from an infinite set of possible values to a very limited subset of values (based on combinations of 1, 0.5, 0.25, 0.125 etc). The reason for doing this is to minimise the number of unique introduction times across all species. The ODE stepper needs to stop at each point where a node is introduced. If each species was selecting a bunch of points that was essentially unique (compared to those selected for all other species), the number of unique node introductions times could get very large, requiring more ODE steps.
Vector of introduction times.
Rich FitzJohn, adapted from original C++ code by Daniel S. Falster.
Schedule of node introduction times
NodeSchedule(n_species)NodeSchedule(n_species)
n_species |
number of species |
Control parameters for the ode system
OdeControl(..., values = list(...))OdeControl(..., values = list(...))
..., values
|
Values to initialise the struct with (either as variadic arguments, or as a list, but not both). |
The function 'optimise_individual_rate_at_height_by_trait' and 'optimise_individual_rate_at_size_by_trait' solve for the maximum of some rate (e.g. growth rate) at a specified height within the interval of the bounds of a given trait
optimise_individual_rate_at_size_by_trait( type = "FF16", bounds, log_scale = TRUE, tol = 0.001, size = 1, size_name = "height", rate = size_name, params = scm_base_parameters(type), env = Environment(type), hyperpars = hyperpar(type), set_state_directly = FALSE ) optimise_individual_rate_at_height_by_trait(..., height = 1)optimise_individual_rate_at_size_by_trait( type = "FF16", bounds, log_scale = TRUE, tol = 0.001, size = 1, size_name = "height", rate = size_name, params = scm_base_parameters(type), env = Environment(type), hyperpars = hyperpar(type), set_state_directly = FALSE ) optimise_individual_rate_at_height_by_trait(..., height = 1)
type |
The type of model to use (e.g. "FF16"). Defaults to "FF16" |
bounds |
A vector giving the lower and upper bounds of the trait |
log_scale |
Should the trait be optimised on a log scale? Defaults to TRUE |
tol |
The tolerance for the optimisation |
size |
The size of the individual to optimise the rate at |
size_name |
The name of the size variable specified by |
rate |
The name of the rate to optimise. Defaults to |
params |
The parameters of the model |
env |
The environment of the model |
hyperpars |
The hyperparameter function of the model |
set_state_directly |
If TRUE, set the state directly to the size, otherwise grows the plant to that size. Defaults to FALSE |
... |
Additional parameters passed to |
height |
Heigh at which grow is optimsied. Defaults to 1 |
Isaac Towers, Daniel Falster and Andrew O'Reilly-Nugent
Activate logging with loggr
plant_log_console( file_name = "console", .message = FALSE, .warning = FALSE, .error = FALSE, ... )plant_log_console( file_name = "console", .message = FALSE, .warning = FALSE, .error = FALSE, ... )
file_name |
File to save output (default = console) |
.message, .warning, .error
|
Include messages, warnings or
errors? By default (and in contrast to |
... |
Additional parameters passed to |
By default plant prints little information about its progress.
This can be modified by enabling logging. A formatter that is
different to the default loggr::log_file formatter is
selected here; it will print additional information that plant's
internal logging functions record.
"Schedule" events (splitting) are sent to the DEBUG stream,
everything else is sent to INFO. All events have a "routine"
field added to them, which is useful if sent to a Redis server
(using loggr.redis).
Title
plot_size_distribution(data_species)plot_size_distribution(data_species)
data_species |
?? |
Gauss-Kronrod Quadrature
QK(rule)QK(rule)
rule |
Degree of the rule; valid sizes are 15, 21, 31, 41, 51, 61. |
Compute the whole plant light compensation point for a single plant.
resource_compensation_point(p, ...)resource_compensation_point(p, ...)
p |
A |
... |
Additional arguments that are ignored |
Rich FitzJohn
Check performance on current system using package bench
run_plant_benchmarks( strategy_types = list(FF16 = FF16_Strategy, TF24 = TF24_Strategy, K93 = K93_Strategy), iterations = 1 )run_plant_benchmarks( strategy_types = list(FF16 = FF16_Strategy, TF24 = TF24_Strategy, K93 = K93_Strategy), iterations = 1 )
strategy_types |
A list of name strategy types to be tests |
iterations |
The number of iterations to be run |
A dataframe of results
Run the SCM, returning the SCM object for interrogation
run_scm( p, env = NULL, ctrl = scm_base_control(), use_ode_times = FALSE, collect = FALSE ) run_scm_collect(p, env = NULL, ctrl = scm_base_control())run_scm( p, env = NULL, ctrl = scm_base_control(), use_ode_times = FALSE, collect = FALSE ) run_scm_collect(p, env = NULL, ctrl = scm_base_control())
p |
Parameters object |
env |
Environment object (defaults to FF16_Environment) |
ctrl |
Control object |
use_ode_times |
Should ODE times be used? |
collect |
Should results be collected? |
A SCM object.
Rich FitzJohn
Run a stochastic simulation of a patch, given a Parameters
run_stochastic_collect( p, env = NULL, ctrl = scm_base_control(), random_schedule = TRUE )run_stochastic_collect( p, env = NULL, ctrl = scm_base_control(), random_schedule = TRUE )
p |
A |
env |
Environment object |
ctrl |
Control object |
random_schedule |
setting to TRUE causes algorithm to generate a random schedule based on offspring arrival and area. |
This one might need to be made differently so that different schedules can be added easily. Not sure if this is how we will generally want to do this. Consider this function liable to change.
Rich FitzJohn
Hopefully sensible set of parameters for use with the SCM. Turns accuracy down a bunch, makes it noisy, sets up the hyperparameterisation that we most often use.
scm_base_control()scm_base_control()
Rich FitzJohn
Basic default settings for a given strategy, environment only really used for templating initially and will be overloaded later by passing an environment to the SCM API (suggesting perhaps the template could be removed).
scm_base_parameters(type = NA, env = environment_type(type))scm_base_parameters(type = NA, env = environment_type(type))
type |
Any strategy name as a string, e.g.: |
env |
And environment object |
Rich FitzJohn
Sequence in log space
seq_log(from, to, length.out) seq_log_range(r, length.out) seq_range(r, length.out)seq_log(from, to, length.out) seq_log_range(r, length.out) seq_range(r, length.out)
from |
Starting point |
to |
Ending point |
length.out |
Number of points to generate |
r |
range (i.e., c(from, to) |
Unlike the billions of options for seq, only
length.out is supported here, and both from and
to must be provided. For completeness, seq_range
generates a range in non-log space.
Rich FitzJohn
Create a list of Strategies or Plants by varying a single trait.
strategy_list( x, parameters, hyperpar = param_hyperpar(parameters), birth_rate_list )strategy_list( x, parameters, hyperpar = param_hyperpar(parameters), birth_rate_list )
x |
Values for the trait. This must be a matrix, with
column names corresponding to entries in |
parameters |
|
hyperpar |
Hyperparameter function to use. By default links to standard function for this strategy type. |
birth_rate_list |
List object with birth rates for each species in
x. Birth rates can take the form of a scalar (constant) or a vector.
In either case birth rates are set as |
This environment is used for the TF24 strategy, which includes soil moisture and hydraulic conductivity parameters.
TF24_Environment()TF24_Environment()
Builds a detailed report on stand grown with TF24 strategy, based on the template Rmd file provided. The reports are rendered as html files and saved in the specified output folder.
TF24_generate_stand_report( results, output_file = "TF24_report.html", overwrite = FALSE, target_ages = NA, input_file = system.file("reports", "TF24_report.Rmd", package = "plant"), quiet = TRUE )TF24_generate_stand_report( results, output_file = "TF24_report.html", overwrite = FALSE, target_ages = NA, input_file = system.file("reports", "TF24_report.Rmd", package = "plant"), quiet = TRUE )
results |
results of runnning |
output_file |
name of output file |
overwrite |
logical value to determine whether to overwrite existing report |
target_ages |
Patches ages at which to make plots |
input_file |
report script (.Rmd) file to build study report |
quiet |
An option to suppress printing during rendering from knitr, pandoc command line and others. |
html file of the rendered report located in the specified output folder.
Hyperparameter function for TF24 physiological model
TF24_hyperpar(m, s, filter = TRUE)TF24_hyperpar(m, s, filter = TRUE)
m |
A matrix of trait values, as returned by |
s |
A strategy object |
filter |
A flag indicating whether to filter columns. If TRUE, any numbers that are within eps of the default strategy are not replaced. |
Create a TF24 Plant or Node
TF24_Individual(s = TF24_Strategy())TF24_Individual(s = TF24_Strategy())
s |
A |
pl <- TF24_Individual() pl$heightpl <- TF24_Individual() pl$height
Setup an a model system with default or specified parameters.
TF24_Parameters(...)TF24_Parameters(...)
... |
Arguments to be passed to the model constructor. These include *'patch_area': Area of idnividfual patch. Only relevant for stochastic model. Default is 1.0m2. *'max_patch_lifetime': The maximum time in years we want to simulate *'strategies': A list of stratgies to simulate. The default is an empty list. *'strategy_default': Values for the default startegy. The default values are those specified in the C++ code for the model. *'node_schedule_times_default': Default vector of times at which to introduce nodes. The default is chosen to have close spacing at the start of the simulation. *'node_schedule_times': A list with each element containing the vector of times we want to introduce nodes for each strategy. The default is an empty list. *'ode_times': A vector of patch ages we want the ode solver to stop at |
p1 <- TF24_Parameters() p2 <- TF24_Parameters(max_patch_lifetime = 10.0)p1 <- TF24_Parameters() p2 <- TF24_Parameters(max_patch_lifetime = 10.0)
Strategy parameters that tune various aspects of the biological model.
TF24_Strategy(..., values = list(...))TF24_Strategy(..., values = list(...))
..., values
|
Values to initialise the struct with (either as variadic arguments, or as a list, but not both). |
Turn 'results' of plant solver, when solving individuals into a tidy data object
tidy_individual(results)tidy_individual(results)
results |
plant solver output. |
a tibble whose columns provide metrics on each individual over time
Turn 'species' component of plant solver output into a tidy data object
Turn 'env' component of solver output into a tidy data object
Turns output of plant solver into a tidy data object
tidy_species(results) tidy_env(results) tidy_patch(results)tidy_species(results) tidy_env(results) tidy_patch(results)
results |
output of run_scm_collect |
a list, containing outputs of plant solver in tidy format
Helper function to create trait matrices suitable for
strategy_list.
trait_matrix(x, trait_name)trait_matrix(x, trait_name)
x |
Values |
trait_name |
Name of a single trait |
Rich FitzJohn
Make colours transparent
util_colour_set_opacity(col, opacity = 0.5)util_colour_set_opacity(col, opacity = 0.5)
col |
Vector of colours |
opacity |
Vector of opacities |
util_colour_set_opacity("red", seq(0, 1, length.out=6)) util_colour_set_opacity(c("red", "blue"), .5)util_colour_set_opacity("red", seq(0, 1, length.out=6)) util_colour_set_opacity(c("red", "blue"), .5)
Weibull_Disturbance_Regime control object.
Weibull_Disturbance_Regime(max_patch_lifetime)Weibull_Disturbance_Regime(max_patch_lifetime)
max_patch_lifetime |
Maximum lifetime of a patch, determines length of a simulation |