| new_volume_method | R Documentation |
Create a method specification for registry-based volume calculations in external inventory workflows.
new_volume_method(output,
fun = NULL, fun_name = NULL,
unit = "m3", raw_unit = unit,
scale_to_m3 = 1,
build_args = function(ctx,
pars, resolved) list(),
fallback = function(ctx,
pars, resolved) null_or(resolved$preexisting_v_m3,
NA_real_), match_by = character(0),
get_pars = NULL,
pars = NULL, filter_pars = NULL,
required_inputs = NULL)
output |
|
fun |
Optional |
fun_name |
Optional |
unit |
|
raw_unit |
|
scale_to_m3 |
|
build_args |
|
fallback |
|
match_by |
|
get_pars |
Optional |
pars |
Optional embedded parameter table stored inside the method definition. |
filter_pars |
Optional |
required_inputs |
Optional |
The fallback function should return a scalar numeric value, typically NA_real_ or a pre-existing volume estimate already present in the data. Define required_inputs with the standardized variable names expected by the method so the workflow can resolve prerequisites before evaluation.
A named list describing one external volume method.
The list contains the components output, fun,
fun_name, unit, raw_unit,
scale_to_m3, build_args, fallback,
match_by, get_pars, pars,
filter_pars, and required_inputs.
Wilson Lara [aut, cre] (ORCID: <https://orcid.org/0000-0003-3527-1380>), Cristobal Ordonez [aut] (ORCID: <https://orcid.org/0000-0001-5354-3760>), Aitor Vázquez-Veloso [aut] (ORCID: <https://orcid.org/0000-0003-0227-506X>), Felipe Bravo [aut] (ORCID: <https://orcid.org/0000-0001-7348-6695>)
## Minimal standalone example
vm <- new_volume_method(
output = "vcc",
fun = function(dbh_cm, h_m, pars) dbh_cm * h_m * pars$k[1],
unit = "m3",
raw_unit = "cm3",
scale_to_m3 = 1 / 1e6,
build_args = function(ctx, pars, resolved) {
list(dbh_cm = ctx$d_cm, h_m = ctx$h_m, pars = pars)
},
fallback = function(ctx, pars, resolved) NA_real_,
match_by = "species",
pars = data.frame(species = "sp1", k = 2500),
required_inputs = c("d", "h")
)
names(vm)
vm$output
vm$build_args(
ctx = list(d_cm = 20, h_m = 12),
pars = vm$pars,
resolved = list()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.