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

Added development notice

parent af0de589
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@ function render_plot(screen)
dates = @param(core.startdate):@param(core.enddate)
axlimits = @lift((1, length(dates), 0, maximum($pops[!,:Abundance])))
ax = Axis(plotimage[1,1], xlabel="Date", ylabel="Population size",
limits=axlimits, xticks=Persefone.gettickmarks(dates))
limits=axlimits, xticks=Persefone.datetickmarks(dates))
for s in @param(nature.targetspecies)
points = @lift(Vector{Float32}(@subset($pops, :Species .== s).Abundance))
iszero(size(points[])[1]) && continue
......@@ -108,6 +108,65 @@ function render_plot(screen)
display(screen, plotimage.scene)
end
#TODO adapt the next two functions to QML and integrate them into the interface
"""
skylarkpopulation(model)
Plot a line graph of total population size and individual demographics of skylarks over time.
Returns a Makie figure object.
"""
function skylarkpopulation(model::SimulationModel)
!("Skylark" in @param(nature.targetspecies)) && return nothing
pops = @data("skylark_abundance")
f = Figure()
dates = @param(core.startdate):@param(core.enddate)
axlimits = (1, length(dates), 0, maximum(pops[!,:TotalAbundance]))
ax = Axis(f[1,1], xlabel="Date", ylabel="Population size",
limits=axlimits, xticks=Persefone.datetickmarks(dates))
lines!(f[1,1], Vector{Float32}(pops.TotalAbundance), linewidth=3, label="Total abundance")
lines!(f[1,1], Vector{Float32}(pops.Mating), linewidth=3, label="Mating")
lines!(f[1,1], Vector{Float32}(pops.Breeding), linewidth=3, label="Breeding")
lines!(f[1,1], Vector{Float32}(pops.Nonbreeding), linewidth=3, label="Non-breeding")
lines!(f[1,1], Vector{Float32}(pops.Juvenile), linewidth=3, label="Juvenile")
lines!(f[1,1], Vector{Float32}(pops.Migrants), linewidth=3, label="Migrants")
axislegend("Demographic"; position=:lt)
f
end
"""
croptrends(model)
Plot a dual line graph of cropped area and average plant height per crop over time.
Returns a Makie figure object.
"""
function croptrends(model::SimulationModel)
cropdata = @data("fields")
f = Figure(size=(1200,1000))
dates = @param(core.startdate):@param(core.enddate)
# plot cropped area over time
axlimitsarea = (1, length(dates), 0, maximum(cropdata[!,:Area])*1.1)
ax1 = Axis(f[1,1], xlabel="Date", ylabel="Cropped area (ha)",
limits=axlimitsarea, xticks=Persefone.datetickmarks(dates))
for c in unique(cropdata.Crop)
points = @select!(@subset(cropdata, :Crop .== c), :Area)
(iszero(size(points)[1]) || iszero(sum(points.Area))) && continue
lines!(f[1,1], Vector{Float32}(points.Area), linewidth=3, label=c)
end
axislegend("Crop"; position=:rt)
# plot average crop height over time
axlimitsheight = (1, length(dates), 0, maximum(cropdata[!,:Height])*1.1)
ax2 = Axis(f[2,1], xlabel="Date", ylabel="Average plant height (cm)",
limits=axlimitsheight, xticks=datetickmarks(dates))
for c in unique(cropdata.Crop)
points = @select!(@subset(cropdata, :Crop .== c), :Height)
(iszero(size(points)[1]) || iszero(sum(points.Height))) && c != "no growth" && continue
lines!(f[2,1], Vector{Float32}(points.Height), linewidth=3, label=c)
end
axislegend("Crop"; position=:rt)
f
end
on(delay) do d
println("Delay is now $(round(d, digits=1)) seconds.") #XXX DEBUG
end
......@@ -153,6 +212,8 @@ The main function that creates the application.
function launch()
global model, timer
println("NOTE: this software is in development. Expect bugs.")
activateqmlfunctions()
timer = QTimer()
......
......@@ -92,14 +92,14 @@ ApplicationWindow {
Button {
id: backButton
text: "<"
ToolTip.text: "Back"
ToolTip.text: "Step back"
ToolTip.visible: hovered
onClicked: { Julia.previousstep() }
}
Button {
id: stepButton
text: ">"
ToolTip.text: "Step"
ToolTip.text: "Step forward"
ToolTip.visible: hovered
onClicked: { Julia.nextstep() }
}
......@@ -142,10 +142,19 @@ ApplicationWindow {
text: "Persefone.jl Desktop"
informativeText: "A mechanistic model of agricultural landscapes \
and ecosystems in Europe.\n\n\
© 2023 Daniel Vedder, Lea Kolb, Guy Pe'er\n\
© 2024 Daniel Vedder, Guy Pe'er\n\
Distributed under the MIT license."
}
MessageDialog {
id: devDialog
text: "In Development"
informativeText: "Please note that this model and the desktop software \
are still in active development. Expect bugs and unfinished functionality.\n\n\
If you have questions, contact daniel.vedder@idiv.de."
visible: true
}
FileDialog {
id: loadFileChooser
defaultSuffix: "dat"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment