SOD Spread tutorial: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
No edit summary
(Old PoPS repo is PoPS Core now)
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{AddonCmd|r.pops.spread}} is a model for stochastic landscape spread of the pest and pathogens. It uses [https://github.com/ncsu-landscape-dynamics/PoPS PoPS] (Pest or Pathogen Spread) library. In this tutorial we will use it specifically to model the spread of Sudden Oak Death tree disease.
{{AddonCmd|r.pops.spread}} is a model for stochastic landscape spread of the pest and pathogens. It uses [https://github.com/ncsu-landscape-dynamics/pops-core PoPS] (Pest or Pathogen Spread) Core library. In this tutorial we will use it specifically to model the spread of Sudden Oak Death tree disease.
This tutorial shows how to run the model. You can download the [http://fatra.cnr.ncsu.edu/pops/data/Oregon.zip sample dataset] and simulate sudden oak death spread in the [https://goo.gl/maps/b1ZPn3abtW82 Rouge River-Siskiyou National Forest region] of western Oregon.
This tutorial shows how to run the model. You can download the [http://fatra.cnr.ncsu.edu/pops/data/PoPS_SOD_tutorial.zip sample dataset] and simulate sudden oak death spread in the [https://goo.gl/maps/b1ZPn3abtW82 Rouge River-Siskiyou National Forest region] of western Oregon.


= Software =
= Software =
Required software includes:
Required software includes:
* GRASS GIS >=7.2
* GRASS GIS >=7.8
* Addon module:
* Addon module:
** {{AddonCmd|r.pops.spread}}
** {{AddonCmd|r.pops.spread}}


= Input data used in this tutorial =
= Input data used in this tutorial =
Download the [http://fatra.cnr.ncsu.edu/pops/data/Oregon.zip sample dataset] containing:
Download the [http://fatra.cnr.ncsu.edu/pops/data/PoPS_SOD_tutorial.zip sample dataset] containing:
* digital elevation model
* digital elevation model
* orthophoto of study area
* orthophoto of study area
* study boundaries
* host layer
* host layer
* layer of all trees
* layer of all trees
* mapset containing moisture and temperature coefficients
* roads and rivers
* mapset containing weather coefficients
The sample dataset is a GRASS GIS Location, so it goes into your GRASS GIS Database which is usually a directory called grassdata in your home directory or your Documents directory.
The sample dataset is a GRASS GIS Location, so it goes into your GRASS GIS Database which is usually a directory called grassdata in your home directory or your Documents directory.


= Workflow =
= Workflow =
Download sample data and unzip it. Launch GRASS GIS and select the unzipped <tt>Oregon</tt> directory, Location <tt>Oregon_spread</tt> and create a new Mapset <tt>tutorial</tt>.
Download sample data and unzip it into your grassdata. Launch GRASS GIS and select Location <tt>PoPS_SOD_tutorial</tt> and Mapset <tt>tutorial</tt>.


<!-- Change working directory:
Change working directory by
 
typing <tt>cd</tt> (stands for change directory) into the GUI Console and hit Enter. You can create a directory for this exercise (outside of grassdata) anywhere where you can write and read. Navigate to that directory.
Type <tt>cd</tt> (stands for change directory) into the GUI Console and hit Enter. Navigate to where ever you have saved the example data and change directory to the <tt>tutorial</tt> mapset. -->


Install addon:
Install addon:
Line 30: Line 29:
</source>
</source>


First, we will set computational region of our analyses to an extent covering our study area and so that the cells are aligned with our host raster:
First, we will set computational region of our analyses to an extent covering our study area:
<source lang="bash">
<source lang="bash">
g.region vector=EU1_12x8 align=host -p
g.region region=small_study_area -p
</source>
</source>


== Create files with lists of input maps ==
== Create files with lists of input maps ==
Here we used already prepared weather coefficients, these can be created using this [https://github.com/ncsu-landscape-dynamics/weather-coefficient workflow].
Here we used already prepared weather coefficients, these can be created using this [https://github.com/ncsu-landscape-dynamics/weather-coefficient workflow].
We need two text files, one with temperature coefficients and one with precipitation coefficients.
Mapset weather includes raster layers per each week of a simulation. With that, we need to prepare a text file. List and write the maps in a file using g.list:
List and write the maps in a file using g.list. Search for ppt for precipitation and tmean or temperature mean for temperature, we list only the years we need for the simulation (2016 to 2021):
<source lang="bash">
g.list -m type=raster pattern="average_weather_*" mapset=weather output=weather.txt
</source>
The file should be written to your current working directory.
 
== Display infected data ==
Download [https://raw.githubusercontent.com/ncsu-landscape-dynamics/pops-intro-grass-notebook/master/color_infected.txt color ramp] into your current working directory to be used for better visualization of infected cells. Display the infected data. When displaying the infection, do not display zeros.
 
<source lang="bash">
<source lang="bash">
g.list -m type=raster pattern="*ppt_201[6-9]*,*ppt_202[0-2]*" mapset=weather output=precipitation.txt
r.colors map=eu_infection_2019 rules=color_infected.txt
g.list -m type=raster pattern="*tmean_201[6-9]*,*tmean_202[0-2]*" mapset=weather output=temperature.txt
d.rast map=ortho
d.rast map=eu_infection_2019 values=0 -i
d.vect map=NHDFlowline where="FCODE >= 46006" color=30:144:255
d.vect map=roads where="FULLNAME is not NULL" color=165:159:159 width=2
</source>
</source>


== Compute the spread of SOD for default values ==
== Compute the spread of SOD for default values ==
[[File:Spread sod.png|150px|thumb|Example output of SOD spread. Overlaid onto the orthophoto image.]]
Run the model using the text files created and setting only the required parameters. For this analysis we used a wind direction of NE and are looking at the first 5 years of spread from the initial 2019 infection discovery.
Run the model using the text files created and setting only the required parameters. For this analysis we used a wind direction of NE and are looking at the first 5 years of spread from the initial 2016 infection discovery.
 
We export a result from a single stochastic simulation (with specified random seed).
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 single_series=spread_sod output_frequency=yearly runs=1 random_seed=1
</source>
 
We list newly created output layers representing infected trees in each year of the simulation and we set a custom color ramp.
 
<source lang="bash">
g.list type=raster pattern="spread_sod*" output=series.txt
r.colors rules=color_infected.txt file=series.txt
</source>
 
You can visualize the spread series in Animation Tool, do not display 0 values for infected maps.
 
[[File:SOD_spread_example.png|upright|center|Example output of SOD spread. Overlaid onto the orthophoto image.]]
 
We can run multiple stochastic runs and aggregate the results into a probability layer (0.1 if cell was infected once in 10 runs), average layer (average number of infected trees per cell) and standard deviation layer.
 
Here we run the process 10x and we use 2 cores for parallel processing (providing module was compiled with OpenMP support and cores are available).
 
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 average_series=average probability_series=probability stddev_series=stddev output_frequency=yearly runs=10 nprocs=2 random_seed=1
</source>
 
Set color ramp for probability:
<source lang="bash">
g.list type=raster pattern="probability*" output=series.txt --o
r.colors color=magma file=series.txt
</source>
 
Explore results in Map Display or using Animation Tool, omit displaying 0 values of probability.
 
== Effect of dispersal kernel ==
The choice and parametrization of dispersal kernel significantly influences the spread and should be informed by calibration. The natural dispersal kernel (required) typically represents wind dispersal, additionally, we can optionally add the anthropogenic kernel which represents more human affected spread possibly over longer distances.
 
Each kernel is defined by type (cauchy, exponential), direction (none, N, NE, E, ...), direction strength (concentration around the direction using [https://en.wikipedia.org/wiki/Von_Mises_distribution von mises distribution]) and scale (distance).
 
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=400 natural_direction_strength=3 single_series=spread_distance output_frequency=yearly runs=1 random_seed=1
 
g.list type=raster pattern="spread_distance*" output=series.txt --o
r.colors rules=color_infected.txt file=series.txt
</source>
 
Compare our initial run with run with increased kernel scale.
 
We can then also change the direction to E and increase the strength of direction:
 
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=E natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=10 single_series=spread_direction output_frequency=yearly runs=1 random_seed=1
 
g.list type=raster pattern="spread_direction*" output=series.txt --o
r.colors rules=color_infected.txt file=series.txt
</source>
 
Finally, we can select a different kernel type.
 
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6  weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=cauchy natural_distance=242 natural_direction_strength=3 single_series=spread_type output_frequency=yearly runs=1 random_seed=1
 
g.list type=raster pattern="spread_type*" output=series.txt --o
r.colors rules=color_infected.txt file=series.txt
</source>
 
== Effect of reproductive rate ==
Similarly to kernel, reproductive rate should be informed by calibration.
This model uses the [https://en.wikipedia.org/wiki/Poisson_distribution Poisson distribution] to generate spores.
In this example we double it:
 
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=3 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 single_series=spread_rate output_frequency=yearly runs=1 random_seed=1
 
g.list type=raster pattern="spread_rate*" output=series.txt --o
r.colors rules=color_infected.txt file=series.txt
</source>
 
== Treatments ==
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=3 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 single_series=spread_rate output_frequency=yearly runs=1 random_seed=1
 
g.list type=raster pattern="probability*" output=series.txt --o
r.colors color=magma file=series.txt
</source>
 
We treat the initial infection and a buffer around it. The treatments are applied at the end of the year.
<source lang="bash">
r.buffer -z input=eu_infection_2019 output=buffer_A distances=200
r.mapcalc "treatment_A = if (isnull(buffer_A), 0, 1)"
</source>
 
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 probability_series=probtreatmentA output_frequency=yearly runs=10 nprocs=2 random_seed=1 treatments=treatment_A treatment_date=2019-12-31 treatment_length=0 treatment_application=ratio_to_all
 
g.list type=raster pattern="probtreatmentA*" output=series.txt --o
r.colors color=magma file=series.txt
</source>
 
Here we increase the buffer size:
<source lang="bash">
r.buffer -z input=eu_infection_2019 output=buffer_B distances=500
r.mapcalc "treatment_B = if (isnull(buffer_B), 0, 1)"
</source>
 
 
<source lang="bash">
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 probability_series=probtreatmentB output_frequency=yearly runs=10 nprocs=2 random_seed=1 treatments=treatment_B treatment_date=2019-12-31 treatment_length=0 treatment_application=ratio_to_all
 
g.list type=raster pattern="probtreatmentB*" output=series.txt --o
r.colors color=magma file=series.txt
</source>
 
Now we create a large 1km wide barrier in an attempt to stop the spread. For this scenario, we assume the treatment is not 100% effective, but rather only 75% of host is removed.
 
<source lang="bash">
<source lang="bash">
r.pops.spread host=host total_plants=all_trees infected=inf_2016 output=spread_sod output_series=spread_sod wind=NE moisture_coefficient_file=precipitation.txt temperature_coefficient_file=temperature.txt start_time=2016 end_time=2021 step=week random_seed=4
r.mapcalc "treatment_C = if (y() > 4687000 && y() < 4688000, 0.75, 0 )"
</source>
</source>


Add ortho, spread results, and the initial infected area to the display to view the spread.
We will see that for the final year of our simulation, the disease spread in several stochastic runs over the barrier:
Display only values greater than zero.
 
<source lang="bash">
<source lang="bash">
d.rast ortho
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 probability_series=probtreatmentC output_frequency=yearly runs=10 nprocs=2 random_seed=1 treatments=treatment_C treatment_date=2019-12-31 treatment_length=0 treatment_application=ratio_to_all
d.rast -i map=inf_2016 values=0
 
d.rast -i spread_sod values=0
g.list type=raster pattern="probtreatmentC*" output=series.txt --o
r.colors color=magma file=series.txt
</source>
</source>


<!--
Finally, we manage with the 200m buffer treatments A in 2019 and with the barrier in 2021:
 
<source lang="bash">
<source lang="bash">
t.create output=SOD semantictype=mean title="SOD spread between 2016 and 2021" description="SOD spread between 2016 and 2021"
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 probability_series=probtreatmentAC output_frequency=yearly runs=10 nprocs=2 random_seed=1 treatments=treatment_A,treatment_C treatment_date=2019-12-31,2021-12-31 treatment_length=0,0 treatment_application=ratio_to_all
g.list type=raster pattern=spread_sod_* output=sod_series.txt
 
t.register input=SOD file=/home/tangible/Documents/SOD/sod_series.txt start=2016-01-01 increment="1 years"
g.list type=raster pattern="probtreatmentAC*" output=series.txt --o
r.colors color=magma file=series.txt
</source>
</source>
-->


You can visualize the spread series in Animation Tool.


[[File:Spread sodk1.png|150px|thumb|Example output of SOD spread for kappa=0. Overlaid onto the orthophoto image.]]
<!--
[[File:Spread sodk2.png|150px|thumb|Example output of SOD spread for kappa=4. Overlaid onto the orthophoto image.]]
== Wind dispersal ==
== Wind dispersal ==
=== Direction ===
=== Direction ===
Line 104: Line 226:
</source>
</source>


<!--
[[File:Spread sods1 1.png|150px|thumb|Output of SOD spread for scale_1=1 for the years 2016-2021. Overlaid onto the orthophoto image.]]
[[File:Spread sods1 2.png|150px|thumb|Output of SOD spread for scale_1=50 for the years 2016-2021. Overlaid onto the orthophoto image.]]
-->


== Treatments ==
== Treatments ==
Line 137: Line 255:
r.pops.spread host=host total_plants=all_trees infected=inf_2016 output=spread_sod_treatB_barrier output_series=spread_sod_treatB_barrier wind=N moisture_coefficient_file=precipitation.txt temperature_coefficient_file=temperature.txt start_time=2016 end_time=2021 step=week  treatments=treatment_B,barrier treatment_year=2016,2018 random_seed=4
r.pops.spread host=host total_plants=all_trees infected=inf_2016 output=spread_sod_treatB_barrier output_series=spread_sod_treatB_barrier wind=N moisture_coefficient_file=precipitation.txt temperature_coefficient_file=temperature.txt start_time=2016 end_time=2021 step=week  treatments=treatment_B,barrier treatment_year=2016,2018 random_seed=4
</source>
</source>
-->

Latest revision as of 20:35, 7 September 2020

r.pops.spread is a model for stochastic landscape spread of the pest and pathogens. It uses PoPS (Pest or Pathogen Spread) Core library. In this tutorial we will use it specifically to model the spread of Sudden Oak Death tree disease. This tutorial shows how to run the model. You can download the sample dataset and simulate sudden oak death spread in the Rouge River-Siskiyou National Forest region of western Oregon.

Software

Required software includes:

Input data used in this tutorial

Download the sample dataset containing:

  • digital elevation model
  • orthophoto of study area
  • host layer
  • layer of all trees
  • roads and rivers
  • mapset containing weather coefficients

The sample dataset is a GRASS GIS Location, so it goes into your GRASS GIS Database which is usually a directory called grassdata in your home directory or your Documents directory.

Workflow

Download sample data and unzip it into your grassdata. Launch GRASS GIS and select Location PoPS_SOD_tutorial and Mapset tutorial.

Change working directory by typing cd (stands for change directory) into the GUI Console and hit Enter. You can create a directory for this exercise (outside of grassdata) anywhere where you can write and read. Navigate to that directory.

Install addon:

g.extension r.pops.spread

First, we will set computational region of our analyses to an extent covering our study area:

g.region region=small_study_area -p

Create files with lists of input maps

Here we used already prepared weather coefficients, these can be created using this workflow. Mapset weather includes raster layers per each week of a simulation. With that, we need to prepare a text file. List and write the maps in a file using g.list:

g.list -m type=raster pattern="average_weather_*" mapset=weather output=weather.txt

The file should be written to your current working directory.

Display infected data

Download color ramp into your current working directory to be used for better visualization of infected cells. Display the infected data. When displaying the infection, do not display zeros.

r.colors map=eu_infection_2019 rules=color_infected.txt
d.rast map=ortho
d.rast map=eu_infection_2019 values=0 -i
d.vect map=NHDFlowline where="FCODE >= 46006" color=30:144:255
d.vect map=roads where="FULLNAME is not NULL" color=165:159:159 width=2

Compute the spread of SOD for default values

Run the model using the text files created and setting only the required parameters. For this analysis we used a wind direction of NE and are looking at the first 5 years of spread from the initial 2019 infection discovery.

We export a result from a single stochastic simulation (with specified random seed).

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 single_series=spread_sod output_frequency=yearly runs=1 random_seed=1

We list newly created output layers representing infected trees in each year of the simulation and we set a custom color ramp.

g.list type=raster pattern="spread_sod*" output=series.txt
r.colors rules=color_infected.txt file=series.txt

You can visualize the spread series in Animation Tool, do not display 0 values for infected maps.

Example output of SOD spread. Overlaid onto the orthophoto image.
Example output of SOD spread. Overlaid onto the orthophoto image.

We can run multiple stochastic runs and aggregate the results into a probability layer (0.1 if cell was infected once in 10 runs), average layer (average number of infected trees per cell) and standard deviation layer.

Here we run the process 10x and we use 2 cores for parallel processing (providing module was compiled with OpenMP support and cores are available).

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 average_series=average probability_series=probability stddev_series=stddev output_frequency=yearly runs=10 nprocs=2 random_seed=1

Set color ramp for probability:

g.list type=raster pattern="probability*" output=series.txt --o
r.colors color=magma file=series.txt

Explore results in Map Display or using Animation Tool, omit displaying 0 values of probability.

Effect of dispersal kernel

The choice and parametrization of dispersal kernel significantly influences the spread and should be informed by calibration. The natural dispersal kernel (required) typically represents wind dispersal, additionally, we can optionally add the anthropogenic kernel which represents more human affected spread possibly over longer distances.

Each kernel is defined by type (cauchy, exponential), direction (none, N, NE, E, ...), direction strength (concentration around the direction using von mises distribution) and scale (distance).

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=400 natural_direction_strength=3 single_series=spread_distance output_frequency=yearly runs=1 random_seed=1

g.list type=raster pattern="spread_distance*" output=series.txt --o
r.colors rules=color_infected.txt file=series.txt

Compare our initial run with run with increased kernel scale.

We can then also change the direction to E and increase the strength of direction:

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=E natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=10 single_series=spread_direction output_frequency=yearly runs=1 random_seed=1

g.list type=raster pattern="spread_direction*" output=series.txt --o
r.colors rules=color_infected.txt file=series.txt

Finally, we can select a different kernel type.

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6  weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=cauchy natural_distance=242 natural_direction_strength=3 single_series=spread_type output_frequency=yearly runs=1 random_seed=1

g.list type=raster pattern="spread_type*" output=series.txt --o
r.colors rules=color_infected.txt file=series.txt

Effect of reproductive rate

Similarly to kernel, reproductive rate should be informed by calibration. This model uses the Poisson distribution to generate spores. In this example we double it:

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=3 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 single_series=spread_rate output_frequency=yearly runs=1 random_seed=1

g.list type=raster pattern="spread_rate*" output=series.txt --o
r.colors rules=color_infected.txt file=series.txt

Treatments

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=3 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 single_series=spread_rate output_frequency=yearly runs=1 random_seed=1

g.list type=raster pattern="probability*" output=series.txt --o
r.colors color=magma file=series.txt

We treat the initial infection and a buffer around it. The treatments are applied at the end of the year.

r.buffer -z input=eu_infection_2019 output=buffer_A distances=200
r.mapcalc "treatment_A = if (isnull(buffer_A), 0, 1)"
r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 probability_series=probtreatmentA output_frequency=yearly runs=10 nprocs=2 random_seed=1 treatments=treatment_A treatment_date=2019-12-31 treatment_length=0 treatment_application=ratio_to_all

g.list type=raster pattern="probtreatmentA*" output=series.txt --o
r.colors color=magma file=series.txt

Here we increase the buffer size:

r.buffer -z input=eu_infection_2019 output=buffer_B distances=500
r.mapcalc "treatment_B = if (isnull(buffer_B), 0, 1)"


r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 probability_series=probtreatmentB output_frequency=yearly runs=10 nprocs=2 random_seed=1 treatments=treatment_B treatment_date=2019-12-31 treatment_length=0 treatment_application=ratio_to_all

g.list type=raster pattern="probtreatmentB*" output=series.txt --o
r.colors color=magma file=series.txt

Now we create a large 1km wide barrier in an attempt to stop the spread. For this scenario, we assume the treatment is not 100% effective, but rather only 75% of host is removed.

r.mapcalc "treatment_C = if (y() > 4687000 && y() < 4688000, 0.75, 0 )"

We will see that for the final year of our simulation, the disease spread in several stochastic runs over the barrier:

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 probability_series=probtreatmentC output_frequency=yearly runs=10 nprocs=2 random_seed=1 treatments=treatment_C treatment_date=2019-12-31 treatment_length=0 treatment_application=ratio_to_all

g.list type=raster pattern="probtreatmentC*" output=series.txt --o
r.colors color=magma file=series.txt

Finally, we manage with the 200m buffer treatments A in 2019 and with the barrier in 2021:

r.pops.spread host=host total_plants=max_host infected=eu_infection_2019 start_date=2019-01-01 end_date=2023-12-31 step_unit=week reproductive_rate=1.6 weather_coefficient_file=weather.txt natural_direction=NE natural_dispersal_kernel=exponential natural_distance=242 natural_direction_strength=3 probability_series=probtreatmentAC output_frequency=yearly runs=10 nprocs=2 random_seed=1 treatments=treatment_A,treatment_C treatment_date=2019-12-31,2021-12-31 treatment_length=0,0 treatment_application=ratio_to_all

g.list type=raster pattern="probtreatmentAC*" output=series.txt --o
r.colors color=magma file=series.txt