Main function to compute biophysical indicators for forest units from spatial layers. Orchestrates indicator calculation with automatic preprocessing and error handling.
Usage
nemeton_compute(
units,
layers,
indicators = "all",
preprocess = TRUE,
parallel = FALSE,
progress = TRUE,
...
)Arguments
- units
A
nemeton_unitsorsfobject representing analysis units- layers
A
nemeton_layersobject containing spatial data layers- indicators
Character vector of indicator names to calculate, or "all" for all available. See
list_indicatorsfor available indicators from the 12-family framework.- preprocess
Logical. Automatically harmonize CRS and crop layers? Default TRUE.
- parallel
Logical. Use parallel computation? (Not implemented in MVP, will error if TRUE)
- progress
Logical. Show progress bar? Default TRUE.
- ...
Additional arguments passed to indicator functions
Details
The function performs the following steps:
Validates inputs (units and layers)
If
preprocess = TRUE:Reprojects layers to units CRS
Crops layers to units extent
For each indicator:
Calls corresponding
indicator_*()functionHandles errors gracefully (warning + NA column)
Updates metadata
Returns enriched sf object
If an indicator calculation fails, a warning is issued and the indicator column is filled with NA, but computation continues for other indicators.
See also
list_indicators for available indicators in the 12-family framework
Examples
if (FALSE) { # \dontrun{
library(nemeton)
# Create units
units <- nemeton_units(sf::st_read("parcels.gpkg"))
# Create layer catalog
layers <- nemeton_layers(
rasters = list(
biomass = "biomass.tif",
dem = "dem.tif"
),
vectors = list(
roads = "roads.gpkg"
)
)
# Calculate all indicators
results <- nemeton_compute(units, layers)
# Calculate specific indicators
results <- nemeton_compute(
units, layers,
indicators = c("carbon", "biodiversity")
)
} # }