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

Created `[world]` settings section

parent 71800e6b
No related branches found
No related tags found
No related merge requests found
......@@ -74,7 +74,9 @@ export
## b references something from file a, it must be included later)
include("core/input.jl")
include("core/output.jl")
include("core/landscape.jl")
include("world/landscape.jl")
include("world/weather.jl")
include("farm/farm.jl")
include("crop/crops.jl")
......
......@@ -143,7 +143,7 @@ function parsecommandline()
versionstring = """
Persefone $(pkgversion(Persefone))
© 2022-2023 Daniel Vedder, Lea Kolb (MIT license)
https://git.idiv.de/xo30xoqa/persephone
https://git.idiv.de/xo30xoqa/persefone
"""
s = ArgParseSettings(add_version=true, version=versionstring)
@add_arg_table! s begin
......
......@@ -88,8 +88,8 @@ function saveinputfiles(model::AgentBasedModel)
TOML.print(f, prepareTOML(model.settings))
end
# Copy the map files to the output folder
lcmap = @param(core.landcovermap)
ffmap = @param(core.farmfieldsmap)
lcmap = @param(world.landcovermap)
ffmap = @param(world.farmfieldsmap)
#TODO replace errors with exceptions
!(isfile(lcmap)) && Base.error("The map file $(lcmap) doesn't exist.")
!(isfile(ffmap)) && Base.error("The map file $(ffmap) doesn't exist.")
......
......@@ -64,7 +64,7 @@ function initmodel(settings::Dict{String, Any})
with_logger(logger) do
events = Vector{FarmEvent}()
dataoutputs = Vector{DataOutput}()
landscape = initlandscape(settings["core.landcovermap"], settings["core.farmfieldsmap"])
landscape = initlandscape(settings["world.landcovermap"], settings["world.farmfieldsmap"])
space = GridSpace(size(landscape), periodic=false)
properties = Dict{Symbol,Any}(:settings=>settings,
:logger=>logger,
......
......@@ -8,8 +8,6 @@
[core]
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", "warn"
......@@ -20,6 +18,10 @@ startdate = 2022-01-01
#enddate = 2022-03-31
enddate = 2022-12-31
[world]
landcovermap = "data/landcover_jena.tif" # location of the landcover map
farmfieldsmap = "data/fields_jena.tif" # location of the field geometry map
[farm]
farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented)
......
......@@ -27,8 +27,8 @@ end
@test_logs((:debug, "Setting up output directory results_testsuite."),
min_level=Logging.Debug, match_mode=:any,
Ps.saveinputfiles(model))
@test isfile(joinpath(outdir, @param(core.landcovermap)))
@test isfile(joinpath(outdir, @param(core.farmfieldsmap)))
@test isfile(joinpath(outdir, @param(world.landcovermap)))
@test isfile(joinpath(outdir, @param(world.farmfieldsmap)))
@test isfile(joinpath(outdir, @param(core.configfile)))
@test isfile(joinpath(outdir, Ps.LOGFILE))
# check whether the overwrite warning/protection works
......
......@@ -5,8 +5,8 @@
@testset "Landscape initialisation" begin
# initialise the landscape part of the model
landscape = Ps.initlandscape(TESTSETTINGS["core.landcovermap"],
TESTSETTINGS["core.farmfieldsmap"])
landscape = Ps.initlandscape(TESTSETTINGS["world.landcovermap"],
TESTSETTINGS["world.farmfieldsmap"])
space = GridSpace(size(landscape), periodic=false)
properties = Dict{Symbol,Any}(:landscape=>landscape, :settings=>TESTSETTINGS)
model = AgentBasedModel(FarmPlot, space, properties=properties, warn=false)
......
......@@ -7,8 +7,6 @@
[core]
configfile = "test/paramscan.toml" # location of the configuration file
landcovermap = "landcover_jena.tif" # location of the landcover map
farmfieldsmap = "fields_jena.tif" # location of the field geometry map
outdir = "results_test_paramscan" # location and name of the output folder
overwrite = ["ask",true] # overwrite the output directory? (true/false/"ask")
loglevel = ["warn", "info"] # verbosity level: "debug", "info", "warn"
......@@ -17,6 +15,10 @@ seed = [1,2,3] # seed value for the RNG (0 -> random value)
startdate = 2022-01-01
enddate = 2022-01-02
[world]
landcovermap = "landcover_jena.tif" # location of the landcover map
farmfieldsmap = "fields_jena.tif" # location of the field geometry map
[farm]
farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented)
......
......@@ -7,8 +7,6 @@
[core]
configfile = "test_parameters.toml" # location of the configuration file
landcovermap = "landcover_jena.tif" # location of the landcover map
farmfieldsmap = "fields_jena.tif" # location of the field geometry map
outdir = "results_testsuite" # location and name of the output folder
overwrite = true # overwrite the output directory? (true/false/"ask")
loglevel = "warn" # verbosity level: "debug", "info", "warn"
......@@ -18,6 +16,10 @@ seed = 1 # seed value for the RNG (0 -> random value)
startdate = 2022-02-01
enddate = 2022-03-31
[world]
landcovermap = "landcover_jena.tif" # location of the landcover map
farmfieldsmap = "fields_jena.tif" # location of the field geometry map
[farm]
farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment