Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Persefone.jl
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Persefone
Persefone.jl
Commits
26eb0dd5
Commit
26eb0dd5
authored
1 year ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Small bug fixes.
This closes #47
parent
1d9779a4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Persefone.jl
+2
-3
2 additions, 3 deletions
src/Persefone.jl
src/analysis/makieplots.jl
+3
-2
3 additions, 2 deletions
src/analysis/makieplots.jl
src/core/input.jl
+8
-4
8 additions, 4 deletions
src/core/input.jl
with
13 additions
and
9 deletions
src/Persefone.jl
+
2
−
3
View file @
26eb0dd5
...
@@ -22,10 +22,11 @@ using
...
@@ -22,10 +22,11 @@ using
DataFramesMeta
,
DataFramesMeta
,
Distributed
,
Distributed
,
FileIO
,
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
,
#XXX this is a big dependency - can we get rid of it?
Logging
,
Logging
,
LoggingExtras
,
LoggingExtras
,
CairoMakie
,
CairoMakie
,
#XXX this is a very big dependency :-(
Random
,
Random
,
Serialization
,
Serialization
,
StableRNGs
,
StableRNGs
,
...
@@ -34,13 +35,11 @@ using
...
@@ -34,13 +35,11 @@ using
## Packages that may be useful later on:
## Packages that may be useful later on:
# MacroTools, http://fluxml.ai/MacroTools.jl/stable/utilities/
# MacroTools, http://fluxml.ai/MacroTools.jl/stable/utilities/
# Debugger, https://github.com/JuliaDebug/Debugger.jl
# Debugger, https://github.com/JuliaDebug/Debugger.jl
# Makie, https://docs.makie.org/stable/
# PackageCompiler, https://julialang.github.io/PackageCompiler.jl/stable/
# PackageCompiler, https://julialang.github.io/PackageCompiler.jl/stable/
# SpatialEcology, https://github.com/EcoJulia/SpatialEcology.jl
# SpatialEcology, https://github.com/EcoJulia/SpatialEcology.jl
# OmniScape, https://circuitscape.org/
# OmniScape, https://circuitscape.org/
# PlantSimEngine, https://virtualplantlab.github.io/PlantSimEngine.jl/stable/
# PlantSimEngine, https://virtualplantlab.github.io/PlantSimEngine.jl/stable/
# Overseer, https://juliapackages.com/p/overseer -> ECS
# Overseer, https://juliapackages.com/p/overseer -> ECS
# QML, https://juliapackages.com/p/qml
## define exported functions and variables
## define exported functions and variables
export
export
...
...
This diff is collapsed.
Click to expand it.
src/analysis/makieplots.jl
+
3
−
2
View file @
26eb0dd5
...
@@ -22,10 +22,11 @@ function visualisemap(model::AgentBasedModel, date::Union{Date,Nothing}=nothing)
...
@@ -22,10 +22,11 @@ function visualisemap(model::AgentBasedModel, date::Union{Date,Nothing}=nothing)
image!
(
f
[
1
,
1
],
rotr90
(
landcover
))
image!
(
f
[
1
,
1
],
rotr90
(
landcover
))
ax
.
aspect
=
DataAspect
()
ax
.
aspect
=
DataAspect
()
# plot individuals
# plot individuals
#FIXME this function displays the individuals in a different location than the
# R script does - somewhere, I'm confusing coordinates...
for
s
in
unique
(
inds
.
Species
)
for
s
in
unique
(
inds
.
Species
)
points
=
@select
!
(
@subset
(
inds
,
:
Species
.==
s
,
:
Date
.==
date
),
:
X
,
:
Y
)
points
=
@select
!
(
@subset
(
inds
,
:
Species
.==
s
,
:
Date
.==
date
),
:
X
,
:
Y
)
# The origin in Makie is in the bottom-left rather than in the top-left as
# on the model map, so we have to invert the Y coordinates
@transform
!
(
points
,
:
Y
=
size
(
model
.
landscape
)[
2
]
.-
:
Y
)
scatter!
(
f
[
1
,
1
],
Matrix
{
Float32
}(
points
),
markersize
=
10
)
scatter!
(
f
[
1
,
1
],
Matrix
{
Float32
}(
points
),
markersize
=
10
)
end
end
f
f
...
...
This diff is collapsed.
Click to expand it.
src/core/input.jl
+
8
−
4
View file @
26eb0dd5
...
@@ -13,6 +13,9 @@ const PARAMFILE = joinpath(pkgdir(Persefone), "src/parameters.toml")
...
@@ -13,6 +13,9 @@ const PARAMFILE = joinpath(pkgdir(Persefone), "src/parameters.toml")
## (DO NOT CHANGE THIS VALUE! Instead, specify simulation-specific configuration files
## (DO NOT CHANGE THIS VALUE! Instead, specify simulation-specific configuration files
## by using the "--configfile" commandline argument, or when invoking simulate().)
## by using the "--configfile" commandline argument, or when invoking simulate().)
#XXX do I need to use absolute paths for all input files in case working dir is changed?
# (can be done with `joinpath(dirname(@__FILE__), <filename>)` )
"""
"""
@param(domainparam)
@param(domainparam)
...
@@ -174,12 +177,11 @@ end
...
@@ -174,12 +177,11 @@ end
"""
"""
loadmodelobject(fullfilename)
loadmodelobject(fullfilename)
Serialise a model object and save it to file for later reference.
Deserialise a model object that was previously saved with `[savemodelobject](@ref)`.
Includes the current model and Julia versions for compatibility checking.
"""
"""
function
loadmodelobject
(
fullfilename
::
String
)
function
loadmodelobject
(
fullfilename
::
String
)
object
=
deserialize
(
fullfilename
)
object
=
deserialize
(
fullfilename
)
# Do basic integrity checks
if
!
(
typeof
(
object
)
<:
Dict
&&
typeof
(
object
[
"model"
])
<:
AgentBasedModel
)
if
!
(
typeof
(
object
)
<:
Dict
&&
typeof
(
object
[
"model"
])
<:
AgentBasedModel
)
@warn
"This file does not contain a model object. Loading failed."
@warn
"This file does not contain a model object. Loading failed."
return
return
...
@@ -189,6 +191,8 @@ function loadmodelobject(fullfilename::String)
...
@@ -189,6 +191,8 @@ function loadmodelobject(fullfilename::String)
@warn
"This model object was saved with a different version of Persefone or Julia. It may be incompatible."
@warn
"This model object was saved with a different version of Persefone or Julia. It may be incompatible."
end
end
model
=
object
[
"model"
]
model
=
object
[
"model"
]
model
.
logger
=
modellogger
(
@param
(
core
.
loglevel
),
@param
(
core
.
outdir
))
#reset logger
# Reset the logger
!
isdir
(
@param
(
core
.
outdir
))
&&
mkpath
(
@param
(
core
.
outdir
))
model
.
logger
=
modellogger
(
@param
(
core
.
loglevel
),
@param
(
core
.
outdir
))
model
model
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment