Tanveen Kaur Randhawa and Vishwesha Guttal, 2024, Higher individual variation in savanna trees may reduce bistability in favour of woodlands, Manuscript in Submitted.
This repository contains codes used for the manuscript citation above. More specifically, codes simulate our extension of the savanna-woodland model given by Staver & Levin, 2011, to include trait variations. We investigate how trait variations affect the dyanmics of this bistable system. The codes are part of the manuscript: "Higher individual variation in savanna trees may reduce bistability in favour of woodlands".
The repository contains two folders:
- simulations which contains python code to numerically simulate the model.
- figures which contains R code to plot the data obtained from running simulations using the codes in simulations folder.
Packages required for each of the codes are mentioned in the files.
To simulate the savanna-woodland model with no variation, use the file GST_no_var.py in the simulations folder. This file can be run through the Terminal or using an IDE. To run the file through the terminal, follow these steps:
- Download the file to your system.
- Go to the folder containing this file and open terminal in that folder OR Open terminal, type
cd /location-of-the-file/
. - Type
python GST_no_var.py
in the terminal and press Enter.
This would generate two .csv files with the steady-state grass cover and tree cover, respectively. Check the section Figure 2: Bifurcation Diagram for instructions on how to plot the bifurcation diagram for this case.
To understand the affect of trait variations on the ecosystem-level dynamics of the savanna-woodland model, we use the file all_dist_trait.py in the simulations folder. In this file, one can select
- the trait to be varied: sapling death rate ("u", as referred to in the code), tree death rate ("v") or sapling resistance to fire ("th"),
- initial distribution of traits: uniform ("unif", as referred to in the code), unimodal beta ("beta") or bimodal beta distribution ("bimod"), and
- the level of variation in the trait: "high" or "low".
After downloading the all_dist_trait.py file, it can either be run directly through the terminal or using an IDE. To run the file directly through the terminal, go to the folder containing the python script, open the terminal and type:
python all_dist_trait.py -t (insert trait here) -d (insert distribution here) -v (insert level of variation here)
For example, you want to run the code for variation in sapling death rate (u), which has a bimodal distribution and high level of variation, the command will be:
python all_dist_trait.py -t u -d bimod -v high
To run the file in an IDE (such as Spyder), comment out Code Segment 1, as mentioned in the code, and uncomment Code Segment 2 to set the parameters of your choice.
This python script runs the model with variation in the specified trait for different values of sapling birth rate (denoted by "b") and different initial values of Grass cover. This generates two .csv files with the steady-state grass cover and tree cover, respectively.
To generate Figure 2 mentioned in the manuscript, we plot the data in these .csv files: specifically the files with high, low and no variation in the trait of interest while keeping other traits constant. We use the R script file Figure2.R present in the figures folder. This yields a stability/bifurcation diagram, with either the steady-state Grass cover or Tree cover on the y-axis and sapling birth rate on the x-axis. To obtain the figure, open Rstudio. In RStudio, set the working directory as the folder containing all these .csv files and run the code.
To look at the population-level trait distribution at steady state, use indi_prop_all_dist_trait.py in the simulations folder. Similar to all_dist_trait.py, users can set the varying trait, initial trait distribution and the level of variation in this file. For a specific value of sapling birth rate (b), this file generates two .csv files with steady state Tree and Sapling cover respectively corresponding to each trait value present in the population. For instance, the varying trait is sapling death rate and the level of variation is high, the python script will give the tree (and sapling) cover of the 10 tree (and sapling) types with trait value: 0.05, 0.15,..., 0.95.
Plot the data in these .csv files to obtain the population-level trait distribution at steady state using Figure3.R. This generate Figure 3 mentioned in the manuscript.
To see how grass, tree and sapling covers change with time for different initial conditions (i.e., different initial values of G,S and T), sapling birth rate (b), varying trait, trait distribution and level of variation, use the python script TimeSeries_all_dist_trait.py in the simulations folder.
Plot the data in the .csv file obtained from TimeSeries_all_dist_trait.py using the R script Figure4.R in the figures folder. This generates Figure 4 mentioned in the manuscript.
Tanveen Kaur Randhawa and Vishwesha Guttal, 2024, Higher individual variation in savanna trees may reduce bistability in favour of woodlands, Manuscript in Submitted.