diff --git a/docs/src/index.md b/docs/src/index.md index 599b07afff4f808b146f2513e7954cb36a60d5b2..edbaf400e2b3fc045c2e27add960cdb7f7edcf31 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -14,4 +14,4 @@ changes in farm operations (e.g. through policy changes in the CAP) influence bi The model is open-source software available on [Gitlab](https://git.idiv.de/persefone/persefone-model). -*This documentation was last updated on 2025-03-18 for **Persefone.jl v0.7.0** (commit [b1802d1](https://git.idiv.de/persefone/persefone-model/-/commit/b1802d1)).* +*This documentation was last updated on 2025-06-05 for **Persefone.jl v0.7.0** (commit [838cdff](https://git.idiv.de/persefone/persefone-model/-/commit/838cdff)).* diff --git a/src/Persefone.jl b/src/Persefone.jl index fa7be8b2a923660bd10b204c53eb8fb6dadb2fbe..c8a8c8886f48d88036700ad0f94162fb9d779a72 100644 --- a/src/Persefone.jl +++ b/src/Persefone.jl @@ -179,8 +179,9 @@ include("nature/populations.jl") include("nature/individuals.jl") include("nature/ecologicaldata.jl") include("nature/species/skylark.jl") -include("nature/species/wolpertinger.jl") -include("nature/species/wyvern.jl") +include("nature/species/marbled_white.jl") +#include("nature/species/wolpertinger.jl") +#include("nature/species/wyvern.jl") include("analysis/makieplots.jl") diff --git a/src/nature/populations.jl b/src/nature/populations.jl index 2185e4d2458a9c10a7d2e2771cc806d58d695587..9159d9fe5052ec87ae87894416b6f07ad55f742d 100644 --- a/src/nature/populations.jl +++ b/src/nature/populations.jl @@ -72,8 +72,6 @@ better testing. """ function initpopulation!(species::Type, p::PopInitParams, model::SimulationModel) #XXX this is a pretty complicated function - can we make it simpler? - (p.popsize <= 0 && p.indarea <= 0m²) && # can be legit if a habitat descriptor is provided - @warn("initpopulation!() called with popsize and indarea both <= 0") (p.popsize > 0 && p.indarea > 0m²) && #XXX not sure what this would do @warn("initpopulation!() called with popsize and indarea both > 0") # create as many individuals as necessary in the landscape @@ -94,9 +92,9 @@ function initpopulation!(species::Type, p::PopInitParams, model::SimulationModel n += initindividuals!(species, (x,y), p, model) end #XXX break randomly to avoid initialising all individuals in a single column? + # Break if a popsize was specified and has been exceeded (p.popsize > 0 && n >= p.popsize) && break end - (p.popsize > 0 && n >= p.popsize) && break end if lastn == n # prevent an infinite loop - we don't have a Cray... @warn "There are not enough suitable locations for $(speciesof(species)) in the landscape." diff --git a/src/nature/species/marbled_white.jl b/src/nature/species/marbled_white.jl index a6a93ae2aa35e7db8c971059d4621c392d5cd9a6..ab7c8d6028fb514f241a7c2a061c9034c2a87808 100644 --- a/src/nature/species/marbled_white.jl +++ b/src/nature/species/marbled_white.jl @@ -147,7 +147,7 @@ weather data. optimality = bounds(1 - (abs(opttemp-@maxtemp()) / (opttemp-self.mintemp))) stepsremaining::Int64 = Int(round(self.maxstepsperday*optimality)) eggsremaining::Int64 = self.maxeggsperday - if @maxtemp < opttemp || @maxtemp > self.maxtemp + if @maxtemp() < opttemp || @maxtemp() > self.maxtemp eggsremaining = Int(round(self.maxeggsperday*optimality)) end # movement @@ -232,9 +232,9 @@ random, but I don't have data for that.) @randn(self.pupatime), @randn(self.adulttime)] # check whether eclosure is during the flight period, change the larval time if not if self.enforceflyingperiod - eclose = birthdate + Day(sum(self.daysinphase)) + eclose = self.birthdate + Day(sum(self.daysinphase)) if eclose < self.earliesteclosure - diff = self.earliesteclosure - eclose + diff = @thisyear(self.earliesteclosure) - eclose self.daysinphase[2] += diff.value @debug("Increased larval time by $(diff) to stay in flying period.") elseif eclose > self.latesteclosure diff --git a/src/parameters.toml b/src/parameters.toml index 1b7d4201b3460daf34f6b674cda7bee31fb0da93..e220ef22d07d74063763300526efa8a2d0aca59d 100644 --- a/src/parameters.toml +++ b/src/parameters.toml @@ -38,7 +38,7 @@ fieldoutfreq = "daily" # output frequency for crop/field data, daily/monthly/yea [nature] #targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate - example species #targetspecies = [] # XXX disable all species for farm model testing -targetspecies = ["Skylark"] # list of target species to simulate +targetspecies = ["MarbledWhite"] #["Skylark"] # list of target species to simulate #popoutfreq = "never" # output frequency population-level data, daily/monthly/yearly/end/never #indoutfreq = "never" # output frequency individual-level data, daily/monthly/yearly/end/never popoutfreq = "daily" # output frequency population-level data, daily/monthly/yearly/end/never diff --git a/src/world/weather.jl b/src/world/weather.jl index 622c63fc347ea305b71e496be1d0f8740a614beb..133c3dfdfff781513835b0fb341ecb5dc6661fb6 100644 --- a/src/world/weather.jl +++ b/src/world/weather.jl @@ -141,8 +141,8 @@ end Return the average windspeed in m/s on `date`. """ windspeed(weather::Weather, date::Date) = weather.windspeed[daynumber(weather, date)] -windspeed(model::AgricultureModel, date::Date) = windspeed(model.weather, date) -windspeed(model::AgricultureModel) = windspeed(model, model.date) +windspeed(model::SimulationModel, date::Date) = windspeed(model.weather, date) +windspeed(model::SimulationModel) = windspeed(model, model.date) """ precipitation(weather, date) @@ -152,8 +152,8 @@ windspeed(model::AgricultureModel) = windspeed(model, model.date) Return the total precipitation in mm on `date`. """ precipitation(weather::Weather, date::Date) = weather.precipitation[daynumber(weather, date)] -precipitation(model::AgricultureModel, date::Date) = precipitation(model.weather, date) -precipitation(model::AgricultureModel) = precipitation(model, model.date) +precipitation(model::SimulationModel, date::Date) = precipitation(model.weather, date) +precipitation(model::SimulationModel) = precipitation(model, model.date) """ sunshine(weather, date) @@ -163,8 +163,8 @@ precipitation(model::AgricultureModel) = precipitation(model, model.date) Return the sunshine duration in hours on `date`. """ sunshine(weather::Weather, date::Date) = weather.sunshine[daynumber(weather, date)] -sunshine(model::AgricultureModel, date::Date) = sunshine(model.weather, date) -sunshine(model::AgricultureModel) = sunshine(model, model.date) +sunshine(model::SimulationModel, date::Date) = sunshine(model.weather, date) +sunshine(model::SimulationModel) = sunshine(model, model.date) """ cloudcover(weather, date) @@ -174,8 +174,8 @@ sunshine(model::AgricultureModel) = sunshine(model, model.date) Return the average cloudcover in eigths on `date`. """ cloudcover(weather::Weather, date::Date) = weather.cloudcover[daynumber(weather, date)] -cloudcover(model::AgricultureModel, date::Date) = cloudcover(model.weather, date) -cloudcover(model::AgricultureModel) = cloudcover(model, model.date) +cloudcover(model::SimulationModel, date::Date) = cloudcover(model.weather, date) +cloudcover(model::SimulationModel) = cloudcover(model, model.date) """ humidity(weather, date) @@ -185,8 +185,8 @@ cloudcover(model::AgricultureModel) = cloudcover(model, model.date) Return today's average vapour pressure in %. """ humidity(weather::Weather, date::Date) = weather.humidity[daynumber(weather, date)] -humidity(model::AgricultureModel, date::Date) = humidity(model.weather, date) -humidity(model::AgricultureModel) = humidity(model, model.date) +humidity(model::SimulationModel, date::Date) = humidity(model.weather, date) +humidity(model::SimulationModel) = humidity(model, model.date) """ meantemp(weather, date) @@ -196,8 +196,8 @@ humidity(model::AgricultureModel) = humidity(model, model.date) Return the mean temperature in °C on `date`. """ meantemp(weather::Weather, date::Date) = weather.meantemp[daynumber(weather, date)] -meantemp(model::AgricultureModel, date::Date) = meantemp(model.weather, date) -meantemp(model::AgricultureModel) = meantemp(model, model.date) +meantemp(model::SimulationModel, date::Date) = meantemp(model.weather, date) +meantemp(model::SimulationModel) = meantemp(model, model.date) """ maxtemp(weather, date) @@ -207,8 +207,8 @@ meantemp(model::AgricultureModel) = meantemp(model, model.date) Return the maximum temperature in °C on `date`. """ maxtemp(weather::Weather, date::Date) = weather.maxtemp[daynumber(weather, date)] -maxtemp(model::AgricultureModel, date::Date) = maxtemp(model.weather, date) -maxtemp(model::AgricultureModel) = maxtemp(model, model.date) +maxtemp(model::SimulationModel, date::Date) = maxtemp(model.weather, date) +maxtemp(model::SimulationModel) = maxtemp(model, model.date) """ mintemp(weather, date) @@ -218,8 +218,8 @@ maxtemp(model::AgricultureModel) = maxtemp(model, model.date) Return the minimum temperature in °C on `date`. """ mintemp(weather::Weather, date::Date) = weather.mintemp[daynumber(weather, date)] -mintemp(model::AgricultureModel, date::Date) = mintemp(model.weather, date) -mintemp(model::AgricultureModel) = mintemp(model, model.date) +mintemp(model::SimulationModel, date::Date) = mintemp(model.weather, date) +mintemp(model::SimulationModel) = mintemp(model, model.date) """ evapotranspiration(weather, date) @@ -229,5 +229,5 @@ mintemp(model::AgricultureModel) = mintemp(model, model.date) Return the potential evapotranspiration (ETo) on `date`. """ evapotranspiration(weather::Weather, date::Date) = weather.evapotranspiration[daynumber(weather, date)] -evapotranspiration(model::AgricultureModel, date::Date) = evapotranspiration(model.weather, date) -evapotranspiration(model::AgricultureModel) = evapotranspiration(model, model.date) +evapotranspiration(model::SimulationModel, date::Date) = evapotranspiration(model.weather, date) +evapotranspiration(model::SimulationModel) = evapotranspiration(model, model.date)