diff --git a/src/Persefone.jl b/src/Persefone.jl index c24905440d3209c3bbd93906b2455e3b74b5fefe..65c3b2937d39821ba84bfc42cd774349daa07474 100644 --- a/src/Persefone.jl +++ b/src/Persefone.jl @@ -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") diff --git a/src/core/input.jl b/src/core/input.jl index f34ff04f364877e82b1c2ebcb2940236f3851cca..b08dc61db6311fc0561bc603b5190cc259a2d4ea 100644 --- a/src/core/input.jl +++ b/src/core/input.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 diff --git a/src/core/output.jl b/src/core/output.jl index 74b5b4700da7f07f1501bb749ae3e11e6c1aba14..9dea302eb32bc9ec8532f118c86fd24b6aef01b4 100644 --- a/src/core/output.jl +++ b/src/core/output.jl @@ -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.") diff --git a/src/core/simulation.jl b/src/core/simulation.jl index 3ee9f0e6f309010a9cbd704261ecfdb60e8ab638..18c0dd03d55048fe21b1714185ce937be04c1af3 100644 --- a/src/core/simulation.jl +++ b/src/core/simulation.jl @@ -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, diff --git a/src/parameters.toml b/src/parameters.toml index d1e3db247c2ad8f8a3c2010e86a60b8fb43bf338..4e888a4a9fa28abb1999209f3d4f42c709a8fb51 100644 --- a/src/parameters.toml +++ b/src/parameters.toml @@ -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) diff --git a/test/io_tests.jl b/test/io_tests.jl index fb8c17d388861df11fb8bab8a738cc849ccd08f3..66c17185d4f0ec93b83d65a07efdbd5975615f7f 100644 --- a/test/io_tests.jl +++ b/test/io_tests.jl @@ -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 diff --git a/test/landscape_tests.jl b/test/landscape_tests.jl index fb97af09fa07b1cbde704eaa05dd3a193ce0db59..2f4ceeb32be1a5a2cb9f2e529bb0740c84a32688 100644 --- a/test/landscape_tests.jl +++ b/test/landscape_tests.jl @@ -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) diff --git a/test/paramscan.toml b/test/paramscan.toml index 045ed418f868e88c141955e95130378c1b585c23..a5c08c4fd9e45e56a08fb7a0e5ac6346f585039f 100644 --- a/test/paramscan.toml +++ b/test/paramscan.toml @@ -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) diff --git a/test/test_parameters.toml b/test/test_parameters.toml index 2b2dfbee4ac5dd78e3e4241582c91a7e5bbd42d9..f4cc679068ae61e9bfe67621a2d21b80d5b63cd0 100644 --- a/test/test_parameters.toml +++ b/test/test_parameters.toml @@ -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)