File size: 1,640 Bytes
fe152d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0cefa06
 
 
463a5f4
fe152d4
1524dc6
 
85ccbbb
1524dc6
 
85ccbbb
1524dc6
 
fe152d4
 
1524dc6
fe152d4
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
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
    """
    base = dbh**2 * height
    if base <= 0:
        print(f"[ERROR] Non-positive base in calculate_biomass: dbh={dbh}, height={height}, base={base}, species={species_name}")

    # Use Zanvo et al. 2023 equations that include both DBH and height
    # Use Komiyama et al. 2005 generic mangrove equation for the else statement, the generic for all other mangroves
    # Note that Komiyama generic equation is used with the average density value of 0.71 g/cm3 found across various mangrove species
    if species_name == "species_A":  # Rhizophora racemosa
        # Total = 2.0738 × (DBH² H)^0.67628
        total_biomass = 2.0738 * (dbh**2 * height)**0.67628
    elif species_name == "species_B":  # Avicennia germinans
        # Total = 1.5595 × (DBH² H)^0.55864
        total_biomass = 1.5595 * (dbh**2 * height)**0.55864
    else:
        # Use a conservative generic equation if species not recognized
        total_biomass = 0.251 * 0.71 * (dbh**2.46)
    
    return total_biomass