Generates a video showing the epidemic dynamics on a map representing the cropping landscape. (requires ffmpeg library).

video(
  audpc,
  time_param,
  Npatho,
  landscape,
  area,
  rotation,
  croptypes,
  croptype_names = c(),
  cultivars_param,
  keyDates = NULL,
  nMapPY = 10,
  path = getwd()
)

Arguments

audpc

A dataframe containing audpc outputs (generated through epid_output). 1 line per year and 1 column per cultivar, with an additional column for the average audpc in the landscape.

time_param

list of simulation parameters:

  • Nyears = number cropping seasons,

  • nTSpY = number of time-steps per cropping season.

Npatho

number of pathogen genotypes.

landscape

a sp object containing the landscape.

area

a vector containing polygon areas (must be in square meters).

rotation

a dataframe containing for each field (rows) and year (columns, named "year_1", "year_2", etc.), the index of the cultivated croptype. Importantly, the matrix must contain 1 more column than the real number of simulated years.

croptypes

a dataframe with three columns named 'croptypeID' for croptype index, 'cultivarID' for cultivar index and 'proportion' for the proportion of the cultivar within the croptype.

croptype_names

a vector of croptype names (for legend).

cultivars_param

a list of parameters associated with each host genotype (i.e. cultivars) when cultivated in pure crops:

  • name = vector of cultivar names,

  • max_density = vector of maximum host densities (per square meter) at the end of the cropping season as if cultivated in pure crops,

  • cultivars_genes_list = a list containing, for each host genotype, the indices of carried resistance genes.

keyDates

a vector of times (in time steps) where to draw vertical lines in the AUDPC graphic. Usually used to delimit durabilities of the resistance genes. No line is drawn if keyDates=NULL (default).

nMapPY

an integer specifying the number of epidemic maps per year to generate.

path

path where binary files are located and where the video will be generated.

Value

A video file of format webM

Details

The left panel shows the year-after-year dynamics of AUDPC, for each cultivar as well as the global average. The right panel illustrates the landscape, where fields are hatched depending on the cultivated croptype, and coloured depending on the prevalence of the disease. Note that up to 9 different croptypes can be represented properly in the right panel.

Examples

if (FALSE) {
demo_landsepi()
}