Assortments
Warning
This library is under development, none of the presented solutions are available for download.
Obtain the products generated by the forest inventory based on a product table. Use fitted taper functions to estimate commercial and non-commercial volume generated by the forest. Estimate volumes using fitted volumetric equations.
Class Parameters
Assortments(df, assortments_priority=None)
Parameters | Description |
---|---|
df | The dataframe containing the assortments data. |
assortments_priority | (Optional) The name of the column who defines the assortments priority. If None , uses the default order from the dataframe. |
Example of assortments table
Product | Length min (m) | Length max (m) | D min (cm) | Loss (cm) | Priority |
---|---|---|---|---|---|
Prod. 1 | 10 | 10 | 12 | 0.5 | 1 |
Prod. 2 | 2 | 2 | 8 | 0.5 | 2 |
Prod. 3 | 1 | 1.5 | 2 | 0.5 | 3 |
*The column order must be followed.
Class Functions
Assortments.get_assortments(model, model_path, trees_df, tree_dbh, tree_height,
stump=0.1, initial_height=None) #(1)
Assortments.get_taper_volumes(model, model_path, trees_df, tree_dbh,
tree_height, bark_factor=None, stump=0.1) #(2)
Assortments.get_volumes(model, model_path, trees_df, tree_dbh,
tree_height, bark_factor=None) #(3)
-
model = The name of the taper function or 'ann' to be used to calculate the assortments.
model_path = Path to the.json
file containing the coefficients of the fitted models or the.pkl
file containing the fitted artificial neural network.
trees_df = Pandas DataFrame containing the inventory for which the assortments should be calculated.
tree_dbh = The name of the column containing the diameter at breast height (DBH) values in centimeters.
tree_height = The name of the column containing the total height values of the trees in meters.
stump = (Optional) Stump height value (meters) to be considered in the assortment calculation. Ifstump==None
, it defaults to0.1
.
initial_height = (Optional) Height (meters) at which the products begin to be generated. Useful for cases where the base of the tree was damaged by fire or used for resin extraction. -
model = The name of the taper function or taper 'ann' to be used to calculate the volume.
model_path = Path to the.json
file containing the coefficients of the fitted models or the.pkl
file containing the fitted artificial neural network.
trees_df = Pandas DataFrame containing the inventory for which the volumes should be calculated.
tree_dbh = The name of the column containing the diameter at breast height (DBH) values in centimeters.
tree_height = The name of the column containing the total height values of the trees in meters.
bark_factor = (Optional) Value of the bark factor to be used to calculate volumes without bark.
stump = (Optional) Stump height value (meters) to be considered in the volumes calculation. Ifstump==None
, it defaults to0.1
. -
model = The name of the volumetric function or volumetric 'ann' to be used to calculate the volume.
model_path = Path to the.json
file containing the coefficients of the fitted models or the.pkl
file containing the fitted artificial neural network.
trees_df = Pandas DataFrame containing the inventory for which the volumes should be calculated.
tree_dbh = The name of the column containing the diameter at breast height (DBH) values in centimeters.
tree_height = The name of the column containing the total height values of the trees in meters.
bark_factor = (Optional) Value of the bark factor to be used to calculate volumes without bark.
Parameters | Description |
---|---|
.get_assortments() | Returns the trees_df dataframe with additional columns indicating the number of products generated for each assortment, as well as the volume generated for each assortment in each tree. Calculates also the comercial volume, the total volume of the tree and also the wasted volume. |
.get_taper_volumes() | Returns the trees_df with the volumes calculated based on the integration of taper functions. It calculates the total volume with bark and without bark. |
.get_volumes() | Returns the trees_df with the volumes calculated based on the fitted volumetric functions. It calculates the total volume with bark and without bark. |
Example Usage
taper_functions_example.py | |
---|---|
1 2 |
|
- Import
Assortments
class. - Import
pandas
for data manipulation.
Create a variable for the Volumetrics Class
taper_functions_example.py | |
---|---|
3 4 5 6 7 8 9 10 11 12 13 14 |
|
- Load your assortments df from a csv file.
- Load your inventory df from a csv file.
- Create the variable
Prod
containing theAssortments
class and using theassortments_df
dataframe as products. - Calculate assortments for each tree in the
inventory_df
using thekozak
model, theDAP
column for DBH values and theHT
column for the tree height values. - Calculate volumes with integration of
bi
function for each tree in theinventory_df
using thebi
model, theDAP
column for DBH values and theHT
column for the tree height values. Also uses a bark factor of90%
. - Calculate volumes with volumetric function for each tree in the
inventory_df
using themeyer
model, theDAP
column for DBH values and theHT
column for the tree height values. Also uses a bark factor of85%
.