GenVeg: Modeling Vegetation Dynamics with Landlab

Efforts to incorporate a generalized vegetation model in LandLab

Problem:

Many projects such as ecosystem restoration, nature-based solutions, and beneficial use of dredged sediment require an understanding of vegetation ecology to function. The environment is dynamic and requires integrated understanding of ecological processes.  Modeling vegetation models have a few challenges including: range in spatial and temporal scale, most previous work is situation specific, and the need to include climate change and non-climate stressors to produce useful predictions. The scale of the model depends on the intended purpose, which can range from structural-functional plant models to species distribution models. Most of the models developed are done ad hoc and there are currently no generalized models available for vegetation assessment/prediction. Many models are simplified and often data-driven statistical or analytical models that can only be applied to the conditions under which the data were collected. Models being made for a specific purpose and using specific data conditions mean that there is difficulty in utilizing previous work for new applications.  Adding climate change to models also increases the difficulty in developing a model.  

Solution:

GenVeg was developed as a generalized vegetation model that combines an individual-based model design with a grid-based model component to describe vegetation dynamics within and between grid cells. GenVeg utilizes a hybrid approach combining individual based and system dynamics modeling approaches. The landscape has individual plants in the continual space and plant metrics of the plants are aggregated at the grid scale.

Technical Approach:

Landlab is an open-source python-language package for numerical modeling of Earth surface dynamics. It was designed to quantify Earth surface dynamics such as geomorphology, hydrology, glaciology, and stratigraphy. Typically, when these models are made scientists often build their own unique model from the ground up and must code the basic building blocks (such as grid systems, physical processes, file inputs/outputs, and visualizations) of their landscape. Landlab provides standardized components that can be reused and this saves time.

Landlab provides a gridding engine which represents the model’s domain with a variety of grid styles, such as the raster grid, Voronoi cells with Delaunay triangulated nodes, and the hexagonal grid (see Figure 1).  Also provided in Landlab is a library of components that represent a physical process, have a common interface and can be combined based on the user’s needs. Landlab supports general numerical methods, file input/output, and visualization. All of these are the basic building blocks that make it easier to start modeling.

Figure 1: Geometry and topology of grid elements on various Landlab grids. This is figure 3 in Hobely et al., 2017 Earth Surface Dynamics

For more information on Landlab go to https://landlab.readthedocs.io/en/latest/index.html# and read Hobely et al., 2017 Earth Surface Dynamics.

GenVeg with Landlab:

GenVeg utilizes all the building blocks of Landlab and has three main classes:

  • GenVeg: the main class called by Landlab
  • Species: a class that has various properties such as parameters for morphology, duration, growth, dispersal, and mortality as well as a method that follows vegetation life cycle such as photosynthesize, respire, etc.
  • PlantGrowth: a class that has properties of each individual plant such as ID, Location, Biomass, age, etc. and methods for growth or utilities (e.g. update, save)

The GenVeg class interacts with the Landlab classes as well with the Species and PlantGrowth classes. This allows our model to utilize all of the capabilities of Landlab. GenVeg works by following these steps:

  1. User assigns all the needed parameters in an excel sheet.
  2. GenVeg will then read in the excel sheet and convert it to the proper format then initialize the grid.
  3. The grid will then be able to interact with Landlab components (such as soil moisture) and GenVeg components (such as plant photosynthesize, respire grown, disperse, and die).
  4. The Landlab system updates one time step at a time to utilize the components created for the model.
  5. The grid then will update and continue to feed back to Landlab/GenVeg components. Figure 2 shows the flow that GenVeg takes.

Figure 2: The Flow of GenVeg

Existing Landlab utilities/components enable graphical outputs and tabular display. Examples of the output can be seen in figure 3.

Figure 3: Example of GenVeg output

Process to incorporate into the developer version of Landlab:

Landlab encourages scientists/developers to add to their component library and utilities using Github. They have a guide (https://landlab.readthedocs.io/en/latest/development/index.html) that provides instructions on how to create your own fork and be able to develop code that can eventually be merged into the main Landlab repository. Our team is currently working on getting our branch up to the standard that Landlab requires for their pull request. The tasks that we are working on can be categorized into 4 categories:

  1. Complete base model
  2. Unit testing
  3. In-code documentation
  4. Following the code style

Efforts in categories 2 – 4 will be discussed below:

Unit Testing:

All the contributing code should have standard unit tests using pytests. The idea is to give the code a thorough testing. Ideally the tests should cover each if, elif, else, and every try or except block. There will also be tests to verify if a bad parameter is passed, ensuring that the correct type of error is being raised. This is done so each component or utility that is created is doing exactly what it is expected to do.

In this effort we are:

  • working on creating a small model grid and hand calculating what the correct answer is
  • testing that the model can handle inputs that it is given or produce the correct error message
  • thoroughly testing methods for growth, respiration, photosynthesis, emergence, dispersal, and mortality

In-code documentation:

All public functions, classes, methods, etc. must have a docstring that follows the numpydoc conventions. This will allow developers and scientists to easily understand what each part of the code does and make it easier to develop. Our team is striving to add comments and follow the numpydoc conventions

Following the code style:

Landlab uses coding style described by PEP8 as it is one of the standard worldwide stylistic conventions for coding in Python. Our team currently develops our code using visual studio code’s text editor and will highlight where the code is outside the standard. Landlab will check for all flake8 violations and pycodestyle violation when pushing changes to the git. They also suggest using isort + black to help meeting the styles.

Future work:

Our team is currently working to meet the standards to be able to allow GenVeg to be pulled into the Landlab repository. Once we have met this hefty goal we plan to incorporate new capabilities such as:

  • being able to set annual events to be temperature and light-mediated
  • (Evapo) Transpiration feedback to growth
  • Nutrient feedback to growth
  • Application to riverine systems

We also strive to add optional management decision making considerations such as:

  • Define management action typologies
  • Create a GenVeg management library
  • Demonstrate management actions

Top