Tree Volume Planning
Warning
This library is under development, none of the presented solutions are available for download.
Use forest inventory data to plan the trees to be sampled for volume measurement, ensuring sufficient sampling of the plantation.
Class Parameters
TreeVolumePlanning(df, tree_dbh, tree_height)
Parameters | Description |
---|---|
df | The DataFrame containing the tree data. |
tree_dbh | The name of the column containing the diameter at breast height (DBH) values of the trees (centimeters). |
tree_height | The name of the column that contains the total heights of the trees (meters). |
Class Functions
TreeVolumePlanning.resume(n_classes=10, dbh_classes=None, height_classes=None,
only_height_classes=False, only_dbh_classes=False)#(1)!
TreeVolumePlanning.p_resume(n_classes=10, dbh_classes=None, height_classes=None,
only_height_classes=False, only_dbh_classes=False)#(2)!
TreeVolumePlanning.get_values(n_measured_trees=10, n_classes=10, dbh_classes=None, height_classes=None,
only_height_classes=False, only_dbh_classes=False)#(3)!
-
n_classes = Number of classes to which the values of height and diameter at breast height will be subjected.
dbh_classes = (Optional) Number of DBH classes to which the values of diameter at breast height will be subjected. IfNone
, usesn_classes
value.
height_classes = (Optional) Number of height classes to which the values of height will be subjected. IfNone
, usesn_classes
value.
only_height_classes = (Optional) IfTrue
, only height classes will be used for the summary.
only_dbh_classes = (Optional) only DBH classes will be used for the summary. -
n_classes = Number of classes to which the values of height and diameter at breast height will be subjected.
dbh_classes = (Optional) Number of DBH classes to which the values of diameter at breast height will be subjected. IfNone
, usesn_classes
value.
height_classes = (Optional) Number of height classes to which the values of height will be subjected. IfNone
, usesn_classes
value.
only_height_classes = (Optional) IfTrue
, only height classes will be used for the summary.
only_dbh_classes = (Optional) only DBH classes will be used for the summary. -
n_measured_trees = Number of trees that will be selected for volume measurement. The default is 10.
n_classes = Number of classes to which the values of height and diameter at breast height will be subjected.
dbh_classes = (Optional) Number of DBH classes to which the values of diameter at breast height will be subjected. IfNone
, usesn_classes
value.
height_classes = (Optional) Number of height classes to which the values of height will be subjected. IfNone
, usesn_classes
value.
only_height_classes = (Optional) IfTrue
, only height classes will be used for the summary.
only_dbh_classes = (Optional) only DBH classes will be used for the summary.
Methods | Description |
---|---|
.resume() | Returns a summary of how many trees from the provided dataframe are in each class. |
.p_resume() | Returns a summary of the percentage of trees from the provided dataframe in each class. |
.get_values() | Returns a dataframe indicating how many trees should be sampled for volume measurement in each class, based on the percentage representation of each class in the total inventory. |
Example Usage
Considering the data resulting from the hypsometric relationship established in the previous module, we will carry out the tree volume planning.
First 5 rows of the file:
Parcela | Dap (cm) | H (m) | Idade (anos) | best_predicted_height | selected_model |
---|---|---|---|---|---|
p-1 | 22,28 | 0 | 15 | 21,91910582 | y = y ~ x = 1/x^2 |
p-1 | 23,87 | 22,2 | 15 | 22,2 | Real Height |
p-1 | 25,46 | 0 | 15 | 23,30513332 | y = y ~ x = 1/x^2 |
p-1 | 25,78 | 24,5 | 15 | 24,5 | Real Height |
p-1 | 26,74 | 22,2 | 15 | 22,2 | Real Height |
taper_functions_example.py | |
---|---|
- Import
TreeVolumePlanning
class. - Import
pandas
for data manipulation.
Create a variable for the Volumetrics Class
taper_functions_example.py | |
---|---|
- Load your
.xlsx
file. - Create the variable
cub
containing theTreeVolumePlanning
class, using the columnDap (cm)
for DBH values and the columnbest_predicted_height
for height values. - Return a summary of how many trees from the provided dataframe are in each class (6 classes) and store it in the variable
resume
. - Return a summary of the percentage of trees from the provided dataframe in each class (6 classes) and store it in the variable
percentual_resume
. - Return a dataframe indicating how many trees should be sampled for volume measurement in each class, distributing the 50 trees (
n_measured_trees
) based on the percentage representation of each class in the total inventory, and store it in the variableto_measure
.
Outputs
Tables
resume
(1)
- DataFrame showing how many trees are in each of the 6 generated height and DBH classes.
DBH classes | H(21.904, 24.516] | H(24.516, 27.113] | H(27.113, 29.71] | H(29.71, 32.306] | H(32.306, 34.903] | H(34.903, 37.5] |
---|---|---|---|---|---|---|
(22.251, 27.108] | 9 | 2 | 0 | 3 | 2 | 0 |
(27.108, 31.937] | 3 | 13 | 4 | 4 | 1 | 0 |
(31.937, 36.765] | 0 | 14 | 8 | 13 | 2 | 0 |
(36.765, 41.593] | 0 | 5 | 9 | 21 | 1 | 0 |
(41.593, 46.422] | 0 | 2 | 2 | 6 | 3 | 1 |
(46.422, 51.25] | 0 | 0 | 3 | 0 | 2 | 2 |
percentual_resume
(1)
- DataFrame showing the percentage of trees in each of the 6 generated height and DBH classes relative to the total number of trees.
DBH classes | H(21.904, 24.516] | H(24.516, 27.113] | H(27.113, 29.71] | H(29.71, 32.306] | H(32.306, 34.903] | H(34.903, 37.5] |
---|---|---|---|---|---|---|
(22.251, 27.108] | 6,67 | 1,48 | 0,00 | 2,22 | 1,48 | 0,00 |
(27.108, 31.937] | 2,22 | 9,63 | 2,96 | 2,96 | 0,74 | 0,00 |
(31.937, 36.765] | 0,00 | 10,37 | 5,93 | 9,63 | 1,48 | 0,00 |
(36.765, 41.593] | 0,00 | 3,70 | 6,67 | 15,56 | 0,74 | 0,00 |
(41.593, 46.422] | 0,00 | 1,48 | 1,48 | 4,44 | 2,22 | 0,74 |
(46.422, 51.25] | 0,00 | 0,00 | 2,22 | 0,00 | 1,48 | 1,48 |
to_measure
(1)
- DataFrame showing how many trees (out of the 50 specified in
n_measured_trees
) should be measured in each of the 6 height and DBH classes.
DBH classes | H(21.904, 24.516] | H(24.516, 27.113] | H(27.113, 29.71] | H(29.71, 32.306] | H(32.306, 34.903] | H(34.903, 37.5] |
---|---|---|---|---|---|---|
(22.251, 27.108] | 3 | 1 | 0 | 1 | 1 | 0 |
(27.108, 31.937] | 1 | 5 | 2 | 1 | 0 | 0 |
(31.937, 36.765] | 0 | 5 | 3 | 5 | 1 | 0 |
(36.765, 41.593] | 0 | 2 | 3 | 8 | 0 | 0 |
(41.593, 46.422] | 0 | 1 | 1 | 2 | 1 | 0 |
(46.422, 51.25] | 0 | 0 | 1 | 0 | 1 | 1 |
Thus, the user obtains how many trees should be sampled for volume measurement in each DBH and height class.
About class intervals
The intervals use the following notation:
- (
means the value is not included
- ]
means the value is included
For example, the interval (22.251, 27.108]
includes values greater than 22.251 and less than or equal to 27.108.
It is not mandatory to create both height and DBH classes simultaneously — it is possible to create only height classes or only DBH classes, as shown in the example below:
to_measure = cub.get_values(n_measured_trees=50, dbh_classes=6,
only_dbh_classes=True)#(1)!
- Defines that 50 trees will be measured, divided into 6 DBH-only classes.
DBH classes | n_trees |
---|---|
(22.25, 27.108] | 6 |
(31.937, 36.765] | 14 |
(46.422, 51.25] | 3 |
(36.765, 41.593] | 13 |
(27.108, 31.937] | 9 |
(41.593, 46.422] | 5 |
It is also possible to create a different number of classes for height and DBH, as shown in the example below:
to_measure = cub.get_values(n_measured_trees=50, dbh_classes=6,
height_classes=2)#(1)!
- Defines that 50 trees will be measured, divided into 6 DBH classes and 2 height classes.
DBH classes | H(21.904, 29.71] | H(29.71, 37.5] |
---|---|---|
(22.251, 27.108] | 4 | 2 |
(27.108, 31.937] | 7 | 2 |
(31.937, 36.765] | 8 | 6 |
(36.765, 41.593] | 5 | 8 |
(41.593, 46.422] | 2 | 4 |
(46.422, 51.25] | 1 | 1 |