Tiler Configuration#
The spatial layers need to be converted to a data format that the GCBM can use to run a simulation, and this conversion is done by the tiler. The tiler scripts use a mojadata python package to convert spatial data to the FLINT format.
In our project, the tiler script can be located in this path
GCBM software and training components\Sample_Data_Exercise\tools\Tiler\tiler.py
.
To configure the tiler, we open the tiler script in any code editor of our choice.
Update the bounding box Next, we update the bounding box. The bounding box defines the study area of the plant simulation, and other spatial layers are cropped and reprojected to the area specified in the bounding box.
The bounding box in the code block above receives three parameters:
A path that points to the inventory shape layer, in this case,
inventory.shp
An Attribute parameter, in this case,
PolyID
. This attribute is a chosen file that defines a simulation area that represents all of the polygons in the landscapeThe
pixel_size
parameter defines the resolution at which the simulation should run
Replace the bounding box with the code block below.
bbox = BoundingBox(
VectorLayer(
"bbox",
os.path.join(layer_root, "inventory", "inv_sample.shp"),
Attribute("Age")),
pixel_size=0.01)
tiler = GdalTiler2D(bbox, use_bounding_box_resolution=True)
Configure the Classifier layers After updating the bounding box, we configure the classifier layers. The classifier layers link spatial data to the yield table.
The classifier layers are shown in the image below.
Replace the classifier layers with this code block below.
classifier_layers = [
VectorLayer("LdSpp", os.path.join(layer_root, "inventory", "inv_sample.shp"), Attribute("LdSpp"), tags=[classifier_tag]),
]
In the images above, we do the following:
Delete one classifier layer
Change the name of the first classifier layer from
Classifier1
toLdSpp
. We must keep this classifier name consistent, as we will use it to generate an input database later in this tutorialChange the path to the inventory shape layer
Configure the age layer Next, we update the age layer. We can see the age layer in the image below.
We replace the age layer with this piece of code.
# Age - layer name must be "initial_age" so that the script can update the GCBM configuration file.
VectorLayer("initial_age", os.path.join(layer_root, "inventory", "inv_sample.shp"), Attribute("Age"),
data_type=gdal.GDT_Int16, raw=True),
Configure the mean annual temperature Next, we configure the mean annual temperature vector layer.
The vector layer is replaced by this raster layer.
RasterLayer(os.path.join(layer_root, "environment", "NAmerica_MAT_1971_2000.tif"),
name= "mean_annual_temperature"),
We use the NAmerica_MAT_1971_2000.tif
raster mean annual
temperature layer in the code block above. The
NAmerica_MAT_1971_2000.tif
layer is in the
layers\raw\Environment\NAmerica_MAT_1971_2000.tif
directory.
Disturbance events Disturbances significantly change the forest dynamic; however, the initial test run will be without any disturbances. To simulate without disturbances, delete the disturbance layer.
After we are done with this section, here is how our tiler.py
file
looks
Clean up Tiler script whitespace After configuring our tiler scripts, we clean up tabs and spaces using the Notepad++ editor. We clean up these spaces because Python is sensitive to whitespace and can throw an error.
Run the Tiler After cleaning up the tiler script, we run the
process_spatial_layers.bat
file. This process_spatial_layers.bat
is in the Sample_Data_Exercise\layers
directory.
When the tiler script is done, the Sample_Data_Exercise\layers\tiled
directory should contain these files.
A
.tiff
file of the final cropped and reprojected version of each layerA JSON file for each
.tiff
file containing metadata and attribute table, if applicableA
study_area.json
file containing metadata about the tiled layers
Tabular data preparation(jupyter notebook)#
Things to add:
info about the Chapman-Richards growth function
how curve_fit function from scipy works
note on trying different initial guesses for parameters(can explain during the next call)
mention the importance of data visualization, European Beech is an example
note about species: Have to check if related species are in **documentation:raw-latex:species_names.csv**. ## Input database generation(Recliner2GCBM)
Next, we need to generate the project input database. To create the input database, we need the following:
A CBM3 ArchiveIndex Database (AIDB). The ArchiveIndex Database is a database that contains non-spatial and spatially referenced parameters. These parameters include but are not limited to decay rates, disturbance matrices, root biomass coefficients etc.
A yield table in
.csv
or.xls
/.xlsx
format
Configure Project To start building the input database, we run the
input_database\run_recliner2gcbm_gui.bat
file. Running the
run_recliner2gcbm_gui.bat
file opens a Configure Project window.
To configure a project, we do the following:
Populate the AIDB Path input field with a link to the
ArchiveIndex_Beta_Install.mdb
file. TheArchiveIndex_Beta_Install.mdb
file is located in theinput_database
directoryAdd a link to the
gcbm_input.db
file in the Path input field. Thegcbm_input.db
file is located in theinput_database
directory. Thegcbm_input.db
is the database that will be generated at the end of the process.Click yes, when the prompt asks you to replace the existing version of the file
Add Classifier After configuring our project, we add our classifiers layers.
Clicking on the Add button opens up a window.
The window prompts us to do the following:
Input the
LdSpp
classifier name. The classifier name must be the same in ourtiler.py
fileLink to the
yield_curves.csv
path in the Path input field. Theyield_curves.csv
file is in theinput_database
directoryClick the Column select button and click the A column. Clicking the A column specifies which column has the
LdSpp
classifier values
Click the Ok button.
After adding our classifier layers, we click the Next button.
Configure Growth Curves After configuring the classifiers, the next step is configuring the yield curves. In this step, we add a set of age and volume data to describe the tree growth.
To configure the growth curves, we do the following:
Add the path to the
yield_curves.csv
file in the File input field. Thisyield_curves.csv
file contains the yield curve data for the classifier we just setupClick on the
LdSpp
Classifier Column Select button and click a row in column A. Clicking a row in column A specifies what column theLdSpp
classifier maps toChange the Growth curve interval to 10, and click the Age10 data header. The Growth curve interval is the number of years between volume increments for all the curves in the
yield_curves.csv
fileIdentify which columns represent the species, forest type or the archive index tree species column. Click the Species select button and click column B. Clicking column B changes the Species input field to 1
Identify what columns represent the start and the end of the volume increments. To specify the start column, we click on the first Increments “…” button and click anywhere in the C column. To specify the end column, we click the second Increments “…” button and click anywhere in the last increment column to the right. Mapping these columns will give the Increments input field a value of 2 and 32, respectively
Click the Next button to continue
Optional data After configuring the growth curves, we see the transition rules screen. Transition rules ****describe what happens after specific stand types are disturbed by specific disturbance events. This documentation will not cover transition rules as they are optional. Click on the Next button to continue.
After the Transition Rules screen, the ****following screen ****is the Configure Disturbance Categories screen. The Configure Disturbance Categories screen is an optional advanced GCBM module component that will not be covered in this documentation. Click on the Next button to continue.
Save Recliner2GCBM configuration After configuring the data to create an input database, we need to save it. In this section, we do the following:
Check the previous steps for errors
Save the data in the
input_database
directory using the Save configuration button. By default, the data is saved in arecliner2gcbm_config.json
fileClick the Load button to generate the input database, wait for a few minutes and then click Done
Configure start/end date Next, we configure the simulation start and
end date in the run_all.bat
file. We open the run_all.bat
file
in a text editor of our choice. Next, we change the
SIMULATION_START_YEAR
variable to 1990 and the
SIMULATION_END_YEAR
variable to 2000.
set SIMULATION_START_YEAR= 1990
set SIMULATION_END_YEAR= 2000
GCBM run and result visualization#
After configuring the GCBM, we run the simulation by clicking on the
run_all.bat
file. We see the processed output in the
processed_output
folder.