2.8. Probabilistic spatial models: forest fire and seed dispersal¶
2.8.1. Random variables in point models¶
2.8.1.1. Continuous random variables¶
PCRaster comes with a number of functions to draw realizations from continuous probability distributions.
Go to the folder /probab/fire in your exercises data set and open randomVar.py
To the dynamic, add a line that draws a realization using the function normal
Store the result. In a similar way, use uniform
and store the result. Animate the outputs.
Question: What is calculated by the function uniform
?
It draws realizations resulting in a uniform average value of 1.0.
It draws realizations from a uniform distribution between zero and one, independently for each cell and time step.
It draws a realization from a uniform distribution between zero and one, assigning it to all cells, independently for each time step.
Now, test the function mapuniform
by adding it to the dynamic section and storing results. Look it up in the PCRaster manual pages if you need to find what inputs it requires.
Question: In what situations would you use uniform
and in what situations would you use mapuniform
?
The function
uniform
is used when error at a cell is independent from other cells. The functionmapuniform
represents uncertainty of an error source that is fully correlated over the area, i.e. over the whole area the error causes the value to be too high or too low; withuniform
, the value would be too high or too low for each cell independently.The function
mapuniform
is used when error at a cell is independent from other cells. The functionuniform
represents uncertainty of an error source that is fully correlated over the area, i.e. over the whole area the error causes the value to be too high or too low; withmapuniform
, the value would be too high or too low for each cell independently.The function
uniform
is used when the error is larger than indicated by the measurement instrument, as it adds uncertainty caused by spatial variation. The functionmapuniform
is used when the measurement instrument exactly represents the error over the whole area.
Now, add a statement that draws realizations from a Gaussian distributed variable with mean a mean of 10 and standard deviation of 5.
Question: What is the range of the values in the realizations that you find if you run the model for all time steps?
The values are approximately between 5.0 and 10.0
The values are approximately between 0.0 and 20.0
The values are approximately between 5.0 and 15.0
The values are approximately between -15.0 and 35.0
2.8.1.2. Discrete random variables¶
Functions to draw realizations of discrete (classified) random variables are not provided. These can be derived from the functions for continuous random variables that you used in the previous section.
Open randomVar.py
and add (a) statement(s) to the script that draws realizations (for each cell independently and for each timestep) of a discrete random variable with two possible outcomes, True and False:
Write results to disk, run the script, and display to check the result.
Question: How could you create the discrete random variable?
By drawing realizations from a uniform distribution between 0.2 and 0.8, converting the result to a Boolean.
By drawing realizations from a uniform distribution between 0.2 and 0.8, selecting the values above 0.5.
By drawing realizations from a normal distribution with a mean of 0.5 and a standard deviation of 1.0, selecting values above 0.2.
By drawing realizations from a uniform distribution between 0.0 and 1.0, selecting values below 0.8.
Now, add statements that draw realizations of a discrete random variable with three possible outcomes, coded as 1, 2, and 3:
Question: How could you create the discrete random variable?
Using realizations from a uniform distribution, a table, and lookupnominal.
By multiplication of the outcome of the function
uniform
, three times.Using realizations from a uniform distribution, and the
maptotal
function, to select values.Using a window function.
2.8.2. Direct neighbourhood interaction: forest fire¶
2.8.2.1. Fire spreading¶
Direct neighbourhood functions (as used in cellular automata) are suitable for modelling forest fire. This is because the large scale spatio-temporal pattern of an evolving fire is driven by local interactions at the fire front. These local interactions will be represented here using a stochastic direct neighbourhood model. The model uses the following transition rules that are applied for each time step:
A cell that was burning at the previous time step stays burning.
Cells that are not burning at the previous time step potentially catch fire only when one or more neighbouring cells are burning at the previous time step. Neighbouring cells are the four direct neighbours in the x, y direction.
The cells under item 2 actually catch fire with a probability of 0.1.
A cell that was not burning at the previous time step and actually catched fire in the current timestep becomes a burning cell.
Display dem.map
and start.map
. The start.map
contains True cells representing the starting area of a fire. Open fire.py
. First add statements to represent rule 2.
Set the initial distribution of the fire (use the variable name
fire
) tostart.map
.In the dynamic, add a
window4total
statement that calculates the number of neighbours that are burning.In the dynamic, use the result of
window4total
to calculate a mapneighbourBurns
that is True when one or more neighbouring cells are burning.Write the resulting maps to disk, save the script, and run.
Animate neighbourBurns
. Do the cells with True also include cells that were already burning in the previous time step?
And finally for rule 2, add (a) statement(s) that calculate(s) potentialNewFire
, a map that is True only for cells that potentially catch fire. To calculate this map, you need to combine fire
and neighbourBurns
using Boolean logic operations. Write to disk and check the result.
Question: How did you calculate potentialNewFire
?
Using Boolean logic operations.
Using multiplication.
Using an additional
window4total
statement.Using an additional
window4total
statement andareaaverage
.
Now, let’s add rule 3.
Add the following statement to the dynamic calculating for each time step a map that is True with a probability of 0.1 and false elsewhere. Write the result to disk to check it.
realization = uniform(1) < 0.1
Add a statement that calculates
newFire
, a map that is True for cells that actually catch fire in the current time step.newFire
represents rule 3. Write to disk, run, and check the result.
And finally, update fire
by combining newFire
and fire
from the previous time step. Write to disk, store your model script, run it, and check the results.
Question: How does the fire evolve over time?
Due to the window shape of the window4total function it is covers an approximately rectangular block which increases in size over time, having a ragged edge due to the random process.
It covers a circle which increases in size, ragged at the edge due to the random process.
It covers a circle which increases in size, with a smooth edge.
Due to the window shape of the window4total function it is covers an approximately rectangular block which increases in size over time, having a smooth edge.
2.8.2.2. Fire spreading determined by the topography¶
In the previous exercise, we assumed a probability of a cell catching fire to be everywhere the same, i.e. 0.1. In reality, however, a fire front mainly extends uphill. A very simple representation of this process is used here. The transition rules are kept the same, except for the probability used in rule 2. Now we will calculate this probability as:
All cells with a direct neighbour in downhill direction have a probability to catch fire of 0.8.
For all other cells, this probability is 0.1.
Open the script fire.py
that was created in the previous exercise and save it as fireUphill.py
. In the initial, create the map ldd
using the digital elevation model dem.map
. You need self.ldd
as variable name as it will be used in the dynamic. Display the local drain direction map on top of the digital elevation model, zoom in if you get an almost black map!
In the dynamic, you need to add statements calculating for each map the probability for cells to catch fire. As a start, add two statements (insert them directly above the calculation of realization
:
A statement calculating
downhillBurning
, a map that is True for cells with a cell in downhill direction that is burning. Use the functiondownstream
.A statement calculating
probability
, a map with the probabilities that a cell catches fire. UsedownhillBurning
as input.
Let the model write the results of these two calculations to disk. Save and run the model to see the results.
Now, you need to change the calculation of realization
as it needs to take into account the spatial pattern (for each time step) of the probability
. Do this by changing the statement. Save and run the model. Animate the resulting fire pattern together with the local drain direction map and the digital elevation model.
- Question:
What is the pattern of the fire spreading over time? Do you think this is more realistic compared to the previous model? Give two suggestions to further improve the model.
Question: Have a look at the veg.map. At what time step does the fire reach the pine forest in the southern part of the area (approximately)?
At time step 50.
At time step 100.
At time step 150.
It does not reach the pine forest.
2.8.3. Neighbourhood interaction over a distance: plant seed dispersal¶
Plant dispersal occurs either as clonal growth or through seed dispersal. Clonal growth can be modelled using direct neighbourhood operations as new plants only occur directly neighbouring existing cells. Thus, it is actually a quite similar process, from the modelling point of view, as forest fire. Seed dispersal, however, allows plants to disperse over longer distances: new plants may establish also at cells that are not neighbours of cells containing plants in the previous time step. Here we will construct a simple seed dispersal model.
We use the following set of rules:
A single plant species disperses over an area.
For each time step, the probability P(E) that new plants establish at cells that are not yet occupied by the species is modelled as:
P(E) = 0.1(d/r)
with, d, the distance away (m) from the nearest cell containing the plant, and r, a parameter (m, r = 40 m).
For each time step, the new distribution of the plants consists of the distribution of the plants in the previous time step combined with the distribution of the plants that established in the current time step.
Go to the directory probab/plants
and display veg.map
. We assume that the plant species to be modelled is artificially introduced (before dispersal starts) at all pixels containing dense herbs (class with code 5). Open plants.py
. In the initial, create a Boolean map (use the variable name self.plants
) that is True at dense herbs and false elsewhere. This is the map containing the plants that will disperse over time.
To represent the transition rules, add statements to the dynamic creating a map probability
with P(E) for each time step. For now, you can assume that the plant does not yet spread (i.e., self.plants
does not change), so probability
will not change over time. Store the script, and run. Display the results.
Question: What is the probability in the left corner of the study area?
Below 0.01.
Between 0.01 and 0.8.
Above 0.8.
Using probability
, create a new map newPlants
that is True at cells where the plant establishes and false elsewhere. You need to use probability
as input, and the uniform
function. Write the result to disk and check the outcome.
Now, update self.plants
by ‘adding’ the newly established plants to self.plants
. Write self.plants
to disk in the dynamic. Save the script, run, and animate the plants dispersal, together with the probability maps. Run the model two times and compare results.
Question: How long does it approximately take to reach the the bottom left side of the area?
5 time steps.
10 time steps.
25 time steps.
40 time steps.
We can make all kinds of interesting extensions to the model. Let’s see what happens if we assume the plant can only grow at vegetation units Open Shrub (code 3) and Dense herbs (code 5). In the initial, create a map biotope
that is True at cells containing Open shrub or Dense herbs. In the dynamic, modify the script such that the plant will only exist or establish at these open shrub or dens herbs cells. Save the script, run.
Question: How long does it approximately take to reach the Open shrub patch on the left side of the area? Explain.
It will not be reached for sure as the probabilities are too low.
Almost certainly within 10 years.
It might be reached although probabilities are extremely low.
Almost certainly within 10 to 50 years.