Skip to content
Snippets Groups Projects
Commit af0de589 authored by xo30xoqa's avatar xo30xoqa
Browse files

Got PersefoneDesktop working with the newest version of Persefone

parent 298c61ea
No related branches found
No related tags found
No related merge requests found
desktop.jl 100755 → 100644
File mode changed from 100755 to 100644
......@@ -10,31 +10,33 @@
configfile = "guiparams.toml" # location of the configuration file
outdir = "desktop_results" # location and name of the output folder
overwrite = true # overwrite the output directory? (true/false/"ask")
logoutput = "both" # log output to screen/file/none/both
csvoutput = false # save collected data in CSV files
visualise = false # generate result graphs
storedata = true # keep collected data in memory
loglevel = "debug" # verbosity level: "debug", "info", "warn"
loglevel = "info" # verbosity level: "debug", "info", "warn"
processors = 2 # number of processors to use on parallel runs
seed = 2 # seed value for the RNG (0 -> random value)
# dates to start and end the simulation
startdate = 2022-01-01
enddate = 2022-12-31
startdate = 2021-01-01
enddate = 2023-12-31
[world]
#TODO point to files in the main data directory? (avoid file duplication)
landcovermap = "data/regions/jena-small/landcover.tif" # location of the landcover map
farmfieldsmap = "data/regions/jena-small/fields.tif" # location of the field geometry map
weatherfile = "data/regions/jena-small/weather.csv" # location of the weather data file
mapdirectory = "data/regions/jena-small" # the directory in which all geographic data are stored
mapresolution = 10 # map resolution in meters
landcovermap = "landcover.tif" # name of the landcover map in the map directory
farmfieldsmap = "fields.tif" # name of the field geometry map in the map directory
weatherfile = "weather.csv" # name of the weather data file in the map directory
[farm]
farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented)
farmmodel = "BasicFarmer" # which version of the farm model to use
setaside = 0.04 # proportion of farm area set aside as fallow
fieldoutfreq = "daily" # output frequency for crop/field data, daily/monthly/yearly/end/never
[nature]
#targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate
targetspecies = ["Skylark"] # species to be simulated
popoutfreq = "daily" # output frequency population-level data, daily/monthly/yearly/end/never
indoutfreq = "daily" # output frequency individual-level data, daily/monthly/yearly/end/never
insectmodel = ["season", "habitat", "pesticides", "weather"] # factors affecting insect growth
[crop]
cropmodel = "almass" # crop growth model to use, "almass" or "aquacrop"
......
......@@ -58,14 +58,14 @@ function render_map(screen)
launching[] && return display(screen, Figure().scene) # blank screen at launch
println("Updating map")
if isnothing(mapimage)
landcover = rotr90(load(@param(world.landcovermap)))
landcover = rotr90(load(joinpath(@param(world.mapdirectory), @param(world.landcovermap))))
mapimage = Figure()
ax = Axis(mapimage[1,1])
hidedecorations!(ax)
image!(mapimage[1,1], landcover)
ax.aspect = DataAspect()
inds = @lift(@transform!(@subset(model.datatables["individuals"],
:Date .== $date-Day(1)),
inds = @lift(@transform!(@subset(@data("individuals"),
:X .!= -1, :Date .== $date-Day(1)),
:Y = size(landcover)[2] .- :Y))
ncolors = max(2, length(@param(nature.targetspecies)))
update_theme!(palette=(color=cgrad(:seaborn_bright, ncolors),),
......@@ -86,7 +86,7 @@ function render_plot(screen)
if isnothing(plotimage)
pops = @lift begin
$date #needed to activate the lift, doesn't do anything
model.datatables["populations"]
@data("populations")
end
#XXX other colour schemes: :tab10, :Accent_8, :Dark2_8, :Paired_12, :Set1_9
# https://juliagraphics.github.io/ColorSchemes.jl/stable/catalogue/
......@@ -135,13 +135,13 @@ end
datestring = () -> Dates.format(date[], "dd U yyyy")
function activateqmlfunctions()
@qmlfunction configwindow
#@qmlfunction configwindow
@qmlfunction loadsimulation
@qmlfunction savesimulation
@qmlfunction nextstep
@qmlfunction previousstep
@qmlfunction datestring
@qmlfunction writeconfig
#@qmlfunction writeconfig
@qmlfunction saveoutput
end
......
......@@ -18,7 +18,6 @@ using
TOML,
Dates,
Makie,
Agents,
FileIO,
CxxWrap,
GLMakie,
......@@ -31,7 +30,7 @@ using
include("variables.jl")
include("logic.jl")
include("config.jl")
#include("config.jl") # ignore config for now
include("GUI.jl")
precompile(launch, ())
......
......@@ -13,7 +13,7 @@
model.date -= Day(1)
Persefone.outputdata(model, true) # record data before run starts
model.date += Day(1)
landcovermap = rotr90(load(@param(world.landcovermap)))
landcovermap = rotr90(load(joinpath(@param(world.mapdirectory), @param(world.landcovermap))))
date[] = model.date
launching[] = false
end
......
......@@ -24,10 +24,10 @@ ApplicationWindow {
text: "&New Simulation"
onTriggered: { vars.launching = true } //TODO select config file
}
Action {
text: "&Configure Simulation"
onTriggered: { Julia.configwindow() }
}
/* Action { */
/* text: "&Configure Simulation" */
/* onTriggered: { Julia.configwindow() } */
/* } */
Action {
text: "&Load Saved State"
onTriggered: { loadFileChooser.open() }
......
......@@ -26,7 +26,7 @@ const runbuttontip = Observable("Run")
## configuration parameters
const userconfigfile = Observable("userconfig.toml")
const userconfigfile = Observable("userconfig.toml") #XXX not yet needed
const outdir = Observable("persefone_output")
const csvoutput = Observable(false)
const loglevel = Observable("warn")
......@@ -34,15 +34,14 @@ const processors = Observable(1)
const seed = Observable(2)
const startdateday = Observable(1)
const startdatemonth = Observable(1)
const startdateyear = Observable(2022)
const startdateyear = Observable(2021)
const enddateday = Observable(31)
const enddatemonth = Observable(12)
const enddateyear = Observable(2022)
const region = Observable("Jena") #XXX alternatives not yet implemented
#const farmmodel = Observable("FieldManager") #XXX not yet implemented
const region = Observable("Jena")
const farmmodel = Observable("BasicFarmer")
const species = Observable("Skylark")
#const targetspecies = Observable() #TODO not sure how to configure a list?
#const insectmodel = Observable() #TODO not sure how to configure a list?
const cropmodel = Observable("ALMaSS") #XXX alternatives not yet implemented
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment