diff --git a/Project.toml b/Project.toml index 3bf9f92b857cc0577fa77985c9b7042fcfea0dc8..e2611994126fcf45d40f68f850e6c14068ac0d74 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Persefone" uuid = "039acd1d-2a07-4b33-b082-83a1ff0fd136" authors = ["Daniel Vedder <daniel.vedder@idiv.de>"] -version = "0.3.1" +version = "0.3.2" [deps] Agents = "46ada45e-f475-11e8-01d0-f70cc89e6671" diff --git a/src/Persefone.jl b/src/Persefone.jl index da3f1cdab7ff7b91d77b4af5013f5497507ac7a2..9dc807dd78e4acd24b75b9c99cc384a06303a623 100644 --- a/src/Persefone.jl +++ b/src/Persefone.jl @@ -24,7 +24,7 @@ using Distributed, FileIO, #FIXME an upstream update broke GeoArrays for TableTransforms > 1.15.0 - GeoArrays, #XXX this is a big dependency - can we get rid of it? + GeoArrays, Logging, LoggingExtras, Random, @@ -114,7 +114,8 @@ include("nature/species/wyvern.jl") include("core/simulation.jl") #this must be last -#XXX precompile? -> PrecompileTools doesn't really give an improvement -# https://julialang.org/blog/2021/01/precompile_tutorial/ +# precompile important functions +precompile(initialise, (String,Int)) +precompile(stepsimulation!, (AgentBasedModel,)) end diff --git a/src/analysis/makieplots.jl b/src/analysis/makieplots.jl index 3967eebf6fae1ce4beaee0679d68511d505cd41a..13bd6a533f8eb50c186f834f9b0790f0977b6a4d 100644 --- a/src/analysis/makieplots.jl +++ b/src/analysis/makieplots.jl @@ -22,7 +22,10 @@ function visualisemap(model::AgentBasedModel,date=nothing,landcover=nothing) ax.aspect = DataAspect() # check if there are individuals and plot them inds = model.datatables["individuals"] - iszero(size(inds)[1]) && return f + if iszero(size(inds)[1]) + @debug "No individual data to map" + return f + end isnothing(date) && (date = inds.Date[end]) for s in unique(inds.Species) points = @select!(@subset(inds, :Species .== s, :Date .== date), diff --git a/src/core/simulation.jl b/src/core/simulation.jl index 51dfdbf71b6b38cf07359ff288c65e06f41f4ee6..81d931aee154a50acc1aeae056de0a62f52140e8 100644 --- a/src/core/simulation.jl +++ b/src/core/simulation.jl @@ -152,7 +152,7 @@ function finalise!(model::AgentBasedModel) with_logger(model.logger) do @info "Simulated $(model.date-@param(core.startdate))." @info "Simulation run completed at $(Dates.now()),\nwrote output to $(@param(core.outdir))." - visualiseoutput(model) + @param(core.visualise) && visualiseoutput(model) model end end diff --git a/src/parameters.toml b/src/parameters.toml index 99cea9792669c6a99e81c3e6289d89db47620825..79bba3e3d1784cf8a903b24819f0bbe88022d0f1 100644 --- a/src/parameters.toml +++ b/src/parameters.toml @@ -11,6 +11,7 @@ configfile = "src/parameters.toml" # location of the configuration file outdir = "results" # location and name of the output folder overwrite = "ask" # overwrite the output directory? (true/false/"ask") csvoutput = true # save collected data in CSV files +visualise = true # generate result graphs storedata = true # keep collected data in memory loglevel = "debug" # verbosity level: "debug", "info", "warn" processors = 2 # number of processors to use on parallel runs