er-model / src /allometry.py
malcolmSQ
Initial commit: ER model for Nigeria mangroves
fe152d4
raw
history blame
1.2 kB
"""
Allometric equations for converting tree measurements to biomass.
"""
from typing import Dict
def calculate_biomass(dbh: float, height: float, species_name: str, params: Dict[str, float]) -> float:
"""
Calculate total tree biomass using species-specific allometric equations from Zanvo et al. 2023.
Args:
dbh: Diameter at breast height (cm)
height: Tree height (m)
species_name: Name of the species ("species_A" for Rhizophora, "species_B" for Avicennia)
params: Dictionary containing allometric parameters
Returns:
Total tree biomass (above + below ground) in kg
"""
# Use Zanvo et al. 2023 equations that include both DBH and height
if species_name == "species_A": # Rhizophora
# Total = 1.938 × (DBH² H)^0.67628
total_biomass = 1.938 * (dbh**2 * height)**0.67628
elif species_name == "species_B": # Avicennia
# Total = 1.486 × (DBH² H)^0.55864
total_biomass = 1.486 * (dbh**2 * height)**0.55864
else:
# Use a conservative generic equation if species not recognized
total_biomass = 1.712 * (dbh**2 * height)**0.61746
return total_biomass