#' @title Convert a steady-state soil C pool estimate to a dynamic estimate
#' @description Takes as inputs a decay constant \code{k_*} and a steady-state estimate of a soil C
#' pool. Outputs a "rolling" dynamic estimate of soil C stocks in the supplied pool.
#' @param constant A numeric vector indicating a model decay constant for a given pool, the output
#' of one of \code{k_a()}, \code{k_s()} or \code{k_p()}.
#' @param ss_pool A numeric vector indicating a modelled steady-state soil carbon pool (in tonnes C
#' ha^-1), the output of one of \code{active_y_ss()}, \code{slow_y_ss()}, or
#' \code{passive_y_ss()}.
#' @importFrom purrr accumulate2
#' @export
ss_to_dynamic <- function(constant, ss_pool) {
ss_pool %>%
accumulate2(constant[2:length(constant)], function(x, y, z) x + (y - x) * min(1, z)) %>%
as.numeric()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.