Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5aa10f0
feat: extend silv_predict_biomass() to all 7 models + improve docs
aitorvv May 17, 2026
25c7444
readme
aitorvv Jun 9, 2026
43d83a7
fix(docs): add carbon_models to pkgdown index
aitorvv Jun 9, 2026
be4c5a4
avv-fix-biomass-component-gaps: add custom abort error messages for m…
aitorvv Jun 9, 2026
aec6160
avv-fix-biomass-component-gaps: add integration test via silv_predict…
aitorvv Jun 9, 2026
f2e2ca7
feat: add silv_predict_biomass_auto and silv_predict_biomass_components
aitorvv Jun 9, 2026
40435a5
fix: capitalize AGB/BGB columns and abort on unsupported species in c…
aitorvv Jun 9, 2026
3dd3945
feat: add predict-carbon module with auto selection and genus fallback
aitorvv Jun 9, 2026
d76eba0
feat: implement SNFI volume prediction module with compressed RDA coe…
aitorvv Jun 9, 2026
0731759
fix(docs): remove unmerged biomass-auto references from pkgdown config
aitorvv Jun 9, 2026
82cce05
docs: improve height, biomass, and sample-size plot method documentation
aitorvv Jun 11, 2026
f50a5fa
Merge branch 'avv-new-predict-carbon' into avv-docs-poster-and-specie…
aitorvv Jun 11, 2026
16f2299
Merge branch 'avv-new-predict-snfi-volume' into avv-docs-poster-and-s…
aitorvv Jun 11, 2026
38efcad
docs: standardize height, biomass, carbon, and SNFI volume documentat…
aitorvv Jun 11, 2026
969a77e
docs: add default model parameter to silv_predict_height and young pl…
aitorvv Jun 11, 2026
7cb181c
fix: remove deleted plot_SimpleSampleSize from pkgdown yaml
aitorvv Jun 11, 2026
e76c699
test: modularize test suite, fix S7 checks, and add comprehensive cov…
aitorvv Jun 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ internal-data/*
^doc$
^Meta$
^vignettes/\.quarto$
^inst/volume/SNFI3_volume_coefficients$
^inst/volume/SNFI4_volume_coefficients$
^inst/volume/SFNI4_volume_equations\.py$
^inst/volume/volume_equations\.xlsx$
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ Collate:
'metrics-stand-level.R'
'metrics-tree-level.R'
'predict-biomass.R'
'predict-carbon.R'
'predict-height.R'
'predict-snfi-volume.R'
'sample-size.R'
'silviculture-package.R'
'treatment-thinning.R'
Expand Down
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ export(silv_dominant_height)
export(silv_lorey_height)
export(silv_ntrees_ha)
export(silv_predict_biomass)
export(silv_predict_biomass_auto)
export(silv_predict_biomass_components)
export(silv_predict_carbon)
export(silv_predict_carbon_auto)
export(silv_predict_height)
export(silv_predict_snfi_volume)
export(silv_sample_size)
export(silv_sample_size_simple)
export(silv_sample_size_stratified)
export(silv_snfi_provinces)
export(silv_snfi_species)
export(silv_spacing_index)
export(silv_sqrmean_diameter)
export(silv_stand_basal_area)
Expand Down
47 changes: 47 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,50 @@
#' Monografías INIA: Serie Forestal n.º 13. Instituto Nacional de
#' Investigación y Tecnología Agraria y Alimentaria, Madrid.
"carbon_models"


#' SNFI3 tree volume coefficients
#'
#' Allometric equation coefficients for tree volume and increment from the 3rd
#' Spanish National Forest Inventory (SNFI3/IFN3), as documented by MITECO.
#'
#' @format A `tibble` with 37,730 rows and 16 variables:
#' \describe{
#' \item{Codigo_provincia}{Integer. Province numeric code.}
#' \item{Nombre_provincia}{Character. Province name.}
#' \item{Codigo_especie}{Integer. Species numeric code.}
#' \item{Especie}{Character. Species scientific name.}
#' \item{Parametro}{Character. Volume component: VCC (merchantable volume with bark), VSC (merchantable volume without bark), IAVC (annual volume increment with bark), or VLE (coarse firewood volume).}
#' \item{F.c.}{Integer. Tree quality class (calidad del árbol), from 1 (healthy and straight tree) to 6 (dead tree).}
#' \item{Par_esp}{Character. Special parameter metadata.}
#' \item{Modelo}{Integer. Equation model index.}
#' \item{a, b, c, d, p, q, r}{Numeric. Equation coefficients (NA where not applicable).}
#' \item{R2}{Numeric. Coefficient of determination of the model.}
#' }
#' @references
#' MITECO. 3rd Spanish National Forest Inventory - SIG database codes.
#' \url{https://www.miteco.gob.es/content/dam/miteco/es/biodiversidad/servicios/banco-datos-naturaleza/documentador_bdcampo_ifn3_tcm30-282240.pdf}
"snfi3_volume_coefficients"


#' SNFI4 tree volume coefficients
#'
#' Allometric equation coefficients for tree volume and increment from the 4th
#' Spanish National Forest Inventory (SNFI4/IFN4), as documented by MITECO.
#'
#' @format A `tibble` with 20,925 rows and 15 variables:
#' \describe{
#' \item{Codigo_provincia}{Integer. Province numeric code.}
#' \item{Nombre_provincia}{Character. Province name.}
#' \item{Codigo_especie}{Integer. Species numeric code.}
#' \item{Especie}{Character. Species scientific name.}
#' \item{Parametro}{Character. Volume component: VCC (merchantable volume with bark), VSC (merchantable volume without bark), IAVC (annual volume increment with bark), or VLE (coarse firewood volume).}
#' \item{F.c.}{Integer. Tree quality class (calidad del árbol), from 1 (healthy and straight tree) to 6 (dead tree).}
#' \item{Modelo}{Integer. Equation model index.}
#' \item{a, b, c, d, p, q, r}{Numeric. Equation coefficients (NA where not applicable).}
#' \item{D.n.m.}{Character. Mean plot diameter metadata (diámetro normal medio), required for IAVC equation model 13.}
#' }
#' @references
#' MITECO. 4th Spanish National Forest Inventory - SIG database codes.
#' \url{https://www.miteco.gob.es/content/dam/miteco/es/biodiversidad/temas/inventarios-nacionales/documentador_sig_tcm30-536622.pdf}
"snfi4_volume_coefficients"
10 changes: 5 additions & 5 deletions R/metrics-stand-level.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ silv_stand_basal_area <- function(

# 1. Calculate basal area
switch(units,
"mm" = (pi / 4) * (diameter / 1000)**2,
"cm" = (pi / 4) * (diameter / 100)**2,
"dm" = (pi / 4) * (diameter / 10)**2,
"m" = (pi / 4) * diameter**2,
"mm" = (pi / 4) * (diameter / 1000)**2 * ntrees,
"cm" = (pi / 4) * (diameter / 100)**2 * ntrees,
"dm" = (pi / 4) * (diameter / 10)**2 * ntrees,
"m" = (pi / 4) * diameter**2 * ntrees,
cli::cli_abort("Invalid `units`. Use one of {.val {c('mm', 'cm', 'dm', 'm')}}")
)

Expand Down Expand Up @@ -126,7 +126,7 @@ silv_stand_dominant_height <- function(
# 0. Validate inputs
dh_method <- match.arg(which)
assert_positive_numeric(diameter, "diameter")
assert_positive_numeric(diameter, "height")
assert_positive_numeric(height, "height")


# 1. Create a data frame with input variables
Expand Down
Loading
Loading