Functions

Index

Function Descriptions

Simulation Functions

MetaRange.read_inputFunction
read_input(path::String)

Read in the configuration and associated files in the folder and return a Simulation_Data struct.

Arguments

  • path::String: Path to the configuration file.

Returns

  • SD::Simulation_Data: Returns the initialised simulation data struct with the first timestep.

Examples

julia> SD = read_input("path/to/config.csv")
precipitation
temperature
...

See also run_simulation!(), Simulation_Data

source
MetaRange.run_simulation!Function
run_simulation!(SD::Simulation_Data)

Run an ecological simulation.

Take the initialized simulation data SD and run the simulation for the specified number of timesteps.

Arguments

  • SD::MetaRange.Simulation_Data: MetaRange simulation data struct produced by

read_input()

Returns

  • SD::MetaRange.Simulation_Data: Returns the struct with later timesteps after initialisation simulated.

Examples

julia> run_simulation!(SD)

See also read_input(), Simulation_Data

source

Data Functions

MetaRange.df_outputFunction
df_output(SD::Simulation_Data)

Create a dataframe from the output of a simulation.

Arguments

  • SD::Simulation_Data: A Simulation_Data object containing the output data.

Returns

  • A DataFrame object with the following columns:
    • t: time
    • x: x-coordinate of the patch
    • y: y-coordinate of the patch
    • abundance: abundance of the species in the patch
    • reproduction: growth rate of the species in the patch
    • habitat: habitat suitability of the patch
    • carry: carrying capacity of the patch
    • bevmort: background mortality rate of the species in the patch

Examples

julia> df = df_output(SD)
source
MetaRange.save_outputFunction
save_output(SD::Simulation_Data)

Save all output variables in a .tsv file.

This function writes all output variables abundance - into a .tsv file.

Arguments

  • SD::Simulation_Data: Simulation_Data object

Returns

  • A .tsv file with the following columns in the output directory`:
    • t: time
    • x: x-coordinate of the patch
    • y: y-coordinate of the patch
    • abundance: abundance of the species in the patch
    • reproduction: growth rate of the species in the patch
    • habitat: habitat suitability of the patch
    • carry: carrying capacity of the patch
    • bevmort: background mortality rate of the species in the patch

Examples

julia> save_output(SD)
source

Visualization Functions

MetaRange.plot_abundancesFunction
plot_abundances(SD::Simulation_Data)

Plot the total abundances of a species over time.

Arguments

  • SD::Simulation_Data: Simulation_Data object

Returns

  • f::Figure: Figure object

Examples

julia> f = plot_abundances(SD)
julia> f

Abundance plot

source
MetaRange.imgFunction
img(SD::Simulation_Data, t::Int, arg::String)

Plots the specified output for timestep t.

Arguments

  • SD::Simulation_Data: Simulation_Data object
  • t::Int: timestep
  • arg::String: argument on what shall be displayed. Must be one of restrictions, abundances, suitability, temperature, precipitation, carry, growrate, or mortality.

Returns

  • f::Figure: Figure object
source
MetaRange.gifFunction
gif(SD::Simulation_Data, arg::String, frames::Int)

Plots the specified output for timestep t.

Arguments

  • SD::Simulation_Data: Simulation_Data object
  • arg::String: argument on what shall be displayed. Must be one of restrictions, abundances, suitability, temperature, precipitation, carry, growrate, or mortality.
  • frames::Int: number of frames per second

Returns

  • The gif is saved under the name "arg.gif" in the output directory.
source
MetaRange.img_complexFunction
img_complex(SD::Simulation_Data, t::Int)

Plot environment, species environmental preferences, habitat suitability, and abundances for a given timestep.

Arguments

  • SD::Simulation_Data: Simulation_Data object
  • t::Int: timestep

Returns

  • f::Figure: Figure object

Examples

julia> f = img_complex(SD, 19)
julia> f

All plots

source
MetaRange.gif_complexFunction
gif_complex(SD::Simulation_Data; frames = 2)

Plot environment, species environmental preferences, habitat suitability, and abundances and create a GIF.

Arguments

  • SD::Simulation_Data: Simulation_Data object
  • frames::Int: framerate

Returns

  • The gif is saved under the name "all.gif" in the output directory.

Examples

julia> gif_complex(SD)

Gif of input and output plots

source