def grow(self, time: int, plot: Plot, old_tree: Tree, new_tree: Tree):
        """
        Function that run the diameter and height growing equations
        Source for diameter grow equation:
            Doc.: Sánchez-González M, del Río M, Cañellas I, Montero G (2006). Distance independent tree diameter growth model for cork oak stands. Forest Ecology and Management, 225(1-3), 262-270
            Ref.: Sánchez-González et al, 2006
            Doc.: Sánchez-González M, Calama R, Cañellas I, Montero G (2007). Management oriented growth models for multifunctional Mediterranean Forests: the case of Cork Oak (Quercus suber L.). In EFI proceedings (Vol. 56, pp. 71-84)
            Ref.: Sánchez-González et al, 2007
        Source for height/diameter equation:
            Doc.: Sánchez-González M, Cañellas I, Montero G (2007). Generalized height-diameter and crown diameter prediction models for cork oak forests in Spain. Forest Systems, 16(1), 76-88
            Ref.: Sánchez-González et al, 2007
            Doc.: Sánchez-González M, Calama R, Cañellas I, Montero G (2007). Management oriented growth models for multifunctional Mediterranean Forests: the case of Cork Oak (Quercus suber L.). In EFI proceedings (Vol. 56, pp. 71-84)
            Ref.: Sánchez-González et al, 2007
        Source for cork grow equation:
            Doc.: Sánchez-González M, Calama R, Cañellas I, Montero G (2007). Management oriented growth models for multifunctional Mediterranean Forests: the case of Cork Oak (Quercus suber L.). In EFI proceedings (Vol. 56, pp. 71-84)
            Ref.: Sánchez-González et al, 2007
        """

        idu = 0.18 + 7.89/plot.density - 1.02/plot.si + 2.45/old_tree.dbh
        new_tree.sum_value('dbh', idu)  # annual diameter increment under cork (cm)


        h2 = 1.3 + (plot.dominant_h - 1.3)*((new_tree.dbh/plot.dominant_dbh)**0.4898)
        new_tree.add_value('height', h2)  # height/diameter equation result (m)


        t = old_tree.tree_age + 1  # years
        Xo1 = 0.5*(math.log(old_tree.bark) - 0.57*math.log(1 - math.exp(-0.04*old_tree.tree_age)))
        # Xo2 = math.sqrt((math.log(old_tree.bark) - 0.57*math.log(1 - math.exp(-0.04*old_tree.tree_age))**2 - 4*1.86*math.log(1 - math.exp(-0.04*old_tree.tree_age))))
        Xo = Xo1 # +- Xo2

        cork_2 = old_tree.bark*(((1 - math.exp(-0.04*t)) / (1 - math.exp(-0.04*old_tree.tree_age)))**((0.57+1.86)/Xo))
        new_tree.sum_value('bark', cork_2)
    def biomass(self, tree: Tree):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Biomass equations:
            Doc.: Ruiz-Peinado R, del Rio M, Montero G (2011). New models for estimating the carbon sink capacity of Spanish softwood species. Forest Systems, 20(1), 176-188
            Ref.: Ruiz-Peinado et al, 2011
        """

        wsw = 0.0224 * (tree.dbh**1.923) * (tree.height**1.0193)
        if tree.dbh <= 22.5:
            Z = 0
        else:
            Z = 1
        wthickb = (0.247 * ((tree.dbh - 22.5)**2)) * Z
        wb2_7 = 0.0525 * (tree.dbh**2)
        wtbl = 21.927 + 0.0707 * (tree.dbh**2) - 2.827 * tree.height
        wr = 0.117 * (tree.dbh**2)
        wt = wsw + wb2_7 + wthickb + wtbl + wr

        tree.add_value('wsw', wsw)  # wsw = stem wood (Kg)
        # tree.add_value('wsb', wsb)  # wsb = stem bark (Kg)
        # tree.add_value('w_cork', w_cork)   # w_cork = fresh cork biomass (Kg)
        tree.add_value('wthickb',
                       wthickb)  # wthickb = Thick branches > 7 cm (Kg)
        # tree.add_value('wstb', wstb)  # wstb = wsw + wthickb, stem + branches >7 cm (Kg)
        tree.add_value('wb2_7', wb2_7)  # wb2_7 = branches (2-7 cm) (Kg)
        # tree.add_value('wb2_t', wb2_t)  # wb2_t = wb2_7 + wthickb; branches >2 cm (Kg)
        # tree.add_value('wthinb', wthinb)  # wthinb = Thin branches (2-0.5 cm) (Kg)
        # tree.add_value('wl', wl)  # wl = leaves (Kg)
        tree.add_value(
            'wtbl', wtbl)  # wtbl = wthinb + wl; branches <2 cm and leaves (Kg)
        # tree.add_value('wbl0_7', wbl0_7)  # wbl0_7 = wb2_7 + wthinb + wl; branches <7 cm and leaves (Kg)
        tree.add_value('wr', wr)  # wr = roots (Kg)
        tree.add_value('wt', wt)  # wt = biomasa total (Kg)
Exemple #3
0
    def grow(self, time: int, plot: Plot, old_tree: Tree, new_tree: Tree):
        """
        Function that run the diameter and height growing equations
        Source for diameter growing:
            Doc.: Trasobares A, Tomé M, Miina J (2004). Growth and yield model for Pinus halepensis Mill. in Catalonia, north-east Spain. Forest ecology and management, 203(1-3), 49-62
            Ref.: Trasobares et al, 2004
         Source for height/diameter equation:
            Equation obtained from PHRAGON_2017_v1.cs, a model of Pinus halepensis useful for the old SiManFor version, developed for Aragón by Föra Forest Techonlogies and Diputación General de Aragón
        """
        BALthin = 0  # is not used on the simulation as the author says
        GI = 1  # stand growth index; difference between measured and predicted radius under bark values ~ 1
        beta1 = 1.8511
        beta2 = -3.9402
        beta3 = -0.0085
        beta4 = -0.1137
        beta5 = 0.0410
        beta6 = 0.5662
        dbhg10 = math.exp(beta1 + beta2 / old_tree.dbh +
                          beta3 * old_tree.dbh / GI + beta4 * old_tree.bal /
                          (math.log(old_tree.dbh + 1)) + beta5 * BALthin +
                          beta6 * math.log(GI))
        new_tree.sum_value("dbh", dbhg10)
        # new_tree.sum_value("dbh", dbhg10 / 2)  # that equation calculates diameter grow for 10 years, activate taht line if we want the calculation for 5 years

        a = 2.5511
        b = pow(1.3, a)
        ht = pow(
            b + (pow(plot.dominant_h, a) - b) *
            (1 - math.exp(-0.025687 * new_tree.dbh)) /
            (1 - math.exp(-0.025687 * plot.dominant_dbh)), 1 / a)
        new_tree.add_value(
            "height", ht
        )  # that equation calculates height using the new diameter; is not a growing equation
Exemple #4
0
    def merch_classes(self, tree: Tree):
        """
        Function used to calcule the different comercial volumes depending on the wood purposes
        That function is rdbh by initialize and process_plot Functions
        The data criteria to clasify the wood by different uses was obtained from:
            Doc.: Rodríguez F (2009). Cuantificación de productos forestales en la planificación forestal: Análisis de casos con cubiFOR. In Congresos Forestales
            Ref.: Rodríguez 2009
        """

        ht = tree.height  # total height as ht to simplify
        # class_conditions has different lists for each usage, following that: [wood_usage, hmin/ht, dmin, dmax]
        # [WOOD USE NAME , LOG RELATIVE LENGTH RESPECT TOTAL TREE HEIGHT, MINIMUM DIAMETER, MAXIMUM DIAMETER]
        class_conditions = [['saw_big', 2.5 / ht, 40, 200],
                            ['saw_small', 2.5 / ht, 25, 200],
                            ['saw_canter', 2.5 / ht, 15, 28],
                            ['chips', 1 / ht, 5, 1000000]]

        # usage and merch_list are a dictionary and a list that are returned from merch_calculation
        # to that function, we must send the following information: tree, class_conditions, and the name of our class on this model you are using
        usage, merch_list = TreeModel.merch_calculation(
            tree, class_conditions, PinusPinasterGalicia)

        counter = -1
        for k, i in usage.items():
            counter += 1
            tree.add_value(
                k, merch_list[counter])  # add merch_list values to each usage
    def grow(self, time: int, plot: Plot, old_tree: Tree, new_tree: Tree):
        """
        Function that run the diameter and height growing equations
        Source for diameter growing:
            Equation obtained from PHRAGON_2017_v1.cs, a model of Pinus halepensis useful for the old SiManFor version, developed for Aragón by Föra Forest Techonlogies and Diputación General de Aragón
         Source for height/diameter equation:
            Equation obtained from PHRAGON_2017_v1.cs, a model of Pinus halepensis useful for the old SiManFor version, developed for Aragón by Föra Forest Techonlogies and Diputación General de Aragón
        """
        if plot.si == 0:
            dbhg10 = 0
        else:
            dbhg10 = 0.906633 * math.exp(0.09701 * old_tree.dbh - 0.00111 * (
                    old_tree.dbh ** 2) - 0.05201 * plot.basal_area + 0.050652 * plot.si - 0.09366 * old_tree.bal / plot.basal_area)
            # dbhg5 = dbhg10*0.5  # that equation calculates diameter grow for 10 years, activate taht line if we want the calculation for 5 years
        # new_tree.sum_value("dbh", dbhg5)
        new_tree.sum_value("dbh", dbhg10)


        if dbhg10 == 0:
            ht = 0
        else:
            a = 2.5511
            b = pow(1.3, a)
            ht = pow(b + (pow(plot.dominant_h, a) - b) * (1 - math.exp(-0.025687 * new_tree.dbh)) / (
                    1 - math.exp(-0.025687 * plot.dominant_dbh)), 1/a)
        new_tree.add_value("height", ht)  # that equation calculates height using the new diameter; is not a growing equation
Exemple #6
0
    def grow(self, time: int, plot: Plot, old_tree: Tree, new_tree: Tree):
        """
        Function that run the diameter and height growing equations
        Source for grow equation:
            Doc.: Adame P, Hynynen J, Canellas I, del Río M. (2008). Individual-tree diameter growth model for rebollo oak (Quercus pyrenaica Willd.) coppices. Forest Ecology and Management, 255(3-4), 1011-1022
            Ref.: Adame et al, 2007
        Height/Diameter equation:
            Doc.: Adame P, del Río M, Canellas I (2008). A mixed nonlinear height–diameter model for pyrenean oak (Quercus pyrenaica Willd.). Forest ecology and management, 256(1-2), 88-98
            Ref.: Adame et al, 2008
        """
        if plot.si == 0:
            dbhg10 = 0
        else:
            STR = 0  # su valor debe ser 1 cuando la masa esta en el estrato 1
            dbhg10 = math.exp(0.8351 + 0.1273 * math.log(old_tree.dbh) -
                              0.00006 * (old_tree.dbh**2) -
                              0.01216 * old_tree.bal - 0.00016 * plot.density -
                              0.03386 * plot.dominant_h + 0.04917 * plot.si -
                              0.1991 * STR) - 1
        new_tree.sum_value(
            "dbh", dbhg10)  # growing equation developed to 10 years period

        if dbhg10 == 0:
            htg10 = 0
        else:
            htg10: float = 1.3 + (
                3.099 - 0.00203 * plot.basal_area +
                1.02491 * plot.dominant_h * math.exp(-8.5052 / new_tree.dbh))
        new_tree.add_value(
            "height",
            htg10)  # ecuación de relación h/d, NO para el crecimiento
Exemple #7
0
    def grow(self, time: int, plot: Plot, old_tree: Tree, new_tree: Tree):
        """
        Function that rdbh the diameter and height growing equations
        """

        new_tree.sum_value("dbh", 0)

        new_tree.add_value("height", 0)
    def biomass(self, tree: Tree):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Biomass equations:
            Doc.: Ruiz-Peinado R, del Rio M, Montero G (2011). New models for estimating the carbon sink capacity of Spanish softwood species. Forest Systems, 20(1), 176-188
            Ref.: Ruiz-Peinado et al. 2011
        """

        wsw = 0.0278 * (tree.dbh**2.115) * (tree.height**0.618)
        wb2_t = 0.000381 * (tree.dbh**3.141)
        wtbl = 0.0129 * (tree.dbh**2.320)
        wr = 0.00444 * (tree.dbh**2.804)
        wt = wsw + wb2_t + wtbl + wr

        tree.add_value('wsw', wsw)  # wsw = stem wood (Kg)
        # tree.add_value('wsb', wsb)  # wsb = stem bark (Kg)
        # tree.add_value('w_cork', w_cork)   # w_cork = fresh cork biomass (Kg)
        # tree.add_value('wthickb', wthickb)  # wthickb = Thick branches > 7 cm (Kg)
        # tree.add_value('wstb', wstb)  # wstb = wsw + wthickb, stem + branches >7 cm (Kg)
        # tree.add_value('wb2_7', wb2_7)  # wb2_7 = branches (2-7 cm) (Kg)
        tree.add_value('wb2_t',
                       wb2_t)  # wb2_t = wb2_7 + wthickb; branches >2 cm (Kg)
        # tree.add_value('wthinb', wthinb)  # wthinb = Thin branches (2-0.5 cm) (Kg)
        # tree.add_value('wb05', wb05)  # wb05 = thinniest branches (<0.5 cm) (Kg)
        # tree.add_value('wl', wl)  # wl = leaves (Kg)
        tree.add_value(
            'wtbl', wtbl)  # wtbl = wthinb + wl; branches <2 cm and leaves (Kg)
        # tree.add_value('wbl0_7', wbl0_7)  # wbl0_7 = wb2_7 + wthinb + wl; branches <7 cm and leaves (Kg)
        tree.add_value('wr', wr)  # wr = roots (Kg)
        tree.add_value('wt', wt)  # wt = biomasa total (Kg)
Exemple #9
0
    def biomass(self, tree: Tree):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Biomass equations:
            Doc.: Ruiz-Peinado R, Montero G, del Rio M (2012). Biomass models to estimate carbon stocks for hardwood tree species. Forest systems, 21(1), 42-52
            Ref.: Ruiz-Peinado et al, 2012
        """

        wstb = 0.0261 * (tree.dbh**2) * tree.height
        wb2_7 = -0.0260 * (tree.dbh**2) + 0.536 * tree.height + 0.00538 * (
            tree.dbh**2) * tree.height
        wthinb = 0.898 * tree.dbh - 0.445 * tree.height
        wr = 0.143 * (tree.dbh**2)
        wt = wstb + wb2_7 + wthinb + wr

        # tree.add_value('wsw', wsw)  # wsw = stem wood (Kg)
        # tree.add_value('wsb', wsb)  # wsb = stem bark (Kg)
        # tree.add_value('w_cork', w_cork)   # w_cork = fresh cork biomass (Kg)
        # tree.add_value('wthickb', wthickb)  # wthickb = Thick branches > 7 cm (Kg)
        tree.add_value(
            'wstb', wstb)  # wstb = wsw + wthickb, stem + branches >7 cm (Kg)
        tree.add_value('wb2_7', wb2_7)  # wb2_7 = branches (2-7 cm) (Kg)
        # tree.add_value('wb2_t', wb2_t)  # wb2_t = wb2_7 + wthickb; branches >2 cm (Kg)
        tree.add_value('wthinb',
                       wthinb)  # wthinb = Thin branches (2-0.5 cm) (Kg)
        # tree.add_value('wb05', wb05)  # wb05 = thinniest branches (<0.5 cm) (Kg)
        # tree.add_value('wl', wl)  # wl = leaves (Kg)
        # tree.add_value('wtbl', wtbl)  # wtbl = wthinb + wl; branches <2 cm and leaves (Kg)
        # tree.add_value('wbl0_7', wbl0_7)  # wbl0_7 = wb2_7 + wthinb + wl; branches <7 cm and leaves (Kg)
        tree.add_value('wr', wr)  # wr = roots (Kg)
        tree.add_value('wt', wt)  # wt = biomasa total (Kg)
    def vol(self, tree: Tree, plot: Plot):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        """

        hr = np.arange(0, 1, 0.001)  # that line stablish the integrate conditions for volume calculation
        dob = self.taper_equation_with_bark(tree, hr)  # diameter over bark using taper equation (cm)
        # dub = self.taper_equation_without_bark(tree, hr)  # diameter under/without bark using taper equation (cm)
        fwb = (dob / 20) ** 2  # radius^2 using dob (dm2)
        # fub = (dub / 20) ** 2  # radius^2 using dub (dm2)
        tree.add_value('vol', math.pi * tree.height * 10 * integrate.simps(fwb, hr))  # volume over bark using simpson integration (dm3)
        # tree.add_value('bole_vol', math.pi * tree.height * 10 * integrate.simps(fub, hr))  # volume under bark using simpson integration (dm3)
        # tree.add_value('bark_vol', tree.vol - tree.bole_vol)  # bark volume (dm3)
        tree.add_value('vol_ha', tree.vol * tree.expan / 1000)  # volume over bark per ha (m3/ha)
    def grow(self, time: int, plot: Plot, old_tree: Tree, new_tree: Tree):
        """
        Function that rdbh the diameter and height growing equations
        Height/Diameter equation:
            Doc.: Bartelink HH (1997). Allometric relationships for biomass and leaf area of beech (Fagus sylvatica L). In Annales des sciences forestières (Vol. 54, No. 1, pp. 39-50). EDP Sciences
            Ref.: Bartelink, 1997
        """
        dbhg5: float = 1
        new_tree.sum_value("dbh", dbhg5)

        if dbhg5 == 0:
            htg5 = 0
        else:
            htg5: float = 1.732 * (new_tree.dbh**0.769)  # h/d equation
        new_tree.add_value("height", htg5)
    def crown(self, tree: Tree, plot: Plot, func):
        """
        Function to calculate crown variables for each tree.
        That function is run by initialize and process_plot functions.
        Mean crown diameter equation:
            Doc.: Sánchez-González M, Cañellas I, Montero G (2007). Generalized height-diameter and crown diameter prediction models for cork oak forests in Spain. Forest Systems, 16(1), 76-88
            Ref.: Sánchez-González et al, 2007
            Doc.: Sánchez-González M, Calama R, Cañellas I, Montero G (2007). Management oriented growth models for multifunctional Mediterranean Forests: the case of Cork Oak (Quercus suber L.). In EFI proceedings (Vol. 56, pp. 71-84)
            Ref.: Sánchez-González et al, 2007
        """

        if func == 'initialize':  # if that function is called from initilize, first we must check if that variables are available on the initial inventory
            if tree.lcw == 0:  # if the tree hasn't height maximum crown-width (m) value, it is calculated
                tree.add_value('lcw', (0.2416 + 0.0013*plot.qm_dbh)*tree.dbh - 0.0015*(tree.dbh**2))  # largest crown width (m)
        else:
            tree.add_value('lcw', (0.2416 + 0.0013*plot.qm_dbh)*tree.dbh - 0.0015*(tree.dbh**2))  # largest crown width (m)
Exemple #13
0
    def merch_classes(self, tree: Tree):
        """
        Function used to calcule the different comercial volumes depending on the wood purposes
        That function is rdbh by initialize and process_plot Functions
        """
 
        ht = tree.height  # total height as ht to simplify
        # class_conditions has different lists for each usage, following that: [wood_usage, hmin/ht, dmin, dmax]
        # [WOOD USE NAME , LOG RELATIVE LENGTH RESPECT TOTAL TREE HEIGHT, MINIMUM DIAMETER, MAXIMUM DIAMETER]
        class_conditions = [] 

        # usage and merch_list are a dictionary and a list that are returned from merch_calculation
        # to that function, we must send the following information: tree, class_conditions, and the name of our class on this model you are using
        usage, merch_list = TreeModel.merch_calculation(tree, class_conditions, BasicTreeModel)

        counter = -1
        for k,i in usage.items():
            counter += 1
            tree.add_value(k, merch_list[counter])  # add merch_list values to each usage
Exemple #14
0
    def grow(self, time: int, plot: Plot, old_tree: Tree, new_tree: Tree):
        """
        Function that run the diameter and height growing equations
        Source:
            Doc.: Diéguez-Aranda U, Rojo A, Castedo-Dorado F, et al (2009). Herramientas selvícolas para la gestión forestal sostenible en Galicia. Forestry, 82, 1-16
            Ref.: Diéguez-Aranda et al, 2009
        """

        ht: float = 129.0321 * ((old_tree.height / 129.0321)**(
            (plot.age / (plot.age + 5))**0.301881))
        new_tree.add_value(
            "height", ht
        )  # esta fórmula es para calcular la altura predicha, no para crecimiento

        # en principio esta era una ecuación h/d, así que es mejor calcular el diámetro con la altura total
        #dbh: float = - (math.log(
        #    1 - (1 - math.exp(-0.06160 * plot.dominant_dbh)) * (new_tree.height ** 1.067 - 1.3 ** 1.067) / (
        #                plot.dominant_h ** 1.067 - 1.3 ** 1.067))) / 0.06160
        new_tree.sum_value("dbh", 2.5)
Exemple #15
0
    def biomass(self, tree: Tree):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Biomass equation:
            Doc.: Ruiz-Peinado R, del Rio M, Montero G (2011). New models for estimating the carbon sink capacity of Spanish softwood species. Forest Systems, 20(1), 176-188
            Ref.: Ruiz-Peinado et al, 2011
        """

        wsw = 0.0403 * (tree.dbh**1.838) * (tree.height**0.945
                                            )  # Stem wood (Kg)
        if tree.dbh <= 32.5:
            Z = 0
        else:
            Z = 1
        wthickb = (0.228 * ((tree.dbh - 32.5)**
                            2)) * Z  # wthickb = branches > 7 cm biomass (Kg)
        wb2_7 = 0.0521 * (tree.dbh**2
                          )  # wb2_7 = branches (2-7 cm) biomass (Kg)
        wtbl = 0.0720 * (tree.dbh**2
                         )  # Thin branches + Leaves (<2 cm) biomass (Kg)
        wr = 0.0189 * (tree.dbh**2.445)  # Roots biomass (Kg)
        wt = wsw + wb2_7 + wthickb + wtbl + wr  # Total biomass (Kg)

        tree.add_value('wsw', wsw)  # wsw = stem wood (Kg)
        # tree.add_value('wsb', wsb)  # wsb = stem bark (Kg)
        # tree.add_value('w_cork', w_cork)   # w_cork = fresh cork biomass (Kg)
        tree.add_value('wthickb',
                       wthickb)  # wthickb = Thick branches > 7 cm (Kg)
        # tree.add_value('wstb', wstb)  # wstb = wsw + wthickb, stem + branches >7 cm (Kg)
        tree.add_value('wb2_7', wb2_7)  # wb2_7 = branches (2-7 cm) (Kg)
        # tree.add_value('wb2_t', wb2_t)  # wb2_t = wb2_7 + wthickb; branches >2 cm (Kg)
        # tree.add_value('wthinb', wthinb)  # wthinb = Thin branches (2-0.5 cm) (Kg)
        # tree.add_value('wb05', wb05)  # wb05 = thinniest branches (<0.5 cm) (Kg)
        # tree.add_value('wl', wl)  # wl = leaves (Kg)
        tree.add_value(
            'wtbl', wtbl)  # wtbl = wthinb + wl; branches <2 cm and leaves (Kg)
        # tree.add_value('wbl0_7', wbl0_7)  # wbl0_7 = wb2_7 + wthinb + wl; branches <7 cm and leaves (Kg)
        tree.add_value('wr', wr)  # wr = roots (Kg)
        tree.add_value('wt', wt)  # wt = biomasa total (Kg)
    def vol(self, tree: Tree, plot: Plot):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Volume under bark equation:
            Doc.: Amaral J, Tomé M (2006). Equações para estimação do volume e biomassa de duas espécies de carvalhos: Quercus suber e Quercus ilex. Publicações do GIMREF, 1-21
            Ref.: Amaral and Tomé (2006)
        """

        # hr = np.arange(0, 1, 0.001)  # that line stablish the integrate conditions for volume calculation
        # dob = self.taper_equation_with_bark(tree, hr)  # diameter over bark using taper equation (cm)
        # dub = self.taper_equation_without_bark(tree, hr)  # diameter under/without bark using taper equation (cm)
        # fwb = (dob / 20) ** 2  # radius^2 using dob (dm2)
        # fub = (dub / 20) ** 2  # radius^2 using dub (dm2)
        # tree.add_value('vol', math.pi * tree.height * 10 * integrate.simps(fwb, hr))  # volume over bark using simpson integration (dm3)
        # tree.add_value('bole_vol', math.pi * tree.height * 10 * integrate.simps(fub, hr))  # volume under bark using simpson integration (dm3)
        # tree.add_value('bark_vol', tree.vol - tree.bole_vol)  # bark volume (dm3)
        # tree.add_value('vol_ha', tree.vol * tree.expan / 1000)  # volume over bark per ha (m3/ha)
        tree.add_value('bole_vol', 0.000115*(tree.dbh**2.147335) * 1000)  # volume under bark (dm3)

        if isinstance(tree.bark, float) and isinstance(tree.h_uncork, float) and isinstance(tree.dbh_oc, float):
            tree.add_value('bark_vol', (tree.bark/100) * (tree.h_uncork*10) * ((tree.dbh + tree.dbh_oc) / 20))  # cork fresh volume (dm3)
    def crown(self, tree: Tree, plot: Plot, func):
        """
        Function to calculate crown variables for each tree.
        That function is run by initialize and process_plot functions.
        Crown equations:
            Equation obtained from PHRAGON_2017_v1.cs, a model of Pinus halepensis useful for the old SiManFor version, developed for Aragón by Föra Forest Techonlogies and Diputación General de Aragón
        """

        if func == 'initialize':  # if that function is called from initilize, first we must check if that variables are available on the initial inventory
            if tree.hcb == 0:  # if the tree hasn't basal crown (m) value, it is calculated
                tree.add_value('hcb', tree.height / (1 + math.exp(-0.82385 + 4.039408*plot.hart*
                                    0.01 - 0.01969*plot.si - 0.594323*tree.bal/plot.basal_area)))  # basal crown height (m) calculation
        else:
            tree.add_value('hcb', tree.height / (1 + math.exp(-0.82385 + 4.039408*plot.hart*
                                    0.01 - 0.01969*plot.si - 0.594323*tree.bal/plot.basal_area)))  # basal crown height (m) calculation
                
        tree.add_value('cr', 1 - tree.hcb / tree.height)  # crown ratio calculation (%)
        tree.add_value('lcw', 0.672001 * pow(tree.dbh, 0.880032) * pow(tree.height, -0.60344) * math.exp(0.057872 * tree.height))  # maximum crown-width (m) calculation
Exemple #18
0
    def biomass(self, tree: Tree):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Source:
            Doc.: Diéguez-Aranda U, Rojo A, Castedo-Dorado F, et al (2009). Herramientas selvícolas para la gestión forestal sostenible en Galicia. Forestry, 82, 1-16
            Ref.: Diéguez-Aranda et al, 2009
        """

        wstb = 0.3882 + 0.01149 * (d**2) * h
        wsb = 0.007900 * (d**2.098) * (h**0.4660)
        wb2_7 = 3.202 - 0.01484 * (d**2) - 0.4228 * h + 0.00279 * (d**2) * h
        wthinb = 0.09781 * (d**2.288) * (h**-0.9648)
        wb05 = 0.001880 * (d**2.154)
        wl = 0.005 * (d**2.383)
        wt = wstb + wsb + wb2_7 + wthinb + wb05 + wl

        # tree.add_value('wsw', wsw)  # wsw = stem wood (Kg)
        tree.add_value('wsb', wsb)  # wsb = stem bark (Kg)
        # tree.add_value('w_cork', w_cork)   # w_cork = fresh cork biomass (Kg)
        # tree.add_value('wthickb', wthickb)  # wthickb = Thick branches > 7 cm (Kg)
        tree.add_value(
            'wstb', wstb)  # wstb = wsw + wthickb, stem + branches >7 cm (Kg)
        tree.add_value('wb2_7', wb2_7)  # wb2_7 = branches (2-7 cm) (Kg)
        # tree.add_value('wb2_t', wb2_t)  # wb2_t = wb2_7 + wthickb; branches >2 cm (Kg)
        tree.add_value('wthinb',
                       wthinb)  # wthinb = Thin branches (2-0.5 cm) (Kg)
        tree.add_value('wb05',
                       wb05)  # wb05 = thinniest branches (<0.5 cm) (Kg)
        tree.add_value('wl', wl)  # wl = leaves (Kg)
        # tree.add_value('wtbl', wtbl)  # wtbl = wthinb + wl; branches <2 cm and leaves (Kg)
        # tree.add_value('wbl0_7', wbl0_7)  # wbl0_7 = wb2_7 + wthinb + wl; branches <7 cm and leaves (Kg)
        # tree.add_value('wr', wr)  # wr = roots (Kg)
        tree.add_value('wt', wt)  # wt = biomasa total (Kg)
Exemple #19
0
    def crown(self, tree: Tree, plot: Plot, func):
        """
        Function to calculate crown variables for each tree.
        That function is run by initialize and process_plot functions.
        Crown equations:
            Doc.: Crecente-Campo F (2008). Modelo de crecimiento de árbol individual para Pinus radiata D. Don en Galicia. Univ Santiago de Compostela
            Ref.: Crecente-Campo, 2008
        """

        if func == 'initialize':  # if that function is called from initilize, first we must check if that variables are available on the initial inventory
            if tree.hlcw == 0:  # if the tree hasn't height maximum crown-width (m) value, it is calculated
                tree.add_value(
                    'hlcw',
                    -4.7570 - 0.08092 * tree.dbh + 0.6408 * tree.height +
                    0.1881 * tree.tree_age + 0.1998 * plot.si)
            if tree.hcb == 0:  # if the tree hasn't basal crown (m) value, it is calculated
                tree.add_value(
                    'hcb', -3.265 - 0.1415 * tree.dbh + 0.5117 * tree.height +
                    0.1430 * tree.tree_age + 0.1691 * plot.dominant_h)
        else:
            tree.add_value(
                'hlcw', -4.7570 - 0.08092 * tree.dbh + 0.6408 * tree.height +
                0.1881 * tree.tree_age + 0.1998 * plot.si)
            tree.add_value(
                'hcb', -3.265 - 0.1415 * tree.dbh + 0.5117 * tree.height +
                0.1430 * tree.tree_age + 0.1691 * plot.dominant_h)

        tree.add_value('cr', 1 -
                       tree.hcb / tree.height)  # crown ratio calculation (%)
        tree.add_value(
            'lcw', 0.06185 * (tree.dbh**1.185) *
            math.exp(-0.009319 * plot.basal_area - 0.009502 * plot.age)
        )  # maximum crown-width (m) calculation
Exemple #20
0
    def biomass(self, tree: Tree):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Biomass equations:
            Doc.: Diéguez-Aranda U, Rojo A, Castedo-Dorado F, et al (2009). Herramientas selvícolas para la gestión forestal sostenible en Galicia. Forestry, 82, 1-16
            Ref.: Diéguez-Aranda et al, 2009
        """

        wstb = 0.01230 * (tree.dbh**1.604) * (tree.height**1.413)
        wsb = 0.003600 * (tree.dbh**2.656)
        wb2_7 = 1.938 + 0.001065 * (tree.dbh**2) * tree.height
        wthinb = 0.03630 * (tree.dbh**2.609) * (tree.height**(-0.9417))
        wb05 = 0.007800 * (tree.dbh**1.961)
        wl = 0.04230 * (tree.dbh**1.714)
        wr = 0.06174 * (tree.dbh**2.144)
        wt = wstb + wsb + wb2_7 + wthinb + wb05 + wl + wr

        # tree.add_value('wsw', wsw)  # wsw = stem wood (Kg)
        tree.add_value('wsb', wsb)  # wsb = stem bark (Kg)
        # tree.add_value('w_cork', w_cork)   # w_cork = fresh cork biomass (Kg)
        # tree.add_value('wthickb', wthickb)  # wthickb = Thick branches > 7 cm (Kg)
        tree.add_value(
            'wstb', wstb)  # wstb = wsw + wthickb, stem + branches >7 cm (Kg)
        tree.add_value('wb2_7', wb2_7)  # wb2_7 = branches (2-7 cm) (Kg)
        # tree.add_value('wb2_t', wb2_t)  # wb2_t = wb2_7 + wthickb; branches >2 cm (Kg)
        tree.add_value('wthinb',
                       wthinb)  # wthinb = Thin branches (2-0.5 cm) (Kg)
        tree.add_value('wb05',
                       wb05)  # wb05 = thinniest branches (<0.5 cm) (Kg)
        tree.add_value('wl', wl)  # wl = leaves (Kg)
        # tree.add_value('wtbl', wtbl)  # wtbl = wthinb + wl; branches <2 cm and leaves (Kg)
        # tree.add_value('wbl0_7', wbl0_7)  # wbl0_7 = wb2_7 + wthinb + wl; branches <7 cm and leaves (Kg)
        tree.add_value('wr', wr)  # wr = roots (Kg)
        tree.add_value('wt', wt)  # wt = biomasa total (Kg)
Exemple #21
0
    def apply_tree_model(self, inventory: Inventory, model: TreeModel, operation: Operation):

        result_inventory = Inventory()

        min = operation.get_variable('min_age') if operation.has('min_age') else 0
        max = operation.get_variable('max_age') if operation.has('max_age') else 1000

        for plot in inventory.plots:

            cut_pies_mayores = list()
            dead_pies_mayores = list()
            result_pies_mayores = list()
            add_pies_mayores = list()  # aquí recojo árboles de masa añadida, con status = I

            if min <= plot.age <= max:

                new_plot = Plot()
                new_plot.clone(plot)

                search_criteria = SearchCriteria()
                search_criteria.add_criteria('status', None, EQUAL)

                source_trees = Tree.get_sord_and_order_tree_list(plot.trees, search_criteria=search_criteria)

                for tree in source_trees:

                    survives_ratio: float = 0.0

                    try:
                        survives_ratio = model.survives(operation.get_variable('time'), new_plot, tree)
                    except Exception as e:
                        Tools.print_log_line(str(e), logging.ERROR)

                    if survives_ratio > 0:

                        new_tree = Tree()
                        new_tree.clone(tree)
                        new_tree.add_value('expan', survives_ratio * new_tree.expan)

                        new_tree_dead = Tree()
                        new_tree_dead.clone(tree)
                        new_tree_dead.add_value('status', 'M')
                        new_tree_dead.add_value('expan', (1 - survives_ratio) * new_tree_dead.expan)

                        try:
                            model.grow(operation.get_variable('time'), new_plot, tree, new_tree)
                        except Exception as e:
                            Tools.print_log_line(str(e), logging.ERROR)

                        #ActualizaDatosPieMayor(new_tree);

                        #source_trees.update_tree(tree)

                        result_pies_mayores.append(new_tree)
                        dead_pies_mayores.append(new_tree_dead)


                # Aquí comienza el código correspondiente a la masa añadida (ingrowth) en las ejecuciones
                # Su funcionamiento, en principio, será similar a la función de supervivencia
                # Se añadirá el EXPAN que se considere a cada árbol directamente en las ejecuciones, y mostraremos en el output un "clon" de cada árbol con el valor del 
                # EXPAN añadido, y con el status = I (Ingrowth) para poder identificarlo (como con árboles muertos)



                new_area_basimetrica: float = 0
                distribution: float = 0  # creo esta variable, que estaba sin crear

                try:
                    new_area_basimetrica = model.add_tree(operation.get_variable('time'), new_plot);
                except Exception as e:
                    Tools.print_log_line(str(e), logging.ERROR)

                if new_area_basimetrica > 0:  # si no se añade masa, se omite este paso

                    try:
                        distribution = model.new_tree_distribution(operation.get_variable('time'), new_plot, new_area_basimetrica)

                    except Exception as e:
                        Tools.print_log_line(str(e), logging.ERROR)


                    order_criteria = OrderCriteria()
                    order_criteria.add_criteria('dbh')  # cambio add_variable por add_criteria

                    tree_to_add: Tree = Tree.get_sord_and_order_tree_list(result_pies_mayores, order_criteria=order_criteria)

                    sum_g = 0  # esta variable recoge el sumatorio de secciones normales de la parcela, para usar el valor en los cálculos posteriores
                    for tree in tree_to_add:
                        sum_g += tree.basal_area  # * tree.expan  -->  no se multiplica por tree.expan 

                    if distribution == None:  # si no existe una función de distribución

                        # n_trees = len(tree_to_add)  # calculamos el nº de árboles de la parcela  -->  ahora ya no hace falta, pero lo dejo de momento

                        for tree in tree_to_add:  # para los árboles que quiero añadir (todos los de la parcela serán modificados, en principio)
                            # voy a añadir una parte proporcional a cada uno; duplico la lista de árboles para que en el output se añada la masa y además se pueda
                            # mostrar que expan se ha añadido a cada árbol, tal cual se hace con los árboles muertos

                            new_d_tree = Tree()  # estos árboles serán los que se muestran sin status y pasan a la siguiente ejecución
                            new_d_tree.clone(tree)
                            new_d_tree.add_value('expan', (new_area_basimetrica*10000) / sum_g + new_d_tree.expan)  ### hay que revisar este cálculo

                            new_tree_add = Tree()  # estos árboles serán los que se muestran con status = I
                            new_tree_add.clone(tree)
                            new_tree_add.add_value('status', 'I')  # habría que conseguir que estos árboles aparecieran pintados en el output
                            new_tree_add.add_value('expan', (new_area_basimetrica*10000) / sum_g)  ### hay que revisar este cálculo

                            result_pies_mayores.append(new_d_tree)  # añado los árboles con EXPAN modificado a la lista
                            add_pies_mayores.append(new_tree_add)  # añado los árboles con status = I a una nueva lista



                    # para los modelos en los que sí hay unas condiciones establecidas en new_tree_distribution, entonces se aplica lo siguiente

                    else:  # si existe una función de distribución definida por el usuario

                        # var = 0  # acumulador del nº de árboles de cada CD  -->  ya no es necesario, lo silencio de momento
                        sum_g = 0  # acumulador del sumatorio de secciones normales para cada CD
                        count = 0  # contador para entrar en la posición de la lista que deseamos

                        for tree in tree_to_add:  # con este bucle añado el nº de árboles que hay para cada CD puesta por el usuario                     
                            
                            for k in distribution:  # para cada CD puesta por el usuario

                                if tree.dbh >= distribution[count][0] and tree.dbh < distribution[count][1]:  # si se cumplen los límites de diámetro

                                    # var += 1  # añadimos 1 al nº de árboles que cumplen la condición 
                                    sum_g += tree.basal_area  # * tree.expan  -->  no se multiplica por tree.expan                             
                                    break  # pasamos al siguiente árbol

                                else:  # si se deja de cumplir la condición de diámetro (los árboles están ordenados por dbh, de menor a mayor)

                                    # distribution[count].append(var)  # añadimos el nº de árboles a la lista
                                    distribution[count].append(sum_g)  # añadimos la suma de secciones normales por CD a la lista
                                    count += 1  # avanzamos una posición en la lista
                                    # var = 0  # comenzamos la cuenta desde 0
                                    sum_g = 0  # comenzamos la cuenta desde 0

                        # distribution[count].append(var)  # esto es necesario para añadir el valor a la última CD
                        distribution[count].append(sum_g)  # esto es necesario para añadir el valor a la última CD

                        for tree in tree_to_add:
                        # aquí se repartirá el valor del área basimétrica en las distintas clases diamétricas (propuestas en el modelo), de manera equitativa para cada árbol

                            for k in distribution:  # para cada CD

                                if tree.dbh >= k[0] and tree.dbh < k[1]:  # si se cumplen los límites de diámetro (ordenados de menor a mayor)

                                    new_d_tree = Tree()  # estos árboles serán los que se muestran sin status y pasan a la siguiente ejecución
                                    new_d_tree.clone(tree)
                                    new_d_tree.add_value('expan', (k[2]*10000) / k[3] + new_d_tree.expan)  # añadimos la parte proporcional del expan a cada árbol
                                    # OJO! Si hubiera que meter de nuevo el nº de pies en cada CD, entonces las posiciones de las listas variarían!
                                    new_tree_add = Tree()  # estos árboles serán los que se muestran con status = I
                                    new_tree_add.clone(tree)
                                    new_tree_add.add_value('status', 'I')  # habría que conseguir que estos árboles aparecieran pintados en el output
                                    new_tree_add.add_value('expan', (k[2]*10000) / k[3])  # añadimos la parte proporcional del expan a cada árbol

                                    result_pies_mayores.append(new_d_tree)  # añado los árboles con EXPAN modificado a la lista
                                    add_pies_mayores.append(new_tree_add)  # añado los árboles con status = I a una nueva lista
                                    
                                    break  # salto al árbol siguiente
                                                

                result_pies_mayores.extend(cut_pies_mayores)  # se añaden los pies cortados
                result_pies_mayores.extend(dead_pies_mayores)  # se añaden los pies muertos
                result_pies_mayores.extend(add_pies_mayores)  # añado árboles con status = I
                
                new_plot.add_trees(result_pies_mayores)
                # new_plot.recalculate()  --> Spiros

                try:
                    model.process_plot(operation.get_variable('time'), new_plot, result_pies_mayores)
                except Exception as e:
                    Tools.print_log_line(str(e), logging.ERROR)

                new_plot.recalculate()

                result_inventory.add_plot(new_plot)

            else:
                Tools.print_log_line('Plot ' + str(plot.id) + ' was not added', logging.INFO)

        return result_inventory
    def crown(self, tree: Tree, plot: Plot, func):
        """
        Function to calculate crown variables for each tree.
        That function is run by initialize and process_plot functions.
        Crown equations:
            Doc.: Lizarralde I, Ordóñez C, Bravo F (2004). Desarrollo de ecuaciones de copa para" Pinus pinaster" Ait. en el Sistema Ibérico meridional. Cuadernos de la Sociedad Española de Ciencias Forestales, (18), 173-177
            Ref.: Lizarralde et al. 2004
        """

        if func == 'initialize':  # if that function is called from initilize, first we must check if that variables are available on the initial inventory
            if tree.hlcw == 0:  # if the tree hasn't height maximum crown-width (m) value, it is calculated
                tree.add_value(
                    'hlcw', tree.height / (1 + math.exp(
                        float(-0.0041 * tree.height * 10 - 0.0093 * tree.bal -
                              0.0123 * plot.basal_area))))
            if tree.hcb == 0:  # if the tree hasn't basal crown height (m) value, it is calculated
                tree.add_value(
                    'hcb', tree.hlcw / (1 + math.exp(
                        float(0.0078 * plot.basal_area - 0.5488 *
                              math.log(plot.basal_area) - 0.0085 * tree.bal))))
        else:
            tree.add_value(
                'hlcw', tree.height / (1 + math.exp(
                    float(-0.0041 * tree.height * 10 - 0.0093 * tree.bal -
                          0.0123 * plot.basal_area))))
            tree.add_value(
                'hcb', tree.hlcw / (1 + math.exp(
                    float(0.0078 * plot.basal_area - 0.5488 *
                          math.log(plot.basal_area) - 0.0085 * tree.bal))))

        tree.add_value('cr', 1 -
                       tree.hcb / tree.height)  # crown ratio calculation (%)
        tree.add_value('lcw', (1 / 10.0) * (0.1826 * tree.dbh * 10) *
                       math.pow(tree.cr, (0.1594 + 0.0014 *
                                          (tree.height - tree.hcb) * 10))
                       )  # maximum crown-width (m) calculation
Exemple #23
0
    def biomass(self, tree: Tree):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Biomass equations:
            Doc.: Balboa-Murias MA, Rojo A, Álvarez JG, Merino A (2006). Carbon and nutrient stocks in mature Quercus robur L. stands in NW Spain. Annals of forest science, 63(5), 557-565
            Ref.: Balboa-Murias et al, 2006
            Doc.: Diéguez-Aranda U, Rojo A, Castedo-Dorado F, et al (2009). Herramientas selvícolas para la gestión forestal sostenible en Galicia. Forestry, 82, 1-16
            Ref.: Diéguez-Aranda et al, 2009
        """

        wsw = -5.714 + 0.01823 * (tree.dbh**2) * tree.height
        wsb = -1.500 + 0.03154 * (tree.dbh**2) + 0.001110 * (tree.dbh**
                                                             2) * tree.height
        wthickb = 3.427e-9 * (((tree.dbh**2) * tree.height)**2.310)
        wb2_7 = 4.268 + 0.003410 * (tree.dbh**2) * tree.height
        wthinb = 0.03851 * (tree.dbh**1.784) + 1.379
        wb05 = 0.00024 * (tree.dbh**2) * tree.height
        wl = 0.01985 * (((tree.dbh**2) * tree.height)**0.7375)
        wr = 0.01160 * ((tree.dbh**2) * tree.height)**0.9625
        wt = wsw + wsb + wb2_7 + wthickb + wthinb + wb05 + wl + wr

        tree.add_value('wsw', wsw)  # wsw = stem wood (Kg)
        tree.add_value('wsb', wsb)  # wsb = stem bark (Kg)
        # tree.add_value('w_cork', w_cork)   # w_cork = fresh cork biomass (Kg)
        tree.add_value('wthickb',
                       wthickb)  # wthickb = Thick branches > 7 cm (Kg)
        # tree.add_value('wstb', wstb)  # wstb = wsw + wthickb, stem + branches >7 cm (Kg)
        tree.add_value('wb2_7', wb2_7)  # wb2_7 = branches (2-7 cm) (Kg)
        # tree.add_value('wb2_t', wb2_t)  # wb2_t = wb2_7 + wthickb; branches >2 cm (Kg)
        tree.add_value('wthinb',
                       wthinb)  # wthinb = Thin branches (2-0.5 cm) (Kg)
        tree.add_value('wb05',
                       wb05)  # wb05 = thinniest branches (<0.5 cm) (Kg)
        tree.add_value('wl', wl)  # wl = leaves (Kg)
        # tree.add_value('wtbl', wtbl)  # wtbl = wthinb + wl; branches <2 cm and leaves (Kg)
        # tree.add_value('wbl0_7', wbl0_7)  # wbl0_7 = wb2_7 + wthinb + wl; branches <7 cm and leaves (Kg)
        tree.add_value('wr', wr)  # wr = roots (Kg)
        tree.add_value('wt', wt)  # wt = biomasa total (Kg)
    def biomass(self, tree: Tree):
        """
        Function to calculate volume variables for each tree.
        That function is run by initialize and process_plot functions.
        Biomass equations:
            Doc.: Ruiz-Peinado R, Montero G, del Río M (2012). Biomass models to estimate carbon stocks for hardwood tree species. Forest systems, 21(1), 42-52
            Ref.: Ruiz-Peinado et al, 2012
        Cork biomass equation:
            Doc.: Ribeiro F, Tomé M (2002). Cork weight prediction at tree level. Forest ecology and management, 171(3), 231-241
            Ref.: Ribeiro and Tomé (2002)
            Doc.: Montero G, López E (2008). Selvicultura de Quercus suber L. En: Compendio de Selvicultura Aplicada en España, Fundación Conde del Valle de Salazar. Madrid, Spain. pp, 779-829
            Ref.: Montero and López (2008)
        """

        wsw = 0.00525*(tree.dbh**2)*tree.height + 0.278*tree.dbh*tree.height
        wthickb = 0.0135*(tree.dbh**2)*tree.height
        wb2_7 = 0.127*tree.dbh*tree.height
        wtbl = 0.0463*tree.dbh*tree.height
        wr = 0.0829*(tree.dbh**2)
        wt = wsw + wb2_7 + wthickb + wtbl + wr

        tree.add_value('wsw', wsw)  # wsw = stem wood (Kg)
        # tree.add_value('wsb', wsb)  # wsb = stem bark (Kg)
        # tree.add_value('w_cork', w_cork)   # w_cork = fresh cork biomass (Kg)
        tree.add_value('wthickb', wthickb)  # wthickb = Thick branches > 7 cm (Kg)
        # tree.add_value('wstb', wstb)  # wstb = wsw + wthickb, stem + branches >7 cm (Kg)
        tree.add_value('wb2_7', wb2_7)  # wb2_7 = branches (2-7 cm) (Kg)
        # tree.add_value('wb2_t', wb2_t)  # wb2_t = wb2_7 + wthickb; branches >2 cm (Kg)
        # tree.add_value('wthinb', wthinb)  # wthinb = Thin branches (2-0.5 cm) (Kg)
        # tree.add_value('wb05', wb05)  # wb05 = thinniest branches (<0.5 cm) (Kg)
        # tree.add_value('wl', wl)  # wl = leaves (Kg)
        tree.add_value('wtbl', wtbl)  # wtbl = wthinb + wl; branches <2 cm and leaves (Kg)
        # tree.add_value('wbl0_7', wbl0_7)  # wbl0_7 = wb2_7 + wthinb + wl; branches <7 cm and leaves (Kg)
        tree.add_value('wr', wr)  # wr = roots (Kg)
        tree.add_value('wt', wt)  # wt = biomasa total (Kg)

        if isinstance(tree.h_uncork, float) and isinstance(tree.dbh_oc, float) and isinstance(tree.nb, float):

            pbhoc = (tree.dbh_oc*math.pi) / 100  # perimeter at breast height outside cork (m)
            pbhic = tree.normal_circumference / 100  # perimeter at breast height inside cork (m)
            shs = tree.h_uncork  # stripped height in the stem (m)
            nb = tree.nb + 1  # number of stripped main bough + 1

            if tree.cork_cycle == 0:  # To use inmediately before the stripping process
                if nb == 1:
                    tree.add_value('w_cork', math.exp(2.3665 + 2.2722*math.log(pbhoc) + 0.4473*math.log(shs)))
                else:
                    tree.add_value('w_cork', math.exp(2.1578 + 1.5817*math.log(pbhoc) + 0.5062*math.log(nb) + 0.6680*math.log(shs)))
            
            elif tree.cork_cycle == 1:  # To use after the stripping process or in a intermediate age of the cork cycle production
                if nb == 1:
                    tree.add_value('w_cork', math.exp(2.7506 + 1.9174*math.log(pbhic) + 0.4682*math.log(shs)))
                else:
                    tree.add_value('w_cork', math.exp(2.2137 + 0.9588*math.log(shs) + 0.6546*math.log(nb)))

        elif isinstance(tree.h_uncork, float) and isinstance(tree.dbh_oc, float) and not isinstance(tree.nb, float):

            pbhoc = (tree.dbh_oc*math.pi) / 100  # perimeter at breast height outside cork (m)
            pbhic = tree.normal_circumference / 100  # perimeter at breast height inside cork (m)
            shs = tree.h_uncork  # stripped height in the stem (m)
            nb = 1  # number of stripped main bough + 1

            if tree.cork_cycle == 0:  # To use inmediately before the stripping process
                tree.add_value('w_cork', math.exp(2.3665 + 2.2722*math.log(pbhoc) + 0.4473*math.log(shs)))
            
            elif tree.cork_cycle == 1:  # To use after the stripping process or in a intermediate age of the cork cycle production
                tree.add_value('w_cork', math.exp(2.7506 + 1.9174*math.log(pbhic) + 0.4682*math.log(shs)))
        else:
            
            tree.add_value('w_cork', 0)