Something went wrong on our end
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Persefone.jl 3.43 KiB
### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe.
###
### Daniel Vedder <daniel.vedder@idiv.de>
### Guy Pe'er <guy.peer@idiv.de>
### https://git.idiv.de/persefone/persefone-model
### (c) 2022-2023, licensed under the terms of the MIT license
###
### This file defines the module/package for the Persefone model.
### To run the model, either execute `run.jl` from the commandline,
### or import the module using your own wrapper script or software.
###
module Persefone
## define dependencies
using
ArgParse,
CairoMakie, #XXX this is a very big dependency :-(
CSV,
Dates,
DataFrames,
DataFramesMeta,
Distributed,
FileIO,
#FIXME an upstream update broke GeoArrays for TableTransforms > 1.15.0
GeoArrays, #XXX this is another big dependency
Logging,
LoggingExtras,
Random,
Serialization,
StableRNGs,
TOML
## Packages that may be useful later on:
# MacroTools, http://fluxml.ai/MacroTools.jl/stable/utilities/
# Debugger, https://github.com/JuliaDebug/Debugger.jl
# PackageCompiler, https://julialang.github.io/PackageCompiler.jl/stable/
# SpatialEcology, https://github.com/EcoJulia/SpatialEcology.jl
# OmniScape, https://circuitscape.org/
# PlantSimEngine, https://virtualplantlab.github.io/PlantSimEngine.jl/stable/
# Overseer, https://juliapackages.com/p/overseer -> ECS
## define exported functions and variables
export
#types
Pixel,
Weather,
FarmEvent,
ModelAgent,
FarmPlot,
Animal,
Farmer,
DataOutput,
SimulationModel,
#macros
@param,
@species,
@initialise,
@phase,
@trait,
@setphase,
@respond,
@here,
@kill,
@reproduce,
@neighbours,
@habitat,
@landcover,
@cropheight,
@cropname,
@distanceto,
@distancetoedge,
@countanimals,
@rand,
@shuffle!,
#functions
simulate,
simulate!,
initialise,
stepsimulation!,
createevent!,
finalise!,
outputdata,
visualisemap,
populationtrends,
visualiseoutput,
savemodelobject,
loadmodelobject
"""
SimulationModel
The supertype of [AgricultureModel](@ref). This is needed to avoid circular
dependencies (most types and functions depend on `SimulationModel`, but the
definition of the model struct depends on these types).
"""
abstract type SimulationModel end
"""
ModelAgent
The supertype of all agents in the model (animal species, farmer types, farmplots).
"""
abstract type ModelAgent end
## include all module files (note that the order matters - if file
## b references something from file a, it must be included later)
include("core/input.jl")
include("core/output.jl")
include("analysis/makieplots.jl")
include("world/landscape.jl")
include("world/weather.jl")
include("crop/crops.jl")
include("crop/farmplot.jl")
include("farm/farm.jl")
include("nature/insects.jl")
include("nature/energy.jl")
include("nature/nature.jl")
include("nature/macros.jl")
include("nature/populations.jl")
include("nature/ecologicaldata.jl")
#TODO loop over files in nature/species directory
# (the below doesn't work yet)
# for f in readdir("nature/species", join=true)
# endswith(f, ".jl") && include(f)
# end
include("nature/species/skylark.jl")
include("nature/species/wolpertinger.jl")
include("nature/species/wyvern.jl")
include("core/simulation.jl") #this must be last
# precompile important functions
precompile(initialise, (String,Int))
precompile(stepsimulation!, (SimulationModel,))
end