Skip to content

Documentation improvements#21

Merged
Cidree merged 7 commits into
mainfrom
avv-docs-poster-and-species-lists
Jun 20, 2026
Merged

Documentation improvements#21
Cidree merged 7 commits into
mainfrom
avv-docs-poster-and-species-lists

Conversation

@aitorvv

@aitorvv aitorvv commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Description

This Pull Request standardizes documentation across the core forest metrics modules (predict-height, predict-biomass, predict-carbon, and predict-snfi-volume). It ensures precise unit reporting (diameter/dnm in cm, height in m, biomass/carbon in kg, and volume in dm³) and provides detailed, dataset-based tutorial examples for applying these functions directly to forest inventories.

Additionally:

  • Height prediction default: silv_predict_height() now defaults to the generic eq_hd_vazquez_veloso_2025("All the species") if no model is specified.
  • Young plantations support: Expanded silv_predict_biomass() to support root collar diameter (rcd) and biomass packing (bp) for young plantations (Menéndez 2022) when DBH/diameter is absent.
  • S7 plot consistency: Merged class-specific plot documentation into the plot generic's page via @rdname plot and aligned generic signature fields to prevent R CMD check codoc mismatches.

Verification

You can dynamically explore the help pages and verify the logic with the following executable R code:

# 1. Load package
devtools::load_all()

# 2. Explore updated documentation interactively
?silv_predict_height
?silv_predict_biomass
?silv_predict_carbon
?silv_predict_snfi_volume

# 3. Verify height prediction (with default model)
heights_default <- silv_predict_height(diameter = c(20, 25, 30))
# heights_default must be: 14.07234 15.90694 17.50925 (meters)
print(heights_default)

# 4. Verify young plantation biomass prediction (Menendez 2022) using rcd only
model_menendez <- eq_biomass_menendez_2022("Pinus pinaster")
predicted_young <- silv_predict_biomass(
  rcd    = c(5.2, 7.1, 9.4),
  height = c(2.1, 3.2, 4.5),
  model  = model_menendez
)
# predicted_young must be: 2.152248  4.972754 10.253238 (kg)
print(predicted_young)

# 5. Verify carbon prediction auto-selection and fallback
carbon_data <- silv_predict_carbon_auto(
  biomass   = c(100, 150),
  species   = c("Pinus pinaster", "Pinus radiata"),
  component = "stem"
)
# carbon_model must fallback to "montero-2005 (genus fallback)" for Pinus radiata
print(carbon_data)

# 6. Verify SNFI Volume calculation (mix of provinces/species names)
vol_results <- silv_predict_snfi_volume(
  province = c("Cantabria", "Araba/Álava"),
  species  = c("Pinus radiata", "Pinus sylvestris"),
  dbh      = c(20.5, 18.2),
  h        = c(15.2, 12.0)
)
# vol_results must return valid volume predictions in dm^3
print(vol_results)

@Cidree Cidree merged commit b44c1be into main Jun 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants