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
3a702e24
Commit
3a702e24
authored
2 years ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Added "core.overwrite" parameter
parent
0874ec32
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/Persephone.jl
+0
-3
0 additions, 3 deletions
src/Persephone.jl
src/core/input.jl
+5
-2
5 additions, 2 deletions
src/core/input.jl
src/core/output.jl
+14
-7
14 additions, 7 deletions
src/core/output.jl
src/parameters.toml
+1
-0
1 addition, 0 deletions
src/parameters.toml
with
20 additions
and
12 deletions
src/Persephone.jl
+
0
−
3
View file @
3a702e24
...
...
@@ -25,12 +25,9 @@ using
## define exported functions and variables
export
#types
LandCover
,
EventType
,
Pixel
,
FarmEvent
,
FarmPlot
,
Sex
,
Animal
,
Farmer
,
#functions
...
...
This diff is collapsed.
Click to expand it.
src/core/input.jl
+
5
−
2
View file @
3a702e24
...
...
@@ -9,8 +9,11 @@
##XXX Does it make sense to move the settings dict into the model object itself?
## (It could be integrated into the properties dict.) Advantage: we have less
## global state lying around, and serialising becomes easier (if we want to do
## that). Disadvantage: only functions that have access to the model object can
## access the settings - this may give problems during initialisation.
## that). Also, during testing we often need to change individual parameters,
## which is currently impossible. Disadvantage: immutability of parameters at
## runtime is intended, and some start-up functions may have problems if they need
## access to parameters before the model object has been created.
##TODO -> yes, changing this is probably sensible
let
settings
::
Dict
{
String
,
Dict
{
String
,
Any
}}
"""
initsettings(configfile)
...
...
This diff is collapsed.
Click to expand it.
src/core/output.jl
+
14
−
7
View file @
3a702e24
...
...
@@ -16,14 +16,21 @@ Creates the output directory and copies relevant files into it.
function
setupdatadir
()
# Check whether the output directory already exists and handle conflicts
if
isdir
(
param
(
"core.outdir"
))
@warn
"The chosen output directory
$
(param("
core
.
outdir
")) already exists."
println
(
"Type 'yes' to overwrite this directory. Otherwise, the simulation will abort."
)
print
(
"Overwrite? "
)
answer
=
readline
()
(
answer
!=
"yes"
)
&&
Base
.
error
(
"Output directory exists, will not overwrite. Aborting."
)
else
mkpath
(
param
(
"core.outdir"
))
overwrite
=
param
(
"core.overwrite"
)
if
param
(
"core.overwrite"
)
==
"ask"
println
(
"The chosen output directory
$
(param("
core
.
outdir
")) already exists."
)
println
(
"Type 'yes' to overwrite this directory. Otherwise, the simulation will abort."
)
print
(
"Overwrite? "
)
answer
=
readline
()
(
answer
==
"yes"
)
&&
(
overwrite
=
true
)
end
if
!
overwrite
Base
.
error
(
"Output directory exists, will not overwrite. Aborting."
)
else
@warn
"Overwriting existing output directory
$
(param("
core
.
outdir
"))."
end
end
mkpath
(
param
(
"core.outdir"
))
# Setup the logging system and logfile
loglevel
=
Logging
.
Info
if
param
(
"core.loglevel"
)
==
"debug"
...
...
This diff is collapsed.
Click to expand it.
src/parameters.toml
+
1
−
0
View file @
3a702e24
...
...
@@ -11,6 +11,7 @@ configfile = "src/parameters.toml" # location of the configuration file
landcovermap
=
"data/landcover_jena.tif"
# location of the landcover map
farmfieldsmap
=
"data/fields_jena.tif"
# location of the field geometry map
outdir
=
"results"
# location and name of the output folder
overwrite
=
"ask"
# overwrite the output directory? (true/false/"ask")
loglevel
=
"debug"
# verbosity level: "debug", "info", "quiet"
seed
=
0
# seed value for the RNG (0 -> random value)
# dates to start and end the simulation
...
...
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