diff --git a/docs/build/.documenter-siteinfo.json b/docs/build/.documenter-siteinfo.json index 756eba050d5d8ccaf2e4a5c14d8c34e45c7f5599..f002e692d4aba98f85a03d1152ae913b739207ad 100644 --- a/docs/build/.documenter-siteinfo.json +++ b/docs/build/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-16T13:54:11","documenter_version":"1.1.2"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-30T11:45:36","documenter_version":"1.1.2"}} \ No newline at end of file diff --git a/docs/build/CHANGELOG.html b/docs/build/CHANGELOG.html new file mode 100644 index 0000000000000000000000000000000000000000..f392c56d6b15910aa7b50d14fd6d0b20cc550e4d --- /dev/null +++ b/docs/build/CHANGELOG.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Changelog · Persefone.jl</title><meta name="title" content="Changelog · Persefone.jl"/><meta property="og:title" content="Changelog · Persefone.jl"/><meta property="twitter:title" content="Changelog · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li class="is-active"><a class="tocitem" href="CHANGELOG.html">Changelog</a><ul class="internal"><li><a class="tocitem" href="#[1.0.0]-in-planning"><span>[1.0.0] - in planning</span></a></li><li><a class="tocitem" href="#[0.6.0]-in-planning"><span>[0.6.0] - in planning</span></a></li><li><a class="tocitem" href="#[0.5.4]-in-planning"><span>[0.5.4] - in planning</span></a></li><li><a class="tocitem" href="#[0.5.3]-unreleased"><span>[0.5.3] - unreleased</span></a></li><li><a class="tocitem" href="#[0.5.2]-30-07-2024"><span>[0.5.2] - 30-07-2024</span></a></li><li><a class="tocitem" href="#[0.5.1]-13-06-2024"><span>[0.5.1] - 13-06-2024</span></a></li><li><a class="tocitem" href="#[0.5.0]-07-06-2024"><span>[0.5.0] - 07-06-2024</span></a></li><li><a class="tocitem" href="#[0.4.1]-2023-11-14"><span>[0.4.1] - 2023-11-14</span></a></li><li><a class="tocitem" href="#[0.4.0]-2023-10-28"><span>[0.4.0] - 2023-10-28</span></a></li><li><a class="tocitem" href="#[version]-unreleased"><span>[version] - unreleased</span></a></li></ul></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="CHANGELOG.html">Changelog</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="CHANGELOG.html">Changelog</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/CHANGELOG.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Changelog"><a class="docs-heading-anchor" href="#Changelog">Changelog</a><a id="Changelog-1"></a><a class="docs-heading-anchor-permalink" href="#Changelog" title="Permalink"></a></h1><p>All notable changes to this project will be documented in this file.</p><p>The format is based on <a href="https://keepachangelog.com/en/1.1.0/">Keep a Changelog</a>, and this project adheres to <a href="https://semver.org/spec/v2.0.0.html">Semantic Versioning</a>.</p><h2 id="[1.0.0]-in-planning"><a class="docs-heading-anchor" href="#[1.0.0]-in-planning">[1.0.0] - in planning</a><a id="[1.0.0]-in-planning-1"></a><a class="docs-heading-anchor-permalink" href="#[1.0.0]-in-planning" title="Permalink"></a></h2><p><em>Aim: 3 species, 2 crop growth models, farm model, GAEC scenarios, experimental analysis</em></p><h2 id="[0.6.0]-in-planning"><a class="docs-heading-anchor" href="#[0.6.0]-in-planning">[0.6.0] - in planning</a><a id="[0.6.0]-in-planning-1"></a><a class="docs-heading-anchor-permalink" href="#[0.6.0]-in-planning" title="Permalink"></a></h2><p><em>Plan: integrate AquaCrop (#79), set up first experiments</em></p><hr/><h2 id="[0.5.4]-in-planning"><a class="docs-heading-anchor" href="#[0.5.4]-in-planning">[0.5.4] - in planning</a><a id="[0.5.4]-in-planning-1"></a><a class="docs-heading-anchor-permalink" href="#[0.5.4]-in-planning" title="Permalink"></a></h2><p><em>Plan: basic farm model (#16), decouple CairoMakie (#81), test Skylark model (#96, #97)</em></p><h2 id="[0.5.3]-unreleased"><a class="docs-heading-anchor" href="#[0.5.3]-unreleased">[0.5.3] - unreleased</a><a id="[0.5.3]-unreleased-1"></a><a class="docs-heading-anchor-permalink" href="#[0.5.3]-unreleased" title="Permalink"></a></h2><p><em>Plan: code restructuring to allow multiple crop models (#70)</em></p><h3 id="Added"><a class="docs-heading-anchor" href="#Added">Added</a><a id="Added-1"></a><a class="docs-heading-anchor-permalink" href="#Added" title="Permalink"></a></h3><h3 id="Changed"><a class="docs-heading-anchor" href="#Changed">Changed</a><a id="Changed-1"></a><a class="docs-heading-anchor-permalink" href="#Changed" title="Permalink"></a></h3><h3 id="Deprecated"><a class="docs-heading-anchor" href="#Deprecated">Deprecated</a><a id="Deprecated-1"></a><a class="docs-heading-anchor-permalink" href="#Deprecated" title="Permalink"></a></h3><h3 id="Removed"><a class="docs-heading-anchor" href="#Removed">Removed</a><a id="Removed-1"></a><a class="docs-heading-anchor-permalink" href="#Removed" title="Permalink"></a></h3><h3 id="Fixed"><a class="docs-heading-anchor" href="#Fixed">Fixed</a><a id="Fixed-1"></a><a class="docs-heading-anchor-permalink" href="#Fixed" title="Permalink"></a></h3><h2 id="[0.5.2]-30-07-2024"><a class="docs-heading-anchor" href="#[0.5.2]-30-07-2024">[0.5.2] - 30-07-2024</a><a id="[0.5.2]-30-07-2024-1"></a><a class="docs-heading-anchor-permalink" href="#[0.5.2]-30-07-2024" title="Permalink"></a></h2><p><strong>Rewrote the skylark model</strong></p><h3 id="Added-2"><a class="docs-heading-anchor" href="#Added-2">Added</a><a class="docs-heading-anchor-permalink" href="#Added-2" title="Permalink"></a></h3><ul><li><p>Skylark model is largely rewritten to follow a new phase structure (#9)</p></li><li><p>animals can occupy territories (see <code>@occupy</code>, <code>@isoccupied</code>, <code>@vacate</code> macros/functions) (#94)</p></li><li><p><code>@cropcover</code> macro and function</p></li><li><p>ODD documentation for Skylark</p></li></ul><h3 id="Changed-2"><a class="docs-heading-anchor" href="#Changed-2">Changed</a><a class="docs-heading-anchor-permalink" href="#Changed-2" title="Permalink"></a></h3><ul><li><p>input files that are now copied to a separate <code>inputs</code> directory within the output directory</p></li><li><p><code>EventType</code> renamed to <code>Management</code> for clarity</p></li><li><p>documentation website now has a "Scientific Documentation" section</p></li></ul><h3 id="Removed-2"><a class="docs-heading-anchor" href="#Removed-2">Removed</a><a class="docs-heading-anchor-permalink" href="#Removed-2" title="Permalink"></a></h3><ul><li>old skylark model (has been rewritten, see above)</li></ul><h3 id="Fixed-2"><a class="docs-heading-anchor" href="#Fixed-2">Fixed</a><a class="docs-heading-anchor-permalink" href="#Fixed-2" title="Permalink"></a></h3><ul><li><p>all skylarks now migrate (#90)</p></li><li><p><code>insectbiomass()</code> uses units</p></li></ul><h2 id="[0.5.1]-13-06-2024"><a class="docs-heading-anchor" href="#[0.5.1]-13-06-2024">[0.5.1] - 13-06-2024</a><a id="[0.5.1]-13-06-2024-1"></a><a class="docs-heading-anchor-permalink" href="#[0.5.1]-13-06-2024" title="Permalink"></a></h2><p><strong>Added Unitful.jl</strong></p><h3 id="Added-3"><a class="docs-heading-anchor" href="#Added-3">Added</a><a class="docs-heading-anchor-permalink" href="#Added-3" title="Permalink"></a></h3><ul><li><p>Unitful.jl now used to add units to quantities</p></li><li><p><code>world.mapdirectory</code> parameter specifies the path to the directory in which</p></li></ul><p><code>landcovermap</code>, <code>farmfieldsmap</code>, and <code>weatherfile</code> are located</p><ul><li><code>world.mapresolution</code> parameter specifies the input maps' spatial resolution in meters</li></ul><h3 id="Changed-3"><a class="docs-heading-anchor" href="#Changed-3">Changed</a><a class="docs-heading-anchor-permalink" href="#Changed-3" title="Permalink"></a></h3><ul><li><p>spatial functions now work with explicit distances (using Unitful.jl) rather than using the number of pixels</p></li><li><p>all species definitions and tests updated to use units</p></li></ul><hr/><h2 id="[0.5.0]-07-06-2024"><a class="docs-heading-anchor" href="#[0.5.0]-07-06-2024">[0.5.0] - 07-06-2024</a><a id="[0.5.0]-07-06-2024-1"></a><a class="docs-heading-anchor-permalink" href="#[0.5.0]-07-06-2024" title="Permalink"></a></h2><p><strong>This release doesn't add much new functionality, but represents a major restructuring of the code base. Specifically, it removes the Agents.jl dependency and changes the way the species definition macros work and are used.</strong></p><h3 id="Added-4"><a class="docs-heading-anchor" href="#Added-4">Added</a><a class="docs-heading-anchor-permalink" href="#Added-4" title="Permalink"></a></h3><ul><li><p><code>SimulationModel</code> type, extended by <code>AgricultureModel</code> struct</p></li><li><p><code>@create</code> macro defines a special phase function that is called when an individual animal is created (at birth or on model initialisation)</p></li><li><p>functions (and associated macros) to replace Agents.jl functionality:</p><ul><li><code>move!()</code> and <code>walk!()</code> </li><li><code>nearby_ids()</code>, <code>nearby_animals()</code>, <code>countanimals()</code>, <code>neighbours()</code></li><li><code>directionto()</code>, <code>distanceto()</code>, <code>randomdirection()</code></li><li><code>nagents()</code>, <code>killallanimals!()</code></li></ul></li><li><p><code>@here</code> macro to return the pixel currently occupied by the active animal</p></li><li><p><code>core.logoutput</code> parameter to define whether logs are printed to screen, file, none, or both</p></li><li><p>large logo and model structure diagram</p></li><li><p>Changelog</p></li></ul><h3 id="Changed-4"><a class="docs-heading-anchor" href="#Changed-4">Changed</a><a class="docs-heading-anchor-permalink" href="#Changed-4" title="Permalink"></a></h3><ul><li><p><code>SimulationModel</code> replaces <code>AgentBasedModel</code></p></li><li><p>Species definition macros revamped:</p><ul><li><code>@species</code> now only defines parameters and variables and creates a mutable struct</li><li><code>@phase</code> must now be defined in the top-level code and creates a global function</li><li><code>@initialise</code> renamed to <code>@populate</code>, must also be called in the top-level code</li><li><code>initindividual()</code> renamed to <code>create!()</code></li></ul></li><li><p>Skylark, Wolpertinger, and Wyvern updated to match the new macros</p></li><li><p>requires Julia 1.10</p></li></ul><h3 id="Removed-3"><a class="docs-heading-anchor" href="#Removed-3">Removed</a><a class="docs-heading-anchor-permalink" href="#Removed-3" title="Permalink"></a></h3><ul><li>Agents.jl dependency (including <code>AgentBasedModel</code> and functions for adding/moving/removing agents)</li></ul><hr/><h2 id="[0.4.1]-2023-11-14"><a class="docs-heading-anchor" href="#[0.4.1]-2023-11-14">[0.4.1] - 2023-11-14</a><a id="[0.4.1]-2023-11-14-1"></a><a class="docs-heading-anchor-permalink" href="#[0.4.1]-2023-11-14" title="Permalink"></a></h2><p><strong>Initial version of the skylark model</strong></p><h3 id="Added-5"><a class="docs-heading-anchor" href="#Added-5">Added</a><a class="docs-heading-anchor-permalink" href="#Added-5" title="Permalink"></a></h3><ul><li><p>initial version of the Skylark species</p></li><li><p>small Jena map</p></li><li><p>animal individuals keep track of their parents' IDs</p></li><li><p>several new functions and macros for animals</p></li><li><p>installation instructions for Windows</p></li></ul><h3 id="Changed-5"><a class="docs-heading-anchor" href="#Changed-5">Changed</a><a class="docs-heading-anchor-permalink" href="#Changed-5" title="Permalink"></a></h3><ul><li>graphics output is more configurable</li></ul><h2 id="[0.4.0]-2023-10-28"><a class="docs-heading-anchor" href="#[0.4.0]-2023-10-28">[0.4.0] - 2023-10-28</a><a id="[0.4.0]-2023-10-28-1"></a><a class="docs-heading-anchor-permalink" href="#[0.4.0]-2023-10-28" title="Permalink"></a></h2><p><strong>Functions for animal populations</strong></p><h3 id="Added-6"><a class="docs-heading-anchor" href="#Added-6">Added</a><a class="docs-heading-anchor-permalink" href="#Added-6" title="Permalink"></a></h3><ul><li><p>initialisation functions for individuals (not just species)</p></li><li><p>migration function / migrant pool for animals that disappear from the landscape during winter</p></li><li><p>skylark migration</p></li></ul><h3 id="Changed-6"><a class="docs-heading-anchor" href="#Changed-6">Changed</a><a class="docs-heading-anchor-permalink" href="#Changed-6" title="Permalink"></a></h3><ul><li><p>online documentation was expanded and restructured</p></li><li><p>nature macros moved to a separate file</p></li></ul><p><em>Started changelog at this point, earlier versions are not included.</em></p><p><!– Template</p><h2 id="[version]-unreleased"><a class="docs-heading-anchor" href="#[version]-unreleased">[version] - unreleased</a><a id="[version]-unreleased-1"></a><a class="docs-heading-anchor-permalink" href="#[version]-unreleased" title="Permalink"></a></h2><p><comments></p><h3 id="*PLANNED*"><a class="docs-heading-anchor" href="#*PLANNED*"><em>PLANNED</em></a><a id="*PLANNED*-1"></a><a class="docs-heading-anchor-permalink" href="#*PLANNED*" title="Permalink"></a></h3><h3 id="Added-7"><a class="docs-heading-anchor" href="#Added-7">Added</a><a class="docs-heading-anchor-permalink" href="#Added-7" title="Permalink"></a></h3><h3 id="Changed-7"><a class="docs-heading-anchor" href="#Changed-7">Changed</a><a class="docs-heading-anchor-permalink" href="#Changed-7" title="Permalink"></a></h3><h3 id="Deprecated-2"><a class="docs-heading-anchor" href="#Deprecated-2">Deprecated</a><a class="docs-heading-anchor-permalink" href="#Deprecated-2" title="Permalink"></a></h3><h3 id="Removed-4"><a class="docs-heading-anchor" href="#Removed-4">Removed</a><a class="docs-heading-anchor-permalink" href="#Removed-4" title="Permalink"></a></h3><h3 id="Fixed-3"><a class="docs-heading-anchor" href="#Fixed-3">Fixed</a><a class="docs-heading-anchor-permalink" href="#Fixed-3" title="Permalink"></a></h3><p>–></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="species-dsl.html">« Defining new species</a><a class="docs-footer-nextpage" href="simulation.html">Simulation »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/adapting.html b/docs/build/adapting.html index b3a68e7694c243bf170f66f9eb44bc6e789d7f74..01f38766f4239a1eb9522e6f069acbaa56c5eca4 100644 --- a/docs/build/adapting.html +++ b/docs/build/adapting.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Adapting Persefone · Persefone.jl</title><meta name="title" content="Adapting Persefone · Persefone.jl"/><meta property="og:title" content="Adapting Persefone · Persefone.jl"/><meta property="twitter:title" content="Adapting Persefone · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li class="is-active"><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="adapting.html">Adapting Persefone</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="adapting.html">Adapting Persefone</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/adapting.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Adapting-Persefone"><a class="docs-heading-anchor" href="#Adapting-Persefone">Adapting Persefone</a><a id="Adapting-Persefone-1"></a><a class="docs-heading-anchor-permalink" href="#Adapting-Persefone" title="Permalink"></a></h1><p>A key development goal of Persefone is to be <a href="https://doi.org/10.1515/itit-2019-0040">FAIR</a>: <em>findable, accessible, interoperable, and reusable</em>. We aim to build a model that is both easy to use and easy to adapt to new situations.</p><p>There are multiple ways to adapt Persefone for a new modelling study:</p><h3 id="Changing-the-parameters"><a class="docs-heading-anchor" href="#Changing-the-parameters">Changing the parameters</a><a id="Changing-the-parameters-1"></a><a class="docs-heading-anchor-permalink" href="#Changing-the-parameters" title="Permalink"></a></h3><p>The simplest way to adapt Persefone is simply by changing the parameters. Copy <code>src/parameters.toml</code> to a new location, adjust it to your needs, and run the model using <code>julia run.jl -c <configfile></code>.</p><h3 id="Changing-the-region"><a class="docs-heading-anchor" href="#Changing-the-region">Changing the region</a><a id="Changing-the-region-1"></a><a class="docs-heading-anchor-permalink" href="#Changing-the-region" title="Permalink"></a></h3><p>To apply Persefone to a new region, you need to create new input maps of land cover and farmplots. How to do so is described <a href="gis.html">here</a>.</p><p><em>You may also need to change aspects of the <code>farm</code> submodel. This is not yet implemented.</em></p><h3 id="Adding-new-animal-species"><a class="docs-heading-anchor" href="#Adding-new-animal-species">Adding new animal species</a><a id="Adding-new-animal-species-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-new-animal-species" title="Permalink"></a></h3><p>To implement a new species to the <code>nature</code> submodel, add a new file to the <code>src/nature/species</code> directory and <code>include</code> it in <code>src/Persefone.jl</code>, as well as adding the name of the species to the <code>nature.targetspecies</code> parameter. In the new file, implement the species using the <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a> syntax as described <a href="species-dsl.html">here</a>.</p><h3 id="Adding-new-crop-species"><a class="docs-heading-anchor" href="#Adding-new-crop-species">Adding new crop species</a><a id="Adding-new-crop-species-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-new-crop-species" title="Permalink"></a></h3><p><em>Crop growth is not yet implemented.</em></p><h3 id="Adding-new-farmer-behaviour"><a class="docs-heading-anchor" href="#Adding-new-farmer-behaviour">Adding new farmer behaviour</a><a id="Adding-new-farmer-behaviour-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-new-farmer-behaviour" title="Permalink"></a></h3><p><em>Farmer behaviour is not yet implemented.</em></p><h3 id="Adding-a-new-submodel"><a class="docs-heading-anchor" href="#Adding-a-new-submodel">Adding a new submodel</a><a id="Adding-a-new-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-a-new-submodel" title="Permalink"></a></h3><p>To add a new submodel in addition to the existing ones (<code>nature</code>, <code>crop</code>, and <code>farm</code>), you need to familiarise yourself with the <a href="architecture.html">software architecture</a>. In particular, you need to understand how initialisation and scheduling works in <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/simulation.jl"><code>src/core/simulation.jl</code></a>, and what information is stored in the <code>model</code> object.</p><p>If you want to add a new agent type, create a subtype of <a href="simulation.html#Persefone.ModelAgent"><code>ModelAgent</code></a>, implement a <a href="@ref"><code>stepagent!</code></a> function for it and add it to <a href="simulation.html#Persefone.initmodel-Tuple{Dict{String, Any}}"><code>Persefone.initmodel</code></a>.</p><h3 id="Linking-to-another-model"><a class="docs-heading-anchor" href="#Linking-to-another-model">Linking to another model</a><a id="Linking-to-another-model-1"></a><a class="docs-heading-anchor-permalink" href="#Linking-to-another-model" title="Permalink"></a></h3><p>Persefone can also be used as a software library and be called from another application. For this purpose, it is set up as a <a href="https://pkgdocs.julialang.org/v1/">Julia package</a>, with a <a href="https://docs.julialang.org/en/v1/manual/modules/">module</a> exporting various model functions, types, and macros (see <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/Persephone.jl"><code>src/Persefone.jl</code></a>). Of particular interest are the functions <a href="simulation.html#Persefone.simulate"><code>simulate</code></a> (set up and run a complete simulation based on a config file), <a href="simulation.html#Persefone.initialise"><code>initialise</code></a> (create one or more <code>model</code> objects from a config file), <a href="simulation.html#Persefone.simulate!-Tuple{SimulationModel}"><code>simulate!</code></a> (do a simulation run with an existing <code>model</code> object), and <a href="simulation.html#Persefone.stepsimulation!-Tuple{SimulationModel}"><code>stepsimulation!</code></a> (update a <code>model</code> object by one time step).</p><p>To interface with Julia from another language, see the Julia docs <a href="https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/">here</a> and <a href="https://docs.julialang.org/en/v1/manual/embedding/">here</a>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="developing.html">« Developing Persefone</a><a class="docs-footer-nextpage" href="architecture.html">Source code architecture »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Adapting Persefone · Persefone.jl</title><meta name="title" content="Adapting Persefone · Persefone.jl"/><meta property="og:title" content="Adapting Persefone · Persefone.jl"/><meta property="twitter:title" content="Adapting Persefone · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li class="is-active"><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="adapting.html">Adapting Persefone</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="adapting.html">Adapting Persefone</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/adapting.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Adapting-Persefone"><a class="docs-heading-anchor" href="#Adapting-Persefone">Adapting Persefone</a><a id="Adapting-Persefone-1"></a><a class="docs-heading-anchor-permalink" href="#Adapting-Persefone" title="Permalink"></a></h1><p>A key development goal of Persefone is to be <a href="https://doi.org/10.1515/itit-2019-0040">FAIR</a>: <em>findable, accessible, interoperable, and reusable</em>. We aim to build a model that is both easy to use and easy to adapt to new situations.</p><p>There are multiple ways to adapt Persefone for a new modelling study:</p><h3 id="Changing-the-parameters"><a class="docs-heading-anchor" href="#Changing-the-parameters">Changing the parameters</a><a id="Changing-the-parameters-1"></a><a class="docs-heading-anchor-permalink" href="#Changing-the-parameters" title="Permalink"></a></h3><p>The simplest way to adapt Persefone is simply by changing the parameters. Copy <code>src/parameters.toml</code> to a new location, adjust it to your needs, and run the model using <code>julia run.jl -c <configfile></code>.</p><h3 id="Changing-the-region"><a class="docs-heading-anchor" href="#Changing-the-region">Changing the region</a><a id="Changing-the-region-1"></a><a class="docs-heading-anchor-permalink" href="#Changing-the-region" title="Permalink"></a></h3><p>To apply Persefone to a new region, you need to create new input maps of land cover and farmplots. How to do so is described <a href="gis.html">here</a>.</p><p><em>You may also need to change aspects of the <code>farm</code> submodel. This is not yet implemented.</em></p><h3 id="Adding-new-animal-species"><a class="docs-heading-anchor" href="#Adding-new-animal-species">Adding new animal species</a><a id="Adding-new-animal-species-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-new-animal-species" title="Permalink"></a></h3><p>To implement a new species to the <code>nature</code> submodel, add a new file to the <code>src/nature/species</code> directory and <code>include</code> it in <code>src/Persefone.jl</code>, as well as adding the name of the species to the <code>nature.targetspecies</code> parameter. In the new file, implement the species using the <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a> syntax as described <a href="species-dsl.html">here</a>.</p><h3 id="Adding-new-crop-species"><a class="docs-heading-anchor" href="#Adding-new-crop-species">Adding new crop species</a><a id="Adding-new-crop-species-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-new-crop-species" title="Permalink"></a></h3><p><em>Crop growth is not yet implemented.</em></p><h3 id="Adding-new-farmer-behaviour"><a class="docs-heading-anchor" href="#Adding-new-farmer-behaviour">Adding new farmer behaviour</a><a id="Adding-new-farmer-behaviour-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-new-farmer-behaviour" title="Permalink"></a></h3><p><em>Farmer behaviour is not yet implemented.</em></p><h3 id="Adding-a-new-submodel"><a class="docs-heading-anchor" href="#Adding-a-new-submodel">Adding a new submodel</a><a id="Adding-a-new-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Adding-a-new-submodel" title="Permalink"></a></h3><p>To add a new submodel in addition to the existing ones (<code>nature</code>, <code>crop</code>, and <code>farm</code>), you need to familiarise yourself with the <a href="architecture.html">software architecture</a>. In particular, you need to understand how initialisation and scheduling works in <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/simulation.jl"><code>src/core/simulation.jl</code></a>, and what information is stored in the <code>model</code> object.</p><p>If you want to add a new agent type, create a subtype of <a href="simulation.html#Persefone.ModelAgent"><code>ModelAgent</code></a>, implement a <a href="@ref"><code>stepagent!</code></a> function for it and add it to <a href="simulation.html#Persefone.initmodel-Tuple{Dict{String, Any}}"><code>Persefone.initmodel</code></a>.</p><h3 id="Linking-to-another-model"><a class="docs-heading-anchor" href="#Linking-to-another-model">Linking to another model</a><a id="Linking-to-another-model-1"></a><a class="docs-heading-anchor-permalink" href="#Linking-to-another-model" title="Permalink"></a></h3><p>Persefone can also be used as a software library and be called from another application. For this purpose, it is set up as a <a href="https://pkgdocs.julialang.org/v1/">Julia package</a>, with a <a href="https://docs.julialang.org/en/v1/manual/modules/">module</a> exporting various model functions, types, and macros (see <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/Persephone.jl"><code>src/Persefone.jl</code></a>). Of particular interest are the functions <a href="simulation.html#Persefone.simulate"><code>simulate</code></a> (set up and run a complete simulation based on a config file), <a href="simulation.html#Persefone.initialise"><code>initialise</code></a> (create one or more <code>model</code> objects from a config file), <a href="simulation.html#Persefone.simulate!-Tuple{SimulationModel}"><code>simulate!</code></a> (do a simulation run with an existing <code>model</code> object), and <a href="simulation.html#Persefone.stepsimulation!-Tuple{SimulationModel}"><code>stepsimulation!</code></a> (update a <code>model</code> object by one time step).</p><p>To interface with Julia from another language, see the Julia docs <a href="https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/">here</a> and <a href="https://docs.julialang.org/en/v1/manual/embedding/">here</a>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="developing.html">« Developing Persefone</a><a class="docs-footer-nextpage" href="architecture.html">Source code architecture »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/architecture.html b/docs/build/architecture.html index 6c3f73c50f6533b4f8b8ed3bb16f5a752b5963fe..c965d7328191890f5e42e65620ac300a43952ab1 100644 --- a/docs/build/architecture.html +++ b/docs/build/architecture.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Source code architecture · Persefone.jl</title><meta name="title" content="Source code architecture · Persefone.jl"/><meta property="og:title" content="Source code architecture · Persefone.jl"/><meta property="twitter:title" content="Source code architecture · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li class="is-active"><a class="tocitem" href="architecture.html">Source code architecture</a><ul class="internal"><li class="toplevel"><a class="tocitem" href="#Model-components"><span>Model components</span></a></li><li class="toplevel"><a class="tocitem" href="#Important-implementation-details"><span>Important implementation details</span></a></li></ul></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="architecture.html">Source code architecture</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="architecture.html">Source code architecture</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/architecture.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Source-code-architecture"><a class="docs-heading-anchor" href="#Source-code-architecture">Source code architecture</a><a id="Source-code-architecture-1"></a><a class="docs-heading-anchor-permalink" href="#Source-code-architecture" title="Permalink"></a></h1><h1 id="Model-components"><a class="docs-heading-anchor" href="#Model-components">Model components</a><a id="Model-components-1"></a><a class="docs-heading-anchor-permalink" href="#Model-components" title="Permalink"></a></h1><p><img src="assets/architecture.png" alt=""model architecture""/></p><p>Persefone is divided into four components, three of which are semi-independent submodels:</p><ol><li><p><code>core</code> and <code>world</code>: These two directories provide the foundation of the model software, which sets up and executes simulation runs. It also reads all input files (the configuration file, landscape maps, and weather data), and provides data output functionality.</p></li><li><p><code>nature</code>: This is an individual-based model of species in agricultural landscapes. It defines the <a href="nature.html#Persefone.Animal"><code>Animal</code></a> agent type, and a set of macros that can be used to rapidly create new species. It also includes ecological process functions that are useful for all species.</p></li><li><p><code>farm</code>: This is an agent-based model of farmer decision making. It is not yet implemented, but will provide the <a href="farm.html#Persefone.Farmer"><code>Farmer</code></a> agent type.</p></li><li><p><code>crop</code>: This is a mathematical growth model for various crops. It is not yet implemented, but already provides the agent type <a href="crops.html#Persefone.FarmPlot"><code>FarmPlot</code></a>, representing one field and its associated extent and crop type.</p></li></ol><p>Conceptually, <code>core</code> provides functionality that is needed by all of the submodels. Decisions made by <code>Farmer</code>s affect the <code>FarmPlot</code>s they own, and (directly or indirectly) the <code>Animal</code>s in the model landscape.</p><h1 id="Important-implementation-details"><a class="docs-heading-anchor" href="#Important-implementation-details">Important implementation details</a><a id="Important-implementation-details-1"></a><a class="docs-heading-anchor-permalink" href="#Important-implementation-details" title="Permalink"></a></h1><p><img src="assets/model_object.png" alt=""the model object""/></p><h3 id="The-model-object"><a class="docs-heading-anchor" href="#The-model-object">The <code>model</code> object</a><a id="The-model-object-1"></a><a class="docs-heading-anchor-permalink" href="#The-model-object" title="Permalink"></a></h3><p>A cursory reading of the source code will quickly show that most functions take an <code>SimulationModel</code> object as one of their arguments. The concrete type for this is <a href="simulation.html#Persefone.AgricultureModel"><code>AgricultureModel</code></a>, a struct that holds all state that is in any way relevant to a simulation run. (Persefone has a strict "no global state" policy to avoid state-dependent bugs and allow parallelisation.) The model object gives access to all agent instances. It also stores the configuration (<code>model.settings</code>), the landscape (<code>model.landscape</code>, a matrix of <a href="simulation.html#Persefone.Pixel"><code>Pixel</code></a> objects that store the local land cover, amongst other things), and the current simulation date (<code>model.date</code>). (See <a href="simulation.html#Persefone.initmodel-Tuple{Dict{String, Any}}"><code>Persefone.initmodel</code></a> for details.)</p><h3 id="Model-configuration/the-@param-macro"><a class="docs-heading-anchor" href="#Model-configuration/the-@param-macro">Model configuration/the <code>@param</code> macro</a><a id="Model-configuration/the-@param-macro-1"></a><a class="docs-heading-anchor-permalink" href="#Model-configuration/the-@param-macro" title="Permalink"></a></h3><p>The model is configured via a <a href="https://toml.io/en/">TOML</a> file, the default version of which is at <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/parameters.toml"><code>src/parameters.toml</code></a>. An individual run can be configured using a user-defined configuration file, commandline arguments, or function calls (when Persefone is used as a package rather than an application). During a model run, the <a href="io.html#Persefone.@param-Tuple{Any}"><code>@param</code></a> macro can be used to access parameter values. Note that parameter names are prepended with the name of the component they are associated with. For example, the <code>outdir</code> parameter belongs to the <code>[core]</code> section of the TOML file, and must therefore be referenced as <code>@param(core.outdir)</code>. (See <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/input.jl"><code>src/core/input.jl</code></a> for details.)</p><div class="admonition is-info"><header class="admonition-header">@param and other macros</header><div class="admonition-body"><p>As <code>@param(parameter)</code> expands to <code>model.settings["parameter"]</code>, it can obviously only be used in a context where the <code>model</code> object is actually available. (This is the case for most functions in Persefone, but not for all.) Similarly, many of the <code>nature</code> macros depend on specific variables being available where they are called, and can therefore only be used in specific contexts (this is indicated in their documentation).</p></div></div><h3 id="Output-data"><a class="docs-heading-anchor" href="#Output-data">Output data</a><a id="Output-data-1"></a><a class="docs-heading-anchor-permalink" href="#Output-data" title="Permalink"></a></h3><p>Persefone can output model data into text files with a specified frequency (daily, monthly, yearly, or at the simulation end). Submodels can use <a href="io.html#Persefone.newdataoutput!"><code>Persefone.newdataoutput!</code></a> to plug into this system. For an example of how to use this, see <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/nature/ecologicaldata.jl"><code>src/nature/ecologicaldata.jl</code></a>. (See <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/output.jl"><code>src/core/output.jl</code></a> for details.)</p><h3 id="Farm-events"><a class="docs-heading-anchor" href="#Farm-events">Farm events</a><a id="Farm-events-1"></a><a class="docs-heading-anchor-permalink" href="#Farm-events" title="Permalink"></a></h3><p>The <a href="simulation.html#Persefone.FarmEvent"><code>FarmEvent</code></a> struct is used to communicate farming-related events between submodels. An event can be triggered with <a href="simulation.html#Persefone.createevent!"><code>createevent!</code></a> and affects all pixels within a <a href="crops.html#Persefone.FarmPlot"><code>FarmPlot</code></a>. (See <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/landscape.jl"><code>src/core/landscape.jl</code></a> for details.)</p><h3 id="Random-numbers-and-logging"><a class="docs-heading-anchor" href="#Random-numbers-and-logging">Random numbers and logging</a><a id="Random-numbers-and-logging-1"></a><a class="docs-heading-anchor-permalink" href="#Random-numbers-and-logging" title="Permalink"></a></h3><p>By default in Julia, the <a href="https://docs.julialang.org/en/v1/stdlib/Random/">random number generator</a> (RNG) and the <a href="https://docs.julialang.org/en/v1/stdlib/Logging/#Logging.global_logger">system logger</a> are two globally accessible variables. As Persefone needs to avoid all global data (since this would interfere with reproducibility in parallel runs), the <code>model</code> object stores a local logger and a local RNG. The local logger generally does not change the way the model uses <a href="https://docs.julialang.org/en/v1/stdlib/Logging/">log statements</a>, it is only relevant for some functions in <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/simulation.jl"><code>src/core/simulation.jl</code></a>.</p><div class="admonition is-info"><header class="admonition-header">Using the model RNG</header><div class="admonition-body"><p>Whenever you need to use a <a href="https://docs.julialang.org/en/v1/stdlib/Random/#Base.rand">random number</a>, you must use the <code>model.rng</code>. The easiest way to do this is with the <a href="io.html#Persefone.@rand-Tuple"><code>@rand</code></a> and <a href="io.html#Persefone.@shuffle!-Tuple{Any}"><code>@shuffle!</code></a> macros. (Note that these, too, require access to the <code>model</code> object.)</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="adapting.html">« Adapting Persefone</a><a class="docs-footer-nextpage" href="gis.html">Maps and weather data »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Source code architecture · Persefone.jl</title><meta name="title" content="Source code architecture · Persefone.jl"/><meta property="og:title" content="Source code architecture · Persefone.jl"/><meta property="twitter:title" content="Source code architecture · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li class="is-active"><a class="tocitem" href="architecture.html">Source code architecture</a><ul class="internal"><li class="toplevel"><a class="tocitem" href="#Model-components"><span>Model components</span></a></li><li class="toplevel"><a class="tocitem" href="#Important-implementation-details"><span>Important implementation details</span></a></li></ul></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="architecture.html">Source code architecture</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="architecture.html">Source code architecture</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/architecture.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Source-code-architecture"><a class="docs-heading-anchor" href="#Source-code-architecture">Source code architecture</a><a id="Source-code-architecture-1"></a><a class="docs-heading-anchor-permalink" href="#Source-code-architecture" title="Permalink"></a></h1><h1 id="Model-components"><a class="docs-heading-anchor" href="#Model-components">Model components</a><a id="Model-components-1"></a><a class="docs-heading-anchor-permalink" href="#Model-components" title="Permalink"></a></h1><p><img src="assets/architecture.png" alt=""model architecture""/></p><p>Persefone is divided into four components, three of which are semi-independent submodels:</p><ol><li><p><code>core</code> and <code>world</code>: These two directories provide the foundation of the model software, which sets up and executes simulation runs. It also reads all input files (the configuration file, landscape maps, and weather data), and provides data output functionality.</p></li><li><p><code>nature</code>: This is an individual-based model of species in agricultural landscapes. It defines the <a href="nature.html#Persefone.Animal"><code>Animal</code></a> agent type, and a set of macros that can be used to rapidly create new species. It also includes ecological process functions that are useful for all species.</p></li><li><p><code>farm</code>: This is an agent-based model of farmer decision making. It is not yet implemented, but will provide the <a href="farm.html#Persefone.Farmer"><code>Farmer</code></a> agent type.</p></li><li><p><code>crop</code>: This is a mathematical growth model for various crops. It is not yet implemented, but already provides the agent type <a href="crops.html#Persefone.FarmPlot"><code>FarmPlot</code></a>, representing one field and its associated extent and crop type.</p></li></ol><p>Conceptually, <code>core</code> provides functionality that is needed by all of the submodels. Decisions made by <code>Farmer</code>s affect the <code>FarmPlot</code>s they own, and (directly or indirectly) the <code>Animal</code>s in the model landscape.</p><h1 id="Important-implementation-details"><a class="docs-heading-anchor" href="#Important-implementation-details">Important implementation details</a><a id="Important-implementation-details-1"></a><a class="docs-heading-anchor-permalink" href="#Important-implementation-details" title="Permalink"></a></h1><p><img src="assets/model_object.png" alt=""the model object""/></p><h3 id="The-model-object"><a class="docs-heading-anchor" href="#The-model-object">The <code>model</code> object</a><a id="The-model-object-1"></a><a class="docs-heading-anchor-permalink" href="#The-model-object" title="Permalink"></a></h3><p>A cursory reading of the source code will quickly show that most functions take an <code>SimulationModel</code> object as one of their arguments. The concrete type for this is <a href="simulation.html#Persefone.AgricultureModel"><code>AgricultureModel</code></a>, a struct that holds all state that is in any way relevant to a simulation run. (Persefone has a strict "no global state" policy to avoid state-dependent bugs and allow parallelisation.) The model object gives access to all agent instances. It also stores the configuration (<code>model.settings</code>), the landscape (<code>model.landscape</code>, a matrix of <a href="simulation.html#Persefone.Pixel"><code>Pixel</code></a> objects that store the local land cover, amongst other things), and the current simulation date (<code>model.date</code>). (See <a href="simulation.html#Persefone.initmodel-Tuple{Dict{String, Any}}"><code>Persefone.initmodel</code></a> for details.)</p><h3 id="Model-configuration/the-@param-macro"><a class="docs-heading-anchor" href="#Model-configuration/the-@param-macro">Model configuration/the <code>@param</code> macro</a><a id="Model-configuration/the-@param-macro-1"></a><a class="docs-heading-anchor-permalink" href="#Model-configuration/the-@param-macro" title="Permalink"></a></h3><p>The model is configured via a <a href="https://toml.io/en/">TOML</a> file, the default version of which is at <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/parameters.toml"><code>src/parameters.toml</code></a>. An individual run can be configured using a user-defined configuration file, commandline arguments, or function calls (when Persefone is used as a package rather than an application). During a model run, the <a href="io.html#Persefone.@param-Tuple{Any}"><code>@param</code></a> macro can be used to access parameter values. Note that parameter names are prepended with the name of the component they are associated with. For example, the <code>outdir</code> parameter belongs to the <code>[core]</code> section of the TOML file, and must therefore be referenced as <code>@param(core.outdir)</code>. (See <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/input.jl"><code>src/core/input.jl</code></a> for details.)</p><div class="admonition is-info"><header class="admonition-header">@param and other macros</header><div class="admonition-body"><p>As <code>@param(parameter)</code> expands to <code>model.settings["parameter"]</code>, it can obviously only be used in a context where the <code>model</code> object is actually available. (This is the case for most functions in Persefone, but not for all.) Similarly, many of the <code>nature</code> macros depend on specific variables being available where they are called, and can therefore only be used in specific contexts (this is indicated in their documentation).</p></div></div><h3 id="Output-data"><a class="docs-heading-anchor" href="#Output-data">Output data</a><a id="Output-data-1"></a><a class="docs-heading-anchor-permalink" href="#Output-data" title="Permalink"></a></h3><p>Persefone can output model data into text files with a specified frequency (daily, monthly, yearly, or at the simulation end). Submodels can use <a href="io.html#Persefone.newdataoutput!"><code>Persefone.newdataoutput!</code></a> to plug into this system. For an example of how to use this, see <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/nature/ecologicaldata.jl"><code>src/nature/ecologicaldata.jl</code></a>. (See <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/output.jl"><code>src/core/output.jl</code></a> for details.)</p><h3 id="Farm-events"><a class="docs-heading-anchor" href="#Farm-events">Farm events</a><a id="Farm-events-1"></a><a class="docs-heading-anchor-permalink" href="#Farm-events" title="Permalink"></a></h3><p>The <a href="simulation.html#Persefone.FarmEvent"><code>FarmEvent</code></a> struct is used to communicate farming-related events between submodels. An event can be triggered with <a href="simulation.html#Persefone.createevent!"><code>createevent!</code></a> and affects all pixels within a <a href="crops.html#Persefone.FarmPlot"><code>FarmPlot</code></a>. (See <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/landscape.jl"><code>src/core/landscape.jl</code></a> for details.)</p><h3 id="Random-numbers-and-logging"><a class="docs-heading-anchor" href="#Random-numbers-and-logging">Random numbers and logging</a><a id="Random-numbers-and-logging-1"></a><a class="docs-heading-anchor-permalink" href="#Random-numbers-and-logging" title="Permalink"></a></h3><p>By default in Julia, the <a href="https://docs.julialang.org/en/v1/stdlib/Random/">random number generator</a> (RNG) and the <a href="https://docs.julialang.org/en/v1/stdlib/Logging/#Logging.global_logger">system logger</a> are two globally accessible variables. As Persefone needs to avoid all global data (since this would interfere with reproducibility in parallel runs), the <code>model</code> object stores a local logger and a local RNG. The local logger generally does not change the way the model uses <a href="https://docs.julialang.org/en/v1/stdlib/Logging/">log statements</a>, it is only relevant for some functions in <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/src/core/simulation.jl"><code>src/core/simulation.jl</code></a>.</p><div class="admonition is-info"><header class="admonition-header">Using the model RNG</header><div class="admonition-body"><p>Whenever you need to use a <a href="https://docs.julialang.org/en/v1/stdlib/Random/#Base.rand">random number</a>, you must use the <code>model.rng</code>. The easiest way to do this is with the <a href="io.html#Persefone.@rand-Tuple"><code>@rand</code></a> and <a href="io.html#Persefone.@shuffle!-Tuple{Any}"><code>@shuffle!</code></a> macros. (Note that these, too, require access to the <code>model</code> object.)</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="adapting.html">« Adapting Persefone</a><a class="docs-footer-nextpage" href="gis.html">Maps and weather data »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/config.html b/docs/build/config.html index 1472b9cc1296bad0c0cb6a9f57c923719910cb83..1df3a0882346f11d4b19501afd3f40785aa920c5 100644 --- a/docs/build/config.html +++ b/docs/build/config.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Configuration · Persefone.jl</title><meta name="title" content="Configuration · Persefone.jl"/><meta property="og:title" content="Configuration · Persefone.jl"/><meta property="twitter:title" content="Configuration · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li class="is-active"><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">User guide</a></li><li class="is-active"><a href="config.html">Configuration</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="config.html">Configuration</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/config.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Configuration"><a class="docs-heading-anchor" href="#Configuration">Configuration</a><a id="Configuration-1"></a><a class="docs-heading-anchor-permalink" href="#Configuration" title="Permalink"></a></h1><p>Persefone requires three <a href="io.html">input</a> files: a configuration file and two map files. How to generate the map files is documented <a href="gis.html">elsewhere</a>. The configuration file defines parameter values and looks like this (see <code>src/parameters.toml</code> for the default):</p><pre><code class="language-TOML hljs">### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe. +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Configuration · Persefone.jl</title><meta name="title" content="Configuration · Persefone.jl"/><meta property="og:title" content="Configuration · Persefone.jl"/><meta property="twitter:title" content="Configuration · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li class="is-active"><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">User guide</a></li><li class="is-active"><a href="config.html">Configuration</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="config.html">Configuration</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/config.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Configuration"><a class="docs-heading-anchor" href="#Configuration">Configuration</a><a id="Configuration-1"></a><a class="docs-heading-anchor-permalink" href="#Configuration" title="Permalink"></a></h1><p>Persefone requires three <a href="io.html">input</a> files: a configuration file and two map files. How to generate the map files is documented <a href="gis.html">elsewhere</a>. The configuration file defines parameter values and looks like this (see <code>src/parameters.toml</code> for the default):</p><pre><code class="language-TOML hljs">### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe. ### ### This is the default configuration file for Persefone, containing all model parameters. ### The syntax is described here: https://toml.io/en/ @@ -35,4 +35,4 @@ insectmodel = ["season", "habitat", "pesticides", [crop] cropmodel = "almass" # crop growth model to use, "almass" or "aquacrop" cropfile = "data/crops/almass/crop_data_general.csv" # file with general crop parameters -growthfile = "data/crops/almass/almass_crop_growth_curves.csv" # file with crop growth parameters </code></pre><div class="admonition is-info"><header class="admonition-header">Parameter scanning</header><div class="admonition-body"><p>You can set any parameter to a list of different values, e.g. <code>seed = [1,2,3]</code>. Persefone will then set up and run multiple simulations, one for every possible combination of parameters that you entered (i.e. do a full-factorial simulation experiment).</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="gui.html">« Graphical User Interface</a><a class="docs-footer-nextpage" href="developing.html">Developing Persefone »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +growthfile = "data/crops/almass/almass_crop_growth_curves.csv" # file with crop growth parameters </code></pre><div class="admonition is-info"><header class="admonition-header">Parameter scanning</header><div class="admonition-body"><p>You can set any parameter to a list of different values, e.g. <code>seed = [1,2,3]</code>. Persefone will then set up and run multiple simulations, one for every possible combination of parameters that you entered (i.e. do a full-factorial simulation experiment).</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="gui.html">« Graphical User Interface</a><a class="docs-footer-nextpage" href="management.html">Farm management »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/crop-models.html b/docs/build/crop-models.html new file mode 100644 index 0000000000000000000000000000000000000000..0a4c41cfff5a5389dafd0dc6773ec59ef91f71b1 --- /dev/null +++ b/docs/build/crop-models.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Crop models · Persefone.jl</title><meta name="title" content="Crop models · Persefone.jl"/><meta property="og:title" content="Crop models · Persefone.jl"/><meta property="twitter:title" content="Crop models · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li class="is-active"><a class="tocitem" href="crop-models.html">Crop models</a><ul class="internal"><li><a class="tocitem" href="#ALMaSS"><span>ALMaSS</span></a></li><li><a class="tocitem" href="#AquaCrop"><span>AquaCrop</span></a></li></ul></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Scientific documentation</a></li><li class="is-active"><a href="crop-models.html">Crop models</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="crop-models.html">Crop models</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/crop-models.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Crop-models"><a class="docs-heading-anchor" href="#Crop-models">Crop models</a><a id="Crop-models-1"></a><a class="docs-heading-anchor-permalink" href="#Crop-models" title="Permalink"></a></h1><p><em>TODO</em></p><h2 id="ALMaSS"><a class="docs-heading-anchor" href="#ALMaSS">ALMaSS</a><a id="ALMaSS-1"></a><a class="docs-heading-anchor-permalink" href="#ALMaSS" title="Permalink"></a></h2><h2 id="AquaCrop"><a class="docs-heading-anchor" href="#AquaCrop">AquaCrop</a><a id="AquaCrop-1"></a><a class="docs-heading-anchor-permalink" href="#AquaCrop" title="Permalink"></a></h2></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="management.html">« Farm management</a><a class="docs-footer-nextpage" href="skylark.html">Skylark »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/crops.html b/docs/build/crops.html index 77f4762f60a02536c3ba5d49aaa18c2fa5fcb09d..af76c0d3e571b6924393d4449757fead0f85dd21 100644 --- a/docs/build/crops.html +++ b/docs/build/crops.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Crop submodel · Persefone.jl</title><meta name="title" content="Crop submodel · Persefone.jl"/><meta property="og:title" content="Crop submodel · Persefone.jl"/><meta property="twitter:title" content="Crop submodel · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li class="is-active"><a class="tocitem" href="crops.html">Crop submodel</a><ul class="internal"><li><a class="tocitem" href="#farmplot.jl"><span>farmplot.jl</span></a></li><li><a class="tocitem" href="#crops.jl"><span>crops.jl</span></a></li></ul></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="crops.html">Crop submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="crops.html">Crop submodel</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/crops.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Crop-submodel"><a class="docs-heading-anchor" href="#Crop-submodel">Crop submodel</a><a id="Crop-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Crop-submodel" title="Permalink"></a></h1><p>Eventually, the plan is to have Persefone include a reimplementation of the AquaCrop model, a well-established crop growth model developed by the FAO. Until then, we are using the crop growth submodel used in <a href="https://doi.org/10.1016/S0304-3800(03)00173-X">ALMaSS</a>.</p><h2 id="farmplot.jl"><a class="docs-heading-anchor" href="#farmplot.jl">farmplot.jl</a><a id="farmplot.jl-1"></a><a class="docs-heading-anchor-permalink" href="#farmplot.jl" title="Permalink"></a></h2><p>This file is responsible for the farm plots, i.e. the indidivual fields that farmers manage.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.FarmPlot" href="#Persefone.FarmPlot"><code>Persefone.FarmPlot</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">FarmPlot</code></pre><p>This represents one field, i.e. a collection of pixels with the same management. This is the spatial unit with which the crop growth model and the farm model work.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L8-L13">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.averagefieldsize-Tuple{SimulationModel}" href="#Persefone.averagefieldsize-Tuple{SimulationModel}"><code>Persefone.averagefieldsize</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">averagefieldsize(model)</code></pre><p>Calculate the average field size in hectares for the model landscape.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L157-L161">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.cropheight-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.cropheight-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.cropheight</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">cropheight(model, position)</code></pre><p>Return the height of the crop at this position, or nothing if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L192-L197">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.cropname-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.cropname-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.cropname</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">cropname(model, position)</code></pre><p>Return the name of the crop at this position, or an empty string if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L181-L186">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.croptype-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.croptype-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.croptype</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">croptype(model, position)</code></pre><p>Return the crop at this position, or nothing if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L171-L175">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.growcrop!-Tuple{FarmPlot, SimulationModel}" href="#Persefone.growcrop!-Tuple{FarmPlot, SimulationModel}"><code>Persefone.growcrop!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">growcrop!(farmplot, model)</code></pre><p>Apply the relevant crop growth model to update the plants on this farm plot. Currently only supports the ALMaSS crop growth model by Topping et al.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L117-L122">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.harvest!-Tuple{FarmPlot, SimulationModel}" href="#Persefone.harvest!-Tuple{FarmPlot, SimulationModel}"><code>Persefone.harvest!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">harvest!(farmplot, model)</code></pre><p>Harvest the crop on this farmplot.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L99-L103">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initfields!-Tuple{SimulationModel}" href="#Persefone.initfields!-Tuple{SimulationModel}"><code>Persefone.initfields!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initfields!(model)</code></pre><p>Initialise the model with its farm plots.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L28-L32">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.sow!-Tuple{String, FarmPlot, SimulationModel}" href="#Persefone.sow!-Tuple{String, FarmPlot, SimulationModel}"><code>Persefone.sow!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">sow!(cropname, farmplot, model)</code></pre><p>Sow the specified crop on this farmplot.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L87-L91">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepagent!-Tuple{FarmPlot, SimulationModel}" href="#Persefone.stepagent!-Tuple{FarmPlot, SimulationModel}"><code>Persefone.stepagent!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(farmplot, model)</code></pre><p>Update a farm plot by one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/farmplot.jl#L64-L68">source</a></section></article><h2 id="crops.jl"><a class="docs-heading-anchor" href="#crops.jl">crops.jl</a><a id="crops.jl-1"></a><a class="docs-heading-anchor-permalink" href="#crops.jl" title="Permalink"></a></h2><p>This includes the types and functions needed for all crop growth model, which are also referenced by the other submodels.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.CropCurveParams" href="#Persefone.CropCurveParams"><code>Persefone.CropCurveParams</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CropCurveParams</code></pre><p>The values in this struct define one crop growth curve.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/crops.jl#L16-L20">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.CropType" href="#Persefone.CropType"><code>Persefone.CropType</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CropType</code></pre><p>The type struct for all crops. Currently follows the crop growth model as implemented in ALMaSS.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/crops.jl#L31-L36">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.GrowthPhase" href="#Persefone.GrowthPhase"><code>Persefone.GrowthPhase</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">GrowthPhase</code></pre><p>ALMaSS crop growth curves are split into five phases, triggered by seasonal dates or agricultural events.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/crops.jl#L8-L13">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Base.tryparse-Tuple{Type{Persefone.GrowthPhase}, String}" href="#Base.tryparse-Tuple{Type{Persefone.GrowthPhase}, String}"><code>Base.tryparse</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">Base.tryparse(type, str)</code></pre><p>Extend <code>tryparse</code> to allow parsing GrowthPhase values. (Needed to read in the CSV parameter file.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/crops.jl#L51-L56">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.buildgrowthcurve-Tuple{Vector{CSV.Row}}" href="#Persefone.buildgrowthcurve-Tuple{Vector{CSV.Row}}"><code>Persefone.buildgrowthcurve</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">buildgrowthcurve(data)</code></pre><p>Convert a list of rows from the crop growth data into a CropCurveParams object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/crops.jl#L66-L70">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.readcropparameters-Tuple{String, String}" href="#Persefone.readcropparameters-Tuple{String, String}"><code>Persefone.readcropparameters</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">readcropparameters(generalcropfile, cropgrowthfile)</code></pre><p>Parse a CSV file containing the required parameter values for each crop (as produced from the original ALMaSS file by <code>convert_almass_data.py</code>).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/crop/crops.jl#L95-L100">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="species.html">« Species</a><a class="docs-footer-nextpage" href="farm.html">Farm submodel »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Crop submodel · Persefone.jl</title><meta name="title" content="Crop submodel · Persefone.jl"/><meta property="og:title" content="Crop submodel · Persefone.jl"/><meta property="twitter:title" content="Crop submodel · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li class="is-active"><a class="tocitem" href="crops.html">Crop submodel</a><ul class="internal"><li><a class="tocitem" href="#farmplot.jl"><span>farmplot.jl</span></a></li><li><a class="tocitem" href="#crops.jl"><span>crops.jl</span></a></li></ul></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Software API</a></li><li class="is-active"><a href="crops.html">Crop submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="crops.html">Crop submodel</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/crops.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Crop-submodel"><a class="docs-heading-anchor" href="#Crop-submodel">Crop submodel</a><a id="Crop-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Crop-submodel" title="Permalink"></a></h1><p>Eventually, the plan is to have Persefone include a reimplementation of the AquaCrop model, a well-established crop growth model developed by the FAO. Until then, we are using the crop growth submodel used in <a href="https://doi.org/10.1016/S0304-3800(03)00173-X">ALMaSS</a>.</p><h2 id="farmplot.jl"><a class="docs-heading-anchor" href="#farmplot.jl">farmplot.jl</a><a id="farmplot.jl-1"></a><a class="docs-heading-anchor-permalink" href="#farmplot.jl" title="Permalink"></a></h2><p>This file is responsible for the farm plots, i.e. the indidivual fields that farmers manage.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.FarmPlot" href="#Persefone.FarmPlot"><code>Persefone.FarmPlot</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">FarmPlot</code></pre><p>This represents one field, i.e. a collection of pixels with the same management. This is the spatial unit with which the crop growth model and the farm model work.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L8-L13">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.averagefieldsize-Tuple{SimulationModel}" href="#Persefone.averagefieldsize-Tuple{SimulationModel}"><code>Persefone.averagefieldsize</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">averagefieldsize(model)</code></pre><p>Calculate the average field size in hectares for the model landscape.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L157-L161">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.cropcover-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.cropcover-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.cropcover</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">cropcover(model, position)</code></pre><p>Return the percentage ground cover of the crop at this position, or 0 if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L203-L208">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.cropheight-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.cropheight-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.cropheight</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">cropheight(model, position)</code></pre><p>Return the height of the crop at this position, or 0 if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L192-L197">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.cropname-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.cropname-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.cropname</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">cropname(model, position)</code></pre><p>Return the name of the crop at this position, or an empty string if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L181-L186">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.croptype-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.croptype-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.croptype</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">croptype(model, position)</code></pre><p>Return the crop at this position, or nothing if there is no crop here (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L171-L175">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.growcrop!-Tuple{FarmPlot, SimulationModel}" href="#Persefone.growcrop!-Tuple{FarmPlot, SimulationModel}"><code>Persefone.growcrop!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">growcrop!(farmplot, model)</code></pre><p>Apply the relevant crop growth model to update the plants on this farm plot. Currently only supports the ALMaSS crop growth model by Topping et al.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L117-L122">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.harvest!-Tuple{FarmPlot, SimulationModel}" href="#Persefone.harvest!-Tuple{FarmPlot, SimulationModel}"><code>Persefone.harvest!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">harvest!(farmplot, model)</code></pre><p>Harvest the crop on this farmplot.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L99-L103">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initfields!-Tuple{SimulationModel}" href="#Persefone.initfields!-Tuple{SimulationModel}"><code>Persefone.initfields!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initfields!(model)</code></pre><p>Initialise the model with its farm plots.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L28-L32">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.sow!-Tuple{String, FarmPlot, SimulationModel}" href="#Persefone.sow!-Tuple{String, FarmPlot, SimulationModel}"><code>Persefone.sow!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">sow!(cropname, farmplot, model)</code></pre><p>Sow the specified crop on this farmplot.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L87-L91">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepagent!-Tuple{FarmPlot, SimulationModel}" href="#Persefone.stepagent!-Tuple{FarmPlot, SimulationModel}"><code>Persefone.stepagent!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(farmplot, model)</code></pre><p>Update a farm plot by one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/farmplot.jl#L64-L68">source</a></section></article><h2 id="crops.jl"><a class="docs-heading-anchor" href="#crops.jl">crops.jl</a><a id="crops.jl-1"></a><a class="docs-heading-anchor-permalink" href="#crops.jl" title="Permalink"></a></h2><p>This includes the types and functions needed for all crop growth model, which are also referenced by the other submodels.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.CropCurveParams" href="#Persefone.CropCurveParams"><code>Persefone.CropCurveParams</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CropCurveParams</code></pre><p>The values in this struct define one crop growth curve.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/crops.jl#L16-L20">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.CropType" href="#Persefone.CropType"><code>Persefone.CropType</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">CropType</code></pre><p>The type struct for all crops. Currently follows the crop growth model as implemented in ALMaSS.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/crops.jl#L31-L36">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.GrowthPhase" href="#Persefone.GrowthPhase"><code>Persefone.GrowthPhase</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">GrowthPhase</code></pre><p>ALMaSS crop growth curves are split into five phases, triggered by seasonal dates or agricultural events.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/crops.jl#L8-L13">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Base.tryparse-Tuple{Type{Persefone.GrowthPhase}, String}" href="#Base.tryparse-Tuple{Type{Persefone.GrowthPhase}, String}"><code>Base.tryparse</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">Base.tryparse(type, str)</code></pre><p>Extend <code>tryparse</code> to allow parsing GrowthPhase values. (Needed to read in the CSV parameter file.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/crops.jl#L51-L56">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.buildgrowthcurve-Tuple{Vector{CSV.Row}}" href="#Persefone.buildgrowthcurve-Tuple{Vector{CSV.Row}}"><code>Persefone.buildgrowthcurve</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">buildgrowthcurve(data)</code></pre><p>Convert a list of rows from the crop growth data into a CropCurveParams object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/crops.jl#L66-L70">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.readcropparameters-Tuple{String, String}" href="#Persefone.readcropparameters-Tuple{String, String}"><code>Persefone.readcropparameters</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">readcropparameters(generalcropfile, cropgrowthfile)</code></pre><p>Parse a CSV file containing the required parameter values for each crop (as produced from the original ALMaSS file by <code>convert_almass_data.py</code>).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/crop/crops.jl#L95-L100">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="species.html">« Species models</a><a class="docs-footer-nextpage" href="farm.html">Farm submodel »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/developing.html b/docs/build/developing.html index 0dccd08b09c605ac493957489822cc31f76140ad..88a74d6d9e3bb9230d304bb0e1f1c528ceab9c3a 100644 --- a/docs/build/developing.html +++ b/docs/build/developing.html @@ -1,9 +1,9 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Developing Persefone · Persefone.jl</title><meta name="title" content="Developing Persefone · Persefone.jl"/><meta property="og:title" content="Developing Persefone · Persefone.jl"/><meta property="twitter:title" content="Developing Persefone · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li class="is-active"><a class="tocitem" href="developing.html">Developing Persefone</a><ul class="internal"><li><a class="tocitem" href="#Setting-up"><span>Setting up</span></a></li><li><a class="tocitem" href="#Development-workflow"><span>Development workflow</span></a></li><li><a class="tocitem" href="#Important-libraries"><span>Important libraries</span></a></li></ul></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="developing.html">Developing Persefone</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="developing.html">Developing Persefone</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/developing.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Developing-Persefone"><a class="docs-heading-anchor" href="#Developing-Persefone">Developing Persefone</a><a id="Developing-Persefone-1"></a><a class="docs-heading-anchor-permalink" href="#Developing-Persefone" title="Permalink"></a></h1><h2 id="Setting-up"><a class="docs-heading-anchor" href="#Setting-up">Setting up</a><a id="Setting-up-1"></a><a class="docs-heading-anchor-permalink" href="#Setting-up" title="Permalink"></a></h2><p>If you haven't worked with Julia before, here are detailed instructions for how to set up your development environment. The main development is currently done on Linux (and as the primary execution platform will be an HPC, Linux compatibility is important), but developing on Windows works too.</p><h3 id="Visual-Studio-Code-on-Windows"><a class="docs-heading-anchor" href="#Visual-Studio-Code-on-Windows">Visual Studio Code on Windows</a><a id="Visual-Studio-Code-on-Windows-1"></a><a class="docs-heading-anchor-permalink" href="#Visual-Studio-Code-on-Windows" title="Permalink"></a></h3><ol><li><p>Download and install <a href="https://julialang.org/downloads/">Julia</a>, <a href="https://git-scm.com/download/win">git</a> and <a href="https://code.visualstudio.com/">Visual Studio Code</a>.</p></li><li><p>Install the <a href="https://www.julia-vscode.org/">Julia extension for VS Code</a>: In VS Code, open the extensions pane (<code>Ctrl+Shift+X</code>). Search for and install Julia Language Support.</p></li><li><p>Clone the <a href="https://git.idiv.de/persefone/persefone-model.git">Gitlab repository</a>: In VS Code, open the source control pane (<code>Ctrl+Shift+G</code>). Click on <code>Clone</code> and enter the repo URL. Then select a folder on your computer to download the files into, and let VS Code open the project once it has been cloned.</p></li><li><p>Start a Julia REPL: In VS Code, bring up the command palette (<code>Ctrl+Shift+P</code>). Execute the command <code>Julia: Start REPL</code>. Then install all dependencies of Persefone by running <code>using Pkg; Pkg.activate("."); Pkg.instantiate()</code>. (This will take some time.)</p></li><li><p>Open the file <code>run.jl</code> and click <code>Execute</code> (triangular button in the top right). The source code will compile (this can take a lot of time the first time you do it) and run a default simulation.</p></li><li><p>Further steps: You may want to familiarise yourself with how to use <a href="https://code.visualstudio.com/docs/sourcecontrol/overview">git with VS Code</a>. You may also want to clone the Persefone Desktop <a href="https://git.idiv.de/persefone/persefone-desktop.git">repository</a> (repeat steps 3 to 5).</p></li></ol><h3 id="Emacs-on-Linux"><a class="docs-heading-anchor" href="#Emacs-on-Linux">Emacs on Linux</a><a id="Emacs-on-Linux-1"></a><a class="docs-heading-anchor-permalink" href="#Emacs-on-Linux" title="Permalink"></a></h3><p><em>You can of course also use VS Code on Linux. In that case, follow the instructions above.</em></p><p>Make sure you have git and Julia installed. Git should be in your distro's repos (e.g. <code>sudo apt install git</code>). To install Julia, <a href="https://julialang.org/downloads/">download</a> the binary and unpack it. For greater ease of use, copy the unpacked files to <code>/usr/local/lib/julia</code> (or similar) and create a symlink to the executable: <code>sudo ln -s /usr/local/lib/julia/bin/julia /usr/local/bin/julia</code>. Then go the to folder that you want to use for development and run <code>git clone https://git.idiv.de/persefone/persefone-model.git .</code> in your terminal.</p><p>There are a couple of addons that make working with Julia much nicer in Emacs:</p><ol><li><p><code>julia-mode</code> gives syntax highlighting. Install with <code>M-x package-install julia-mode</code>.</p></li><li><p><a href="https://github.com/gcv/julia-snail"><code>julia-snail</code></a> provides IDE-like features, especially a fully-functional REPL and the ability to evaluate code straight from inside a buffer. Note that the installation can be somewhat tricky. You first need to manually install all the dependencies of its dependency <a href="https://github.com/akermu/emacs-libvterm">vterm</a>, then install vterm itself with <code>M-x package-install vterm</code>, <em>before</em> you can do <code>M-x package-install julia-snail</code>. Then add it to your <code>init.el</code> with <code>(require 'julia-snail)</code> and <code>(add-hook 'julia-mode-hook #'julia-snail-mode)</code>.</p></li><li><p><a href="http://company-mode.github.io/"><code>company-mode</code></a> integrates with Snail to give code completion. Install with <code>M-x package-install company</code>, then add <code>(add-hook 'julia-mode-hook #'company-mode)</code> and <code>(global-set-key (kbd "C-<tab>") 'company-complete)</code> to your <code>init.el</code>.</p></li><li><p><a href="https://magit.vc/"><code>magit</code></a> is a great git interface for Emacs. Install with <code>M-x package-install magit</code> and add <code>(global-set-key (kbd "C-x g") 'magit-status)</code> to your <code>init.el</code>.</p></li></ol><h2 id="Development-workflow"><a class="docs-heading-anchor" href="#Development-workflow">Development workflow</a><a id="Development-workflow-1"></a><a class="docs-heading-anchor-permalink" href="#Development-workflow" title="Permalink"></a></h2><ol><li><p>Pull the current version from the master branch on Gitlab: <a href="https://git.idiv.de/persefone/persefone-model">https://git.idiv.de/persefone/persefone-model</a>.</p></li><li><p>If you are working on a new feature, create a new branch to avoid breaking the <code>master</code> branch. (The <code>master</code> branch on Github should always be in a runnable and error-free state.)</p></li><li><p>Implement your changes.</p></li><li><p>Run an example simulation and the test suite to make sure everything works without crashing (<code>make run</code> and <code>make test</code> on Linux, or execute <code>run.jl</code> and <code>test/runtests.jl</code> manually.)</p></li><li><p>Commit your work frequently, and try to keep each commit small. Don't forget to add relevant tests to the test suite.</p></li><li><p>Once your satisfied with your work, do another pull/merge from the <code>master</code> branch in case somebody else changed the branch in the meantime. Then merge your work into <code>master</code> and push to the Gitlab server.</p></li><li><p>Repeat :-)</p></li></ol><p>The Gitlab <a href="https://git.idiv.de/persefone/persefone-model/-/boards/373">issue tracker</a> can be used to create, discuss, and assign tasks, as well as to monitor progress towards milestones/releases. Once we have a first release, we will start using <a href="https://semver.org/">semantic versioning</a> and a <a href="https://keepachangelog.com/en/1.0.0/">changelog</a>.</p><h2 id="Important-libraries"><a class="docs-heading-anchor" href="#Important-libraries">Important libraries</a><a id="Important-libraries-1"></a><a class="docs-heading-anchor-permalink" href="#Important-libraries" title="Permalink"></a></h2><h3 id="Revise.jl"><a class="docs-heading-anchor" href="#Revise.jl">Revise.jl</a><a id="Revise.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Revise.jl" title="Permalink"></a></h3><p><a href="https://timholy.github.io/Revise.jl/stable/"><code>Revise.jl</code></a> allows one to reload code without restarting the Julia interpreter. Get it with <code>Pkg.add("Revise")</code>, then add <code>using Revise</code> to <code>.julia/config/startup.jl</code> to have it automatically available.</p><h3 id="Test"><a class="docs-heading-anchor" href="#Test">Test</a><a id="Test-1"></a><a class="docs-heading-anchor-permalink" href="#Test" title="Permalink"></a></h3><p>Persefone uses the inbuilt Julia <a href="https://docs.julialang.org/en/v1/stdlib/Test/">testing framework</a>. All new functions should have appropriate tests written for them in the appropriate file in the <code>test</code> directory. (See <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/test/runtests.jl"><code>test/runtests.jl</code></a> for details.) There are three ways to run the test suite: in the terminal, executing <code>make test</code> or <code>cd test; julia runtests.jl</code>; or in the Julia REPL, <code>Pkg.activate("."); Pkg.test()</code>.</p><h3 id="Documenter.jl"><a class="docs-heading-anchor" href="#Documenter.jl">Documenter.jl</a><a id="Documenter.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Documenter.jl" title="Permalink"></a></h3><p>The HTML documentation is generated using <a href="https://documenter.juliadocs.org">Documenter.jl</a>. Therefore, all new functions should have docstrings attached. New files need to be integrated into the relevant documentation source files in <code>docs/src</code>, and if necessary into <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/docs/builddocs.jl"><code>docs/builddocs.jl</code></a>. To build the documentation, run <code>make docs</code>, or <code>cd docs; julia builddocs.jl</code> (if using the latter, don't forget to update the date and commit in <code>docs/src/index.md</code>).</p><h3 id="Graphics-and-user-interface"><a class="docs-heading-anchor" href="#Graphics-and-user-interface">Graphics and user interface</a><a id="Graphics-and-user-interface-1"></a><a class="docs-heading-anchor-permalink" href="#Graphics-and-user-interface" title="Permalink"></a></h3><p>Persefone uses <a href="https://makie.org/">Makie</a> as a plotting library to generate its output graphics. Additionally, Persefone Desktop uses <a href="https://github.com/JuliaGraphics/QML.jl">QML.jl</a> to create its graphical user interface.</p><h3 id="Unitful.jl"><a class="docs-heading-anchor" href="#Unitful.jl">Unitful.jl</a><a id="Unitful.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Unitful.jl" title="Permalink"></a></h3><p>Throughout the source code, variables can be tagged with their appropriate units using the <a href="https://painterqubits.github.io/Unitful.jl/stable/">Unitful.jl</a> library. This makes the code easier to understand, and also allows automatic unit conversion:</p><pre><code class="language-julia hljs">julia> 1ha == 10000m² +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Developing Persefone · Persefone.jl</title><meta name="title" content="Developing Persefone · Persefone.jl"/><meta property="og:title" content="Developing Persefone · Persefone.jl"/><meta property="twitter:title" content="Developing Persefone · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li class="is-active"><a class="tocitem" href="developing.html">Developing Persefone</a><ul class="internal"><li><a class="tocitem" href="#Setting-up"><span>Setting up</span></a></li><li><a class="tocitem" href="#Development-workflow"><span>Development workflow</span></a></li><li><a class="tocitem" href="#Important-libraries"><span>Important libraries</span></a></li></ul></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="developing.html">Developing Persefone</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="developing.html">Developing Persefone</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/developing.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Developing-Persefone"><a class="docs-heading-anchor" href="#Developing-Persefone">Developing Persefone</a><a id="Developing-Persefone-1"></a><a class="docs-heading-anchor-permalink" href="#Developing-Persefone" title="Permalink"></a></h1><h2 id="Setting-up"><a class="docs-heading-anchor" href="#Setting-up">Setting up</a><a id="Setting-up-1"></a><a class="docs-heading-anchor-permalink" href="#Setting-up" title="Permalink"></a></h2><p>If you haven't worked with Julia before, here are detailed instructions for how to set up your development environment. The main development is currently done on Linux (and as the primary execution platform will be an HPC, Linux compatibility is important), but developing on Windows works too.</p><h3 id="Visual-Studio-Code-on-Windows"><a class="docs-heading-anchor" href="#Visual-Studio-Code-on-Windows">Visual Studio Code on Windows</a><a id="Visual-Studio-Code-on-Windows-1"></a><a class="docs-heading-anchor-permalink" href="#Visual-Studio-Code-on-Windows" title="Permalink"></a></h3><ol><li><p>Download and install <a href="https://julialang.org/downloads/">Julia</a>, <a href="https://git-scm.com/download/win">git</a> and <a href="https://code.visualstudio.com/">Visual Studio Code</a>.</p></li><li><p>Install the <a href="https://www.julia-vscode.org/">Julia extension for VS Code</a>: In VS Code, open the extensions pane (<code>Ctrl+Shift+X</code>). Search for and install Julia Language Support.</p></li><li><p>Clone the <a href="https://git.idiv.de/persefone/persefone-model.git">Gitlab repository</a>: In VS Code, open the source control pane (<code>Ctrl+Shift+G</code>). Click on <code>Clone</code> and enter the repo URL. Then select a folder on your computer to download the files into, and let VS Code open the project once it has been cloned.</p></li><li><p>Start a Julia REPL: In VS Code, bring up the command palette (<code>Ctrl+Shift+P</code>). Execute the command <code>Julia: Start REPL</code>. Then install all dependencies of Persefone by running <code>using Pkg; Pkg.activate("."); Pkg.instantiate()</code>. (This will take some time.)</p></li><li><p>Open the file <code>run.jl</code> and click <code>Execute</code> (triangular button in the top right). The source code will compile (this can take a lot of time the first time you do it) and run a default simulation.</p></li><li><p>Further steps: You may want to familiarise yourself with how to use <a href="https://code.visualstudio.com/docs/sourcecontrol/overview">git with VS Code</a>. You may also want to clone the Persefone Desktop <a href="https://git.idiv.de/persefone/persefone-desktop.git">repository</a> (repeat steps 3 to 5).</p></li></ol><h3 id="Emacs-on-Linux"><a class="docs-heading-anchor" href="#Emacs-on-Linux">Emacs on Linux</a><a id="Emacs-on-Linux-1"></a><a class="docs-heading-anchor-permalink" href="#Emacs-on-Linux" title="Permalink"></a></h3><p><em>You can of course also use VS Code on Linux. In that case, follow the instructions above.</em></p><p>Make sure you have git and Julia installed. Git should be in your distro's repos (e.g. <code>sudo apt install git</code>). To install Julia, <a href="https://julialang.org/downloads/">download</a> the binary and unpack it. For greater ease of use, copy the unpacked files to <code>/usr/local/lib/julia</code> (or similar) and create a symlink to the executable: <code>sudo ln -s /usr/local/lib/julia/bin/julia /usr/local/bin/julia</code>. Then go the to folder that you want to use for development and run <code>git clone https://git.idiv.de/persefone/persefone-model.git .</code> in your terminal.</p><p>There are a couple of addons that make working with Julia much nicer in Emacs:</p><ol><li><p><code>julia-mode</code> gives syntax highlighting. Install with <code>M-x package-install julia-mode</code>.</p></li><li><p><a href="https://github.com/gcv/julia-snail"><code>julia-snail</code></a> provides IDE-like features, especially a fully-functional REPL and the ability to evaluate code straight from inside a buffer. Note that the installation can be somewhat tricky. You first need to manually install all the dependencies of its dependency <a href="https://github.com/akermu/emacs-libvterm">vterm</a>, then install vterm itself with <code>M-x package-install vterm</code>, <em>before</em> you can do <code>M-x package-install julia-snail</code>. Then add it to your <code>init.el</code> with <code>(require 'julia-snail)</code> and <code>(add-hook 'julia-mode-hook #'julia-snail-mode)</code>.</p></li><li><p><a href="http://company-mode.github.io/"><code>company-mode</code></a> integrates with Snail to give code completion. Install with <code>M-x package-install company</code>, then add <code>(add-hook 'julia-mode-hook #'company-mode)</code> and <code>(global-set-key (kbd "C-<tab>") 'company-complete)</code> to your <code>init.el</code>.</p></li><li><p><a href="https://magit.vc/"><code>magit</code></a> is a great git interface for Emacs. Install with <code>M-x package-install magit</code> and add <code>(global-set-key (kbd "C-x g") 'magit-status)</code> to your <code>init.el</code>.</p></li></ol><h2 id="Development-workflow"><a class="docs-heading-anchor" href="#Development-workflow">Development workflow</a><a id="Development-workflow-1"></a><a class="docs-heading-anchor-permalink" href="#Development-workflow" title="Permalink"></a></h2><ol><li><p>Pull the current version from the master branch on Gitlab: <a href="https://git.idiv.de/persefone/persefone-model">https://git.idiv.de/persefone/persefone-model</a>.</p></li><li><p>If you are working on a new feature, create a new branch to avoid breaking the <code>master</code> branch. (The <code>master</code> branch on Github should always be in a runnable and error-free state.)</p></li><li><p>Implement your changes.</p></li><li><p>Run an example simulation and the test suite to make sure everything works without crashing (<code>make run</code> and <code>make test</code> on Linux, or execute <code>run.jl</code> and <code>test/runtests.jl</code> manually.)</p></li><li><p>Commit your work frequently, and try to keep each commit small. Don't forget to add relevant tests to the test suite.</p></li><li><p>Once your satisfied with your work, do another pull/merge from the <code>master</code> branch in case somebody else changed the branch in the meantime. Then merge your work into <code>master</code> and push to the Gitlab server.</p></li><li><p>Repeat :-)</p></li></ol><p>The Gitlab <a href="https://git.idiv.de/persefone/persefone-model/-/boards/373">issue tracker</a> can be used to create, discuss, and assign tasks, as well as to monitor progress towards milestones/releases. Once we have a first release, we will start using <a href="https://semver.org/">semantic versioning</a> and a <a href="https://keepachangelog.com/en/1.0.0/">changelog</a>.</p><h2 id="Important-libraries"><a class="docs-heading-anchor" href="#Important-libraries">Important libraries</a><a id="Important-libraries-1"></a><a class="docs-heading-anchor-permalink" href="#Important-libraries" title="Permalink"></a></h2><h3 id="Revise.jl"><a class="docs-heading-anchor" href="#Revise.jl">Revise.jl</a><a id="Revise.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Revise.jl" title="Permalink"></a></h3><p><a href="https://timholy.github.io/Revise.jl/stable/"><code>Revise.jl</code></a> allows one to reload code without restarting the Julia interpreter. Get it with <code>Pkg.add("Revise")</code>, then add <code>using Revise</code> to <code>.julia/config/startup.jl</code> to have it automatically available.</p><h3 id="Test"><a class="docs-heading-anchor" href="#Test">Test</a><a id="Test-1"></a><a class="docs-heading-anchor-permalink" href="#Test" title="Permalink"></a></h3><p>Persefone uses the inbuilt Julia <a href="https://docs.julialang.org/en/v1/stdlib/Test/">testing framework</a>. All new functions should have appropriate tests written for them in the appropriate file in the <code>test</code> directory. (See <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/test/runtests.jl"><code>test/runtests.jl</code></a> for details.) There are three ways to run the test suite: in the terminal, executing <code>make test</code> or <code>cd test; julia runtests.jl</code>; or in the Julia REPL, <code>Pkg.activate("."); Pkg.test()</code>.</p><h3 id="Documenter.jl"><a class="docs-heading-anchor" href="#Documenter.jl">Documenter.jl</a><a id="Documenter.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Documenter.jl" title="Permalink"></a></h3><p>The HTML documentation is generated using <a href="https://documenter.juliadocs.org">Documenter.jl</a>. Therefore, all new functions should have docstrings attached. New files need to be integrated into the relevant documentation source files in <code>docs/src</code>, and if necessary into <a href="https://git.idiv.de/xo30xoqa/persephone/-/blob/master/docs/builddocs.jl"><code>docs/builddocs.jl</code></a>. To build the documentation, run <code>make docs</code>, or <code>cd docs; julia builddocs.jl</code> (if using the latter, don't forget to update the date and commit in <code>docs/src/index.md</code>).</p><h3 id="Graphics-and-user-interface"><a class="docs-heading-anchor" href="#Graphics-and-user-interface">Graphics and user interface</a><a id="Graphics-and-user-interface-1"></a><a class="docs-heading-anchor-permalink" href="#Graphics-and-user-interface" title="Permalink"></a></h3><p>Persefone uses <a href="https://makie.org/">Makie</a> as a plotting library to generate its output graphics. Additionally, Persefone Desktop uses <a href="https://github.com/JuliaGraphics/QML.jl">QML.jl</a> to create its graphical user interface.</p><h3 id="Unitful.jl"><a class="docs-heading-anchor" href="#Unitful.jl">Unitful.jl</a><a id="Unitful.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Unitful.jl" title="Permalink"></a></h3><p>Throughout the source code, variables can be tagged with their appropriate units using the <a href="https://painterqubits.github.io/Unitful.jl/stable/">Unitful.jl</a> library. This makes the code easier to understand, and also allows automatic unit conversion:</p><pre><code class="language-julia hljs">julia> 1ha == 10000m² true julia> 2km |> m 2000 m julia> 2km / 10m -200.0</code></pre><p>Within Persefone, the following units and dimensions have been imported for direct usage: <code>cm</code>, <code>m</code>, <code>km</code>, <code>m²</code>, <code>ha</code>, <code>km²</code>, <code>mg</code>, <code>g</code>, <code>kg</code>, <code>Length</code>, <code>Area</code>, <code>Mass</code>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="config.html">« Configuration</a><a class="docs-footer-nextpage" href="adapting.html">Adapting Persefone »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +200.0</code></pre><p>Within Persefone, the following units and dimensions have been imported for direct usage: <code>cm</code>, <code>m</code>, <code>km</code>, <code>m²</code>, <code>ha</code>, <code>km²</code>, <code>mg</code>, <code>g</code>, <code>kg</code>, <code>Length</code>, <code>Area</code>, <code>Mass</code>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="skylark.html">« Skylark</a><a class="docs-footer-nextpage" href="adapting.html">Adapting Persefone »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/energy.html b/docs/build/energy.html index 55684d228a1badaa3665aaef82fd83c3b430f3b2..b635d5d7b8eeed85e8815c42d7890e2263423b7d 100644 --- a/docs/build/energy.html +++ b/docs/build/energy.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Dynamic Energy Budgets · Persefone.jl</title><meta name="title" content="Dynamic Energy Budgets · Persefone.jl"/><meta property="og:title" content="Dynamic Energy Budgets · Persefone.jl"/><meta property="twitter:title" content="Dynamic Energy Budgets · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li class="is-active"><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a><ul class="internal"><li><a class="tocitem" href="#energy.jl"><span>energy.jl</span></a></li></ul></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Nature</a></li><li class="is-active"><a href="energy.html">Dynamic Energy Budgets</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="energy.html">Dynamic Energy Budgets</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/energy.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Dynamic-Energy-Budgets"><a class="docs-heading-anchor" href="#Dynamic-Energy-Budgets">Dynamic Energy Budgets</a><a id="Dynamic-Energy-Budgets-1"></a><a class="docs-heading-anchor-permalink" href="#Dynamic-Energy-Budgets" title="Permalink"></a></h1><p>Persefone's nature module uses Kooijman's Dynamic Energy Budget theory to model energy flows within individuals.</p><p><img src="assets/deb.png" alt=""The standard model of the Dynamic Energy Budget theory""/></p><p><em>The standard model of the Dynamic Energy Budget theory. (Fig. 1 from Sousa et al. (2010).)</em></p><ul><li><p><a href="https://doi.org/10.1098/rstb.2010.0166">Sousa et al. (2010)</a>. Dynamic energy budget theory restores coherence in biology. Philosophical Transactions of the Royal Society B: Biological Sciences, 365(1557), 3413–3428.</p></li><li><p><a href="https://www.researchgate.net/profile/Edgar-Meza-3/post/Is_there_a_toxicokinetic_model_for_daphnia_magna_or_other_zooplankton/attachment/59d62cf579197b807798b396/AS%3A348547653357569%401460111644286/download/Dynamic+Energy+Budget+theory+-+Kooijman.pdf">Kooijman, S. A. L. M. (2009)</a>. Dynamic energy and mass budgets in biological systems (3rd ed). Cambridge University Press.</p></li><li><p><a href="https://doi.org/10.1111/2041-210x.12002">Sibly et al. (2013)</a>. Representing the acquisition and use of energy by individuals in agent-based models of animal populations. Methods in Ecology and Evolution, 4(2), 151–161.</p></li></ul><h2 id="energy.jl"><a class="docs-heading-anchor" href="#energy.jl">energy.jl</a><a id="energy.jl-1"></a><a class="docs-heading-anchor-permalink" href="#energy.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.DEBparameters" href="#Persefone.DEBparameters"><code>Persefone.DEBparameters</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">DEBparameters</code></pre><p>An immutable struct to save the parameter list for a species' Dynamic Energy Budget model. (See Sousa et al., 2010.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L10-L15">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.EnergyBudget" href="#Persefone.EnergyBudget"><code>Persefone.EnergyBudget</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">EnergyBudget</code></pre><p>This struct represents an individual's energy balance, as conceptualised by the Dynamic Energy Budget theory. Upon assimilation, energy is first stored as biomass in a reserve buffer, before being used for maintenance, growth, and reproduction. (Note that this is a simplified model form which ignores maturity as a separate buffer.)</p><p><strong>Sources:</strong></p><ul><li>Malishev & Kramer-Schadt (2021). Movement, models, and metabolism: Individual-based energy budget models as next-generation extensions for predicting animal movement outcomes across scales. Ecological Modelling, 441, 109413. https://doi.org/10.1016/j.ecolmodel.2020.109413</li><li>Marques et al. (2018). The AmP project: Comparing species on the basis of dynamic energy budget parameters. PLOS Computational Biology,14(5), e1006100. https://doi.org/10.1371/journal.pcbi.1006100</li><li>Sibly et al. (2013). Representing the acquisition and use of energy by individuals in agent-based models of animal populations. Methods in Ecology and Evolution, 4(2), 151–161. https://doi.org/10.1111/2041-210x.12002</li><li>Sousa et al. (2010). Dynamic energy budget theory restores coherence in biology. Philosophical Transactions of the Royal Society B: Biological Sciences, 365(1557), 3413–3428. https://doi.org/10.1098/rstb.2010.0166</li><li>Kooijman, S. A. L. M. (2009). Dynamic energy and mass budgets in biological systems (3rd ed). Cambridge University Press. https://www.researchgate.net/profile/Edgar-Meza-3/post/Is<em>there</em>a<em>toxicokinetic</em>model<em>for</em>daphnia<em>magna</em>or<em>other</em>zooplankton/attachment/59d62cf579197b807798b396/AS%3A348547653357569%401460111644286/download/Dynamic+Energy+Budget+theory+-+Kooijman.pdf</li><li><em>compare with:</em> Brown et al. (2004). Toward a metabolic theory of ecology. Ecology, 85(7), 1771–1789. https://doi.org/10.1890/03-9000</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L31-L47">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.feed!-Tuple{Float64, Persefone.EnergyBudget}" href="#Persefone.feed!-Tuple{Float64, Persefone.EnergyBudget}"><code>Persefone.feed!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">feed!(quantity, energybudget)</code></pre><p>Consume a given quantity of food. Expands the energy reserve by an amount determined by the assimilation rate. Returns <code>true</code> if successful, <code>false</code> if the reserve is already full.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L208-L214">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.growthrate-Tuple{Persefone.EnergyBudget}" href="#Persefone.growthrate-Tuple{Persefone.EnergyBudget}"><code>Persefone.growthrate</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">growthrate(energybudget)</code></pre><p>Calculate the specific growth rate r. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L116-L121">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.investmentratio-Tuple{Persefone.EnergyBudget}" href="#Persefone.investmentratio-Tuple{Persefone.EnergyBudget}"><code>Persefone.investmentratio</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">investmentratio(energybudget)</code></pre><p>Calculate the investment ratio g. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L100-L105">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.maturitymaintenance-Tuple{Persefone.EnergyBudget}" href="#Persefone.maturitymaintenance-Tuple{Persefone.EnergyBudget}"><code>Persefone.maturitymaintenance</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">maturitymaintenance(energybudget)</code></pre><p>Calculate the specific maturity maintenance k_J. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L72-L77">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.mobilisation-Tuple{Persefone.EnergyBudget}" href="#Persefone.mobilisation-Tuple{Persefone.EnergyBudget}"><code>Persefone.mobilisation</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">mobilisation(energybudget)</code></pre><p>Calculate the mobilisation rate J_EC. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L137-L142">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.reproduce!-Tuple{Persefone.EnergyBudget}" href="#Persefone.reproduce!-Tuple{Persefone.EnergyBudget}"><code>Persefone.reproduce!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">reproduce!(energybudget)</code></pre><p>If there is sufficient energy in the <code>offspring</code> buffer of an adult, produce an embryo/egg, reducing the parent energy in the process. Returns the embryo's energy budget, or <code>nothing</code> if the conditions are not met.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L235-L241">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.scaledreservedensity-Tuple{Persefone.EnergyBudget}" href="#Persefone.scaledreservedensity-Tuple{Persefone.EnergyBudget}"><code>Persefone.scaledreservedensity</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">scaledreservedensity(energybudget)</code></pre><p>Calculate the scaled reserve density e. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L86-L91">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.update!-Tuple{Persefone.EnergyBudget}" href="#Persefone.update!-Tuple{Persefone.EnergyBudget}"><code>Persefone.update!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">update!(energybudget)</code></pre><p>Carry out a daily update of the energy budget. Mobilises reserves and allocates these to maintenance (prioritised), growth, and reproduction.</p><p>Return <code>true</code> if the individual has enough energy to survive, or <code>false</code> if the reserve is empty and it starves.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L155-L163">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.volumetriclength-Tuple{Persefone.EnergyBudget}" href="#Persefone.volumetriclength-Tuple{Persefone.EnergyBudget}"><code>Persefone.volumetriclength</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">volumetriclength(energybudget)</code></pre><p>Calculate the structural length in cm based on an individual's weight (assuming a density of 1 g/cm³ to calculate volume, see Kooijman 2009).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/energy.jl#L59-L64">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="nature.html">« Nature</a><a class="docs-footer-nextpage" href="species.html">Species »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Dynamic Energy Budgets · Persefone.jl</title><meta name="title" content="Dynamic Energy Budgets · Persefone.jl"/><meta property="og:title" content="Dynamic Energy Budgets · Persefone.jl"/><meta property="twitter:title" content="Dynamic Energy Budgets · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="energy.html">Dynamic Energy Budgets</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="energy.html">Dynamic Energy Budgets</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/energy.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Dynamic-Energy-Budgets"><a class="docs-heading-anchor" href="#Dynamic-Energy-Budgets">Dynamic Energy Budgets</a><a id="Dynamic-Energy-Budgets-1"></a><a class="docs-heading-anchor-permalink" href="#Dynamic-Energy-Budgets" title="Permalink"></a></h1><p><strong>NOTE: currently not used.</strong></p><p>Persefone's nature module uses Kooijman's Dynamic Energy Budget theory to model energy flows within individuals.</p><p><img src="assets/deb.png" alt=""The standard model of the Dynamic Energy Budget theory""/></p><p><em>The standard model of the Dynamic Energy Budget theory. (Fig. 1 from Sousa et al. (2010).)</em></p><ul><li><p><a href="https://doi.org/10.1098/rstb.2010.0166">Sousa et al. (2010)</a>. Dynamic energy budget theory restores coherence in biology. Philosophical Transactions of the Royal Society B: Biological Sciences, 365(1557), 3413–3428.</p></li><li><p><a href="https://www.researchgate.net/profile/Edgar-Meza-3/post/Is_there_a_toxicokinetic_model_for_daphnia_magna_or_other_zooplankton/attachment/59d62cf579197b807798b396/AS%3A348547653357569%401460111644286/download/Dynamic+Energy+Budget+theory+-+Kooijman.pdf">Kooijman, S. A. L. M. (2009)</a>. Dynamic energy and mass budgets in biological systems (3rd ed). Cambridge University Press.</p></li><li><p><a href="https://doi.org/10.1111/2041-210x.12002">Sibly et al. (2013)</a>. Representing the acquisition and use of energy by individuals in agent-based models of animal populations. Methods in Ecology and Evolution, 4(2), 151–161.</p></li></ul><h2 id="energy.jl"><a class="docs-heading-anchor" href="#energy.jl">energy.jl</a><a id="energy.jl-1"></a><a class="docs-heading-anchor-permalink" href="#energy.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.DEBparameters" href="#Persefone.DEBparameters"><code>Persefone.DEBparameters</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">DEBparameters</code></pre><p>An immutable struct to save the parameter list for a species' Dynamic Energy Budget model. (See Sousa et al., 2010.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L13-L18">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.EnergyBudget" href="#Persefone.EnergyBudget"><code>Persefone.EnergyBudget</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">EnergyBudget</code></pre><p>This struct represents an individual's energy balance, as conceptualised by the Dynamic Energy Budget theory. Upon assimilation, energy is first stored as biomass in a reserve buffer, before being used for maintenance, growth, and reproduction. (Note that this is a simplified model form which ignores maturity as a separate buffer.)</p><p><strong>Sources:</strong></p><ul><li>Malishev & Kramer-Schadt (2021). Movement, models, and metabolism: Individual-based energy budget models as next-generation extensions for predicting animal movement outcomes across scales. Ecological Modelling, 441, 109413. https://doi.org/10.1016/j.ecolmodel.2020.109413</li><li>Marques et al. (2018). The AmP project: Comparing species on the basis of dynamic energy budget parameters. PLOS Computational Biology,14(5), e1006100. https://doi.org/10.1371/journal.pcbi.1006100</li><li>Sibly et al. (2013). Representing the acquisition and use of energy by individuals in agent-based models of animal populations. Methods in Ecology and Evolution, 4(2), 151–161. https://doi.org/10.1111/2041-210x.12002</li><li>Sousa et al. (2010). Dynamic energy budget theory restores coherence in biology. Philosophical Transactions of the Royal Society B: Biological Sciences, 365(1557), 3413–3428. https://doi.org/10.1098/rstb.2010.0166</li><li>Kooijman, S. A. L. M. (2009). Dynamic energy and mass budgets in biological systems (3rd ed). Cambridge University Press. https://www.researchgate.net/profile/Edgar-Meza-3/post/Is<em>there</em>a<em>toxicokinetic</em>model<em>for</em>daphnia<em>magna</em>or<em>other</em>zooplankton/attachment/59d62cf579197b807798b396/AS%3A348547653357569%401460111644286/download/Dynamic+Energy+Budget+theory+-+Kooijman.pdf</li><li><em>compare with:</em> Brown et al. (2004). Toward a metabolic theory of ecology. Ecology, 85(7), 1771–1789. https://doi.org/10.1890/03-9000</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L34-L50">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.feed!-Tuple{Float64, Persefone.EnergyBudget}" href="#Persefone.feed!-Tuple{Float64, Persefone.EnergyBudget}"><code>Persefone.feed!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">feed!(quantity, energybudget)</code></pre><p>Consume a given quantity of food. Expands the energy reserve by an amount determined by the assimilation rate. Returns <code>true</code> if successful, <code>false</code> if the reserve is already full.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L211-L217">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.growthrate-Tuple{Persefone.EnergyBudget}" href="#Persefone.growthrate-Tuple{Persefone.EnergyBudget}"><code>Persefone.growthrate</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">growthrate(energybudget)</code></pre><p>Calculate the specific growth rate r. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L119-L124">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.investmentratio-Tuple{Persefone.EnergyBudget}" href="#Persefone.investmentratio-Tuple{Persefone.EnergyBudget}"><code>Persefone.investmentratio</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">investmentratio(energybudget)</code></pre><p>Calculate the investment ratio g. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L103-L108">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.maturitymaintenance-Tuple{Persefone.EnergyBudget}" href="#Persefone.maturitymaintenance-Tuple{Persefone.EnergyBudget}"><code>Persefone.maturitymaintenance</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">maturitymaintenance(energybudget)</code></pre><p>Calculate the specific maturity maintenance k_J. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L75-L80">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.mobilisation-Tuple{Persefone.EnergyBudget}" href="#Persefone.mobilisation-Tuple{Persefone.EnergyBudget}"><code>Persefone.mobilisation</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">mobilisation(energybudget)</code></pre><p>Calculate the mobilisation rate J_EC. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L140-L145">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.reproduce!-Tuple{Persefone.EnergyBudget}" href="#Persefone.reproduce!-Tuple{Persefone.EnergyBudget}"><code>Persefone.reproduce!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">reproduce!(energybudget)</code></pre><p>If there is sufficient energy in the <code>offspring</code> buffer of an adult, produce an embryo/egg, reducing the parent energy in the process. Returns the embryo's energy budget, or <code>nothing</code> if the conditions are not met.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L238-L244">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.scaledreservedensity-Tuple{Persefone.EnergyBudget}" href="#Persefone.scaledreservedensity-Tuple{Persefone.EnergyBudget}"><code>Persefone.scaledreservedensity</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">scaledreservedensity(energybudget)</code></pre><p>Calculate the scaled reserve density e. (Internal function.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L89-L94">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.update!-Tuple{Persefone.EnergyBudget}" href="#Persefone.update!-Tuple{Persefone.EnergyBudget}"><code>Persefone.update!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">update!(energybudget)</code></pre><p>Carry out a daily update of the energy budget. Mobilises reserves and allocates these to maintenance (prioritised), growth, and reproduction.</p><p>Return <code>true</code> if the individual has enough energy to survive, or <code>false</code> if the reserve is empty and it starves.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L158-L166">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.volumetriclength-Tuple{Persefone.EnergyBudget}" href="#Persefone.volumetriclength-Tuple{Persefone.EnergyBudget}"><code>Persefone.volumetriclength</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">volumetriclength(energybudget)</code></pre><p>Calculate the structural length in cm based on an individual's weight (assuming a density of 1 g/cm³ to calculate volume, see Kooijman 2009).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/energy.jl#L62-L67">source</a></section></article></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/farm.html b/docs/build/farm.html index 8bc97057baa4eb7bb84208e3d9f516a01468b02b..7460afe9d63caf917cc317c9e7fbbf201da19ed9 100644 --- a/docs/build/farm.html +++ b/docs/build/farm.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Farm submodel · Persefone.jl</title><meta name="title" content="Farm submodel · Persefone.jl"/><meta property="og:title" content="Farm submodel · Persefone.jl"/><meta property="twitter:title" content="Farm submodel · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li class="is-active"><a class="tocitem" href="farm.html">Farm submodel</a><ul class="internal"><li><a class="tocitem" href="#farm.jl"><span>farm.jl</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="farm.html">Farm submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="farm.html">Farm submodel</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/farm.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Farm-submodel"><a class="docs-heading-anchor" href="#Farm-submodel">Farm submodel</a><a id="Farm-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Farm-submodel" title="Permalink"></a></h1><p>Eventually, the aim is to create a full socio-economic farm decision model for Persefone. However, for the time being, we will restrict ourselves to a simple model that executes typical farm operations and crop rotations.</p><h2 id="farm.jl"><a class="docs-heading-anchor" href="#farm.jl">farm.jl</a><a id="farm.jl-1"></a><a class="docs-heading-anchor-permalink" href="#farm.jl" title="Permalink"></a></h2><p>This file is responsible for managing the farm module(s).</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Farmer" href="#Persefone.Farmer"><code>Persefone.Farmer</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Farmer</code></pre><p>This is the agent type for the farm ABM. (Not yet implemented.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/farm/farm.jl#L6-L10">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initfarms!-Tuple{SimulationModel}" href="#Persefone.initfarms!-Tuple{SimulationModel}"><code>Persefone.initfarms!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initfarms!(model)</code></pre><p>Initialise the model with a set of farm agents.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/farm/farm.jl#L29-L33">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepagent!-Tuple{Farmer, SimulationModel}" href="#Persefone.stepagent!-Tuple{Farmer, SimulationModel}"><code>Persefone.stepagent!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(farmer, model)</code></pre><p>Update a farmer by one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/farm/farm.jl#L20-L24">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="crops.html">« Crop submodel</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Farm submodel · Persefone.jl</title><meta name="title" content="Farm submodel · Persefone.jl"/><meta property="og:title" content="Farm submodel · Persefone.jl"/><meta property="twitter:title" content="Farm submodel · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li class="is-active"><a class="tocitem" href="farm.html">Farm submodel</a><ul class="internal"><li><a class="tocitem" href="#farm.jl"><span>farm.jl</span></a></li></ul></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Software API</a></li><li class="is-active"><a href="farm.html">Farm submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="farm.html">Farm submodel</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/farm.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Farm-submodel"><a class="docs-heading-anchor" href="#Farm-submodel">Farm submodel</a><a id="Farm-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Farm-submodel" title="Permalink"></a></h1><p>Eventually, the aim is to create a full socio-economic farm decision model for Persefone. However, for the time being, we will restrict ourselves to a simple model that executes typical farm operations and crop rotations.</p><h2 id="farm.jl"><a class="docs-heading-anchor" href="#farm.jl">farm.jl</a><a id="farm.jl-1"></a><a class="docs-heading-anchor-permalink" href="#farm.jl" title="Permalink"></a></h2><p>This file is responsible for managing the farm module(s).</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Farmer" href="#Persefone.Farmer"><code>Persefone.Farmer</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Farmer</code></pre><p>This is the agent type for the farm ABM. (Not yet implemented.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/farm/farm.jl#L6-L10">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initfarms!-Tuple{SimulationModel}" href="#Persefone.initfarms!-Tuple{SimulationModel}"><code>Persefone.initfarms!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initfarms!(model)</code></pre><p>Initialise the model with a set of farm agents.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/farm/farm.jl#L29-L33">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepagent!-Tuple{Farmer, SimulationModel}" href="#Persefone.stepagent!-Tuple{Farmer, SimulationModel}"><code>Persefone.stepagent!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(farmer, model)</code></pre><p>Update a farmer by one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/farm/farm.jl#L20-L24">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="crops.html">« Crop submodel</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/gis.html b/docs/build/gis.html index bca55d4c226b526fbd1029e0e61ba258c10217a2..2a83f1123d7ee94ace2f140228e4d43dfb9971e5 100644 --- a/docs/build/gis.html +++ b/docs/build/gis.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Maps and weather data · Persefone.jl</title><meta name="title" content="Maps and weather data · Persefone.jl"/><meta property="og:title" content="Maps and weather data · Persefone.jl"/><meta property="twitter:title" content="Maps and weather data · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li class="is-active"><a class="tocitem" href="gis.html">Maps and weather data</a><ul class="internal"><li><a class="tocitem" href="#Land-cover-maps"><span>Land cover maps</span></a></li><li><a class="tocitem" href="#Field-ID-maps"><span>Field ID maps</span></a></li><li><a class="tocitem" href="#Weather-data"><span>Weather data</span></a></li></ul></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="gis.html">Maps and weather data</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="gis.html">Maps and weather data</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/gis.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Maps-and-weather-data"><a class="docs-heading-anchor" href="#Maps-and-weather-data">Maps and weather data</a><a id="Maps-and-weather-data-1"></a><a class="docs-heading-anchor-permalink" href="#Maps-and-weather-data" title="Permalink"></a></h1><p>Persefone currently requires two separate map input files: one for land cover, the other for field geometry. Additionally, a weather input file is needed. This documents describe how to obtain and process the data needed for each of these.</p><h2 id="Land-cover-maps"><a class="docs-heading-anchor" href="#Land-cover-maps">Land cover maps</a><a id="Land-cover-maps-1"></a><a class="docs-heading-anchor-permalink" href="#Land-cover-maps" title="Permalink"></a></h2><p>Land cover maps for Germany at 10m resolution can be obtained from <a href="https://data.mundialis.de/geonetwork/srv/eng/catalog.search#/metadata/9246503f-6adf-460b-a31e-73a649182d07">Mundialis</a>. These are generated annually from Sentinel data and comprise the following land cover classes:</p><pre><code class="nohighlight hljs">10: forest +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Maps and weather data · Persefone.jl</title><meta name="title" content="Maps and weather data · Persefone.jl"/><meta property="og:title" content="Maps and weather data · Persefone.jl"/><meta property="twitter:title" content="Maps and weather data · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li class="is-active"><a class="tocitem" href="gis.html">Maps and weather data</a><ul class="internal"><li><a class="tocitem" href="#Land-cover-maps"><span>Land cover maps</span></a></li><li><a class="tocitem" href="#Field-ID-maps"><span>Field ID maps</span></a></li><li><a class="tocitem" href="#Weather-data"><span>Weather data</span></a></li></ul></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="gis.html">Maps and weather data</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="gis.html">Maps and weather data</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/gis.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Maps-and-weather-data"><a class="docs-heading-anchor" href="#Maps-and-weather-data">Maps and weather data</a><a id="Maps-and-weather-data-1"></a><a class="docs-heading-anchor-permalink" href="#Maps-and-weather-data" title="Permalink"></a></h1><p>Persefone currently requires two separate map input files: one for land cover, the other for field geometry. Additionally, a weather input file is needed. This documents describe how to obtain and process the data needed for each of these.</p><h2 id="Land-cover-maps"><a class="docs-heading-anchor" href="#Land-cover-maps">Land cover maps</a><a id="Land-cover-maps-1"></a><a class="docs-heading-anchor-permalink" href="#Land-cover-maps" title="Permalink"></a></h2><p>Land cover maps for Germany at 10m resolution can be obtained from <a href="https://data.mundialis.de/geonetwork/srv/eng/catalog.search#/metadata/9246503f-6adf-460b-a31e-73a649182d07">Mundialis</a>. These are generated annually from Sentinel data and comprise the following land cover classes:</p><pre><code class="nohighlight hljs">10: forest 20: low vegetation 30: water 40: built-up @@ -26,4 +26,4 @@ weather = data %>% min_temperature=na_if(TNK, -999), TNK=NULL) ## replace with the desired file name -write.csv(weather, file="weather_jena.csv", row.names=FALSE)</code></pre><p><em>Note: for calculating the reference evapotranspiration ET_0 (needed for the AquaCrop model), use the <a href="https://www.fao.org/3/X0490E/x0490e06.htm#equation">FAO Penman-Monteith equation</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="architecture.html">« Source code architecture</a><a class="docs-footer-nextpage" href="species-dsl.html">Defining new species »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +write.csv(weather, file="weather_jena.csv", row.names=FALSE)</code></pre><p><em>Note: for calculating the reference evapotranspiration ET_0 (needed for the AquaCrop model), use the <a href="https://www.fao.org/3/X0490E/x0490e06.htm#equation">FAO Penman-Monteith equation</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="architecture.html">« Source code architecture</a><a class="docs-footer-nextpage" href="species-dsl.html">Defining new species »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/gui.html b/docs/build/gui.html index 524985474516c0591b807277f006304dc3f1ae05..4ffd71226e72936b809b67ca9f11c42b168f531e 100644 --- a/docs/build/gui.html +++ b/docs/build/gui.html @@ -1,7 +1,7 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Graphical User Interface · Persefone.jl</title><meta name="title" content="Graphical User Interface · Persefone.jl"/><meta property="og:title" content="Graphical User Interface · Persefone.jl"/><meta property="twitter:title" content="Graphical User Interface · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li class="is-active"><a class="tocitem" href="gui.html">Graphical User Interface</a><ul class="internal"><li><a class="tocitem" href="#Install-and-run"><span>Install and run</span></a></li><li><a class="tocitem" href="#User-interface"><span>User interface</span></a></li></ul></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">User guide</a></li><li class="is-active"><a href="gui.html">Graphical User Interface</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="gui.html">Graphical User Interface</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/gui.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Graphical-User-Interface"><a class="docs-heading-anchor" href="#Graphical-User-Interface">Graphical User Interface</a><a id="Graphical-User-Interface-1"></a><a class="docs-heading-anchor-permalink" href="#Graphical-User-Interface" title="Permalink"></a></h1><p>Due to the computational demands of simulating many individuals at high temporal and spatial resolution, Persefone.jl is primarily designed to be run non-interactively on an HPC. However, to allow interactive exploratory simulations to be conducted while learning or developing the model, a graphical user interface is available as an additional package: <a href="https://git.idiv.de/persefone/persefone-desktop">Persefone Desktop</a>.</p><h2 id="Install-and-run"><a class="docs-heading-anchor" href="#Install-and-run">Install and run</a><a id="Install-and-run-1"></a><a class="docs-heading-anchor-permalink" href="#Install-and-run" title="Permalink"></a></h2><p><em>For more detailed installation instructions, see <a href="developing.html">here</a>.</em></p><p><strong>To install:</strong> Install <a href="https://julialang.org/downloads/">Julia</a> and download/clone the <a href="https://git.idiv.de/persefone/persefone-desktop">repository</a>. Open a Julia REPL in the downloaded folder and execute the following to install all dependencies:</p><pre><code class="language-julia hljs">using Pkg +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Graphical User Interface · Persefone.jl</title><meta name="title" content="Graphical User Interface · Persefone.jl"/><meta property="og:title" content="Graphical User Interface · Persefone.jl"/><meta property="twitter:title" content="Graphical User Interface · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li class="is-active"><a class="tocitem" href="gui.html">Graphical User Interface</a><ul class="internal"><li><a class="tocitem" href="#Install-and-run"><span>Install and run</span></a></li><li><a class="tocitem" href="#User-interface"><span>User interface</span></a></li></ul></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">User guide</a></li><li class="is-active"><a href="gui.html">Graphical User Interface</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="gui.html">Graphical User Interface</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/gui.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Graphical-User-Interface"><a class="docs-heading-anchor" href="#Graphical-User-Interface">Graphical User Interface</a><a id="Graphical-User-Interface-1"></a><a class="docs-heading-anchor-permalink" href="#Graphical-User-Interface" title="Permalink"></a></h1><p>Due to the computational demands of simulating many individuals at high temporal and spatial resolution, Persefone.jl is primarily designed to be run non-interactively on an HPC. However, to allow interactive exploratory simulations to be conducted while learning or developing the model, a graphical user interface is available as an additional package: <a href="https://git.idiv.de/persefone/persefone-desktop">Persefone Desktop</a>.</p><h2 id="Install-and-run"><a class="docs-heading-anchor" href="#Install-and-run">Install and run</a><a id="Install-and-run-1"></a><a class="docs-heading-anchor-permalink" href="#Install-and-run" title="Permalink"></a></h2><p><em>For more detailed installation instructions, see <a href="developing.html">here</a>.</em></p><p><strong>To install:</strong> Install <a href="https://julialang.org/downloads/">Julia</a> and download/clone the <a href="https://git.idiv.de/persefone/persefone-desktop">repository</a>. Open a Julia REPL in the downloaded folder and execute the following to install all dependencies:</p><pre><code class="language-julia hljs">using Pkg Pkg.activate(".") Pkg.instantiate()</code></pre><p><strong>To run:</strong> Run <code>desktop.jl</code>. Alternatively, open a Julia REPL in this folder and run:</p><pre><code class="language-julia hljs">using Pkg Pkg.activate(".") using PersefoneDesktop -launch()</code></pre><p><em>Note:</em> Due to the necessary pre-compilation done by Julia, installing and launching the application can take quite a long time. (Start-up time with <code>desktop.jl</code> is currently about 2 minutes.) We will reduce this as much as possible in future releases.</p><h2 id="User-interface"><a class="docs-heading-anchor" href="#User-interface">User interface</a><a id="User-interface-1"></a><a class="docs-heading-anchor-permalink" href="#User-interface" title="Permalink"></a></h2><p><img src="assets/screenshot.png" alt="Persefone.jl Desktop screenshot"/></p><p>The main window component is the <strong>map view</strong>. This displays a land cover map of the simulated region: dark green are forests, light green grassland, yellow fields, red built-up areas and blue water. On it, little circles show the position of individual animals, with different species denoted by different colours.</p><h3 id="Control-bar"><a class="docs-heading-anchor" href="#Control-bar">Control bar</a><a id="Control-bar-1"></a><a class="docs-heading-anchor-permalink" href="#Control-bar" title="Permalink"></a></h3><ul><li><p><strong>Back button:</strong> Rewind the simulation by one day.</p></li><li><p><strong>Step button:</strong> Advance the simulation by one day.</p></li><li><p><strong>Run button:</strong> Run the simulation until the button is pressed again or the end date is reached.</p></li><li><p><strong>Progress bar:</strong> Shows the percentage of time elapsed between the start and end dates of the simulation.</p></li><li><p><strong>Speed slider:</strong> Set the time delay between each simulation step when running.</p></li><li><p><strong>Date:</strong> Shows the simulation date currently displayed on the map.</p></li></ul><h3 id="Menu-bar"><a class="docs-heading-anchor" href="#Menu-bar">Menu bar</a><a id="Menu-bar-1"></a><a class="docs-heading-anchor-permalink" href="#Menu-bar" title="Permalink"></a></h3><p><strong>Simulation:</strong></p><ul><li><p><strong>New simulation:</strong> Reset the model and start over.</p></li><li><p><strong>Configure simulation:</strong> Change the model settings (<em>not yet implemented</em>).</p></li><li><p><strong>Load saved state:</strong> Load a model object file saved by a previous simulation run.</p></li><li><p><strong>Save current state:</strong> Save a model object file for later use.</p></li><li><p><strong>Quit:</strong> Close the application.</p></li></ul><p><strong>Data:</strong></p><ul><li><p><strong>Show population graph:</strong> Show a window with a graph of population sizes over time in the current model run.</p></li><li><p><strong>Save simulation output:</strong> Save the model output data to file (saves both raw CSV data and generated graphics).</p></li></ul><p><strong>Help:</strong></p><ul><li><p><strong>Documentation:</strong> Open the Persefone.jl online documentation in a browser.</p></li><li><p><strong>Website:</strong> Open the main Persefone.jl website in a browser.</p></li><li><p><strong>About:</strong> Show a window with core information about the application.</p></li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="using.html">« The Persefone.jl Package</a><a class="docs-footer-nextpage" href="config.html">Configuration »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +launch()</code></pre><p><em>Note:</em> Due to the necessary pre-compilation done by Julia, installing and launching the application can take quite a long time. (Start-up time with <code>desktop.jl</code> is currently about 2 minutes.) We will reduce this as much as possible in future releases.</p><h2 id="User-interface"><a class="docs-heading-anchor" href="#User-interface">User interface</a><a id="User-interface-1"></a><a class="docs-heading-anchor-permalink" href="#User-interface" title="Permalink"></a></h2><p><img src="assets/screenshot.png" alt="Persefone.jl Desktop screenshot"/></p><p>The main window component is the <strong>map view</strong>. This displays a land cover map of the simulated region: dark green are forests, light green grassland, yellow fields, red built-up areas and blue water. On it, little circles show the position of individual animals, with different species denoted by different colours.</p><h3 id="Control-bar"><a class="docs-heading-anchor" href="#Control-bar">Control bar</a><a id="Control-bar-1"></a><a class="docs-heading-anchor-permalink" href="#Control-bar" title="Permalink"></a></h3><ul><li><p><strong>Back button:</strong> Rewind the simulation by one day.</p></li><li><p><strong>Step button:</strong> Advance the simulation by one day.</p></li><li><p><strong>Run button:</strong> Run the simulation until the button is pressed again or the end date is reached.</p></li><li><p><strong>Progress bar:</strong> Shows the percentage of time elapsed between the start and end dates of the simulation.</p></li><li><p><strong>Speed slider:</strong> Set the time delay between each simulation step when running.</p></li><li><p><strong>Date:</strong> Shows the simulation date currently displayed on the map.</p></li></ul><h3 id="Menu-bar"><a class="docs-heading-anchor" href="#Menu-bar">Menu bar</a><a id="Menu-bar-1"></a><a class="docs-heading-anchor-permalink" href="#Menu-bar" title="Permalink"></a></h3><p><strong>Simulation:</strong></p><ul><li><p><strong>New simulation:</strong> Reset the model and start over.</p></li><li><p><strong>Configure simulation:</strong> Change the model settings (<em>not yet implemented</em>).</p></li><li><p><strong>Load saved state:</strong> Load a model object file saved by a previous simulation run.</p></li><li><p><strong>Save current state:</strong> Save a model object file for later use.</p></li><li><p><strong>Quit:</strong> Close the application.</p></li></ul><p><strong>Data:</strong></p><ul><li><p><strong>Show population graph:</strong> Show a window with a graph of population sizes over time in the current model run.</p></li><li><p><strong>Save simulation output:</strong> Save the model output data to file (saves both raw CSV data and generated graphics).</p></li></ul><p><strong>Help:</strong></p><ul><li><p><strong>Documentation:</strong> Open the Persefone.jl online documentation in a browser.</p></li><li><p><strong>Website:</strong> Open the main Persefone.jl website in a browser.</p></li><li><p><strong>About:</strong> Show a window with core information about the application.</p></li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="using.html">« The Persefone.jl Package</a><a class="docs-footer-nextpage" href="config.html">Configuration »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/index.html b/docs/build/index.html index 88cb3ad3e16a11026afcf394a11c98331d2e7816..5ab02e0d4c0c1d3be8d4adec54e33d0c01e4c3c5 100644 --- a/docs/build/index.html +++ b/docs/build/index.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Introduction · Persefone.jl</title><meta name="title" content="Introduction · Persefone.jl"/><meta property="og:title" content="Introduction · Persefone.jl"/><meta property="twitter:title" content="Introduction · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li class="is-active"><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="index.html">Introduction</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="index.html">Introduction</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/index.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><p><a href="https://persefone-model.eu"><img src="assets/persefonejl_logo_v3_splash.png" alt="Persefone.jl splash screen"/></a></p><h1 id="Introduction"><a class="docs-heading-anchor" href="#Introduction">Introduction</a><a id="Introduction-1"></a><a class="docs-heading-anchor-permalink" href="#Introduction" title="Permalink"></a></h1><p><a href="https://persefone-model.eu">Persefone.jl</a> models agricultural practice and how it impacts animal species at a landscape scale. It includes a farm submodel, a crop growth submodel, and individual-based models of multiple indicator species. Its aim is to investigate how changes in farm operations (e.g. through policy changes in the CAP) influence biodiversity.</p><p>The model is open-source software available on <a href="https://git.idiv.de/persefone/persefone-model">Gitlab</a>.</p><p><em>This documentation was last updated on 2024-07-16 for <strong>Persefone.jl v0.5.1</strong> (commit <a href="https://git.idiv.de/persefone/persefone-model/-/commit/897e96c">897e96c</a>).</em></p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="using.html">The Persefone.jl Package »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Introduction · Persefone.jl</title><meta name="title" content="Introduction · Persefone.jl"/><meta property="og:title" content="Introduction · Persefone.jl"/><meta property="twitter:title" content="Introduction · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li class="is-active"><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="index.html">Introduction</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="index.html">Introduction</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/index.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><p><a href="https://persefone-model.eu"><img src="assets/persefonejl_logo_v3_splash.png" alt="Persefone.jl splash screen"/></a></p><h1 id="Introduction"><a class="docs-heading-anchor" href="#Introduction">Introduction</a><a id="Introduction-1"></a><a class="docs-heading-anchor-permalink" href="#Introduction" title="Permalink"></a></h1><p><a href="https://persefone-model.eu">Persefone.jl</a> models agricultural practice and how it impacts animal species at a landscape scale. It includes a farm submodel, a crop growth submodel, and individual-based models of multiple indicator species. Its aim is to investigate how changes in farm operations (e.g. through policy changes in the CAP) influence biodiversity.</p><p>The model is open-source software available on <a href="https://git.idiv.de/persefone/persefone-model">Gitlab</a>.</p><p><em>This documentation was last updated on 2024-07-30 for <strong>Persefone.jl v0.5.2</strong> (commit <a href="https://git.idiv.de/persefone/persefone-model/-/commit/5deb973">5deb973</a>).</em></p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="using.html">The Persefone.jl Package »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/io.html b/docs/build/io.html index 39cd53d1c0d6860bb1cceab4dbca5ab6997cb17a..64128db7eaf6548cad1fe45e66045f4aea4f8346 100644 --- a/docs/build/io.html +++ b/docs/build/io.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Input and Output · Persefone.jl</title><meta name="title" content="Input and Output · Persefone.jl"/><meta property="og:title" content="Input and Output · Persefone.jl"/><meta property="twitter:title" content="Input and Output · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li class="is-active"><a class="tocitem" href="io.html">Input and Output</a><ul class="internal"><li><a class="tocitem" href="#input.jl"><span>input.jl</span></a></li><li><a class="tocitem" href="#output.jl"><span>output.jl</span></a></li><li><a class="tocitem" href="#makieplots.jl"><span>makieplots.jl</span></a></li></ul></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Core</a></li><li class="is-active"><a href="io.html">Input and Output</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="io.html">Input and Output</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/io.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Input-and-Output"><a class="docs-heading-anchor" href="#Input-and-Output">Input and Output</a><a id="Input-and-Output-1"></a><a class="docs-heading-anchor-permalink" href="#Input-and-Output" title="Permalink"></a></h1><p>These functions are responsible for reading in all model configurations (passed by config file or commandline), administrating them during a run, and printing or plotting any output.</p><h2 id="input.jl"><a class="docs-heading-anchor" href="#input.jl">input.jl</a><a id="input.jl-1"></a><a class="docs-heading-anchor-permalink" href="#input.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.PARAMFILE" href="#Persefone.PARAMFILE"><code>Persefone.PARAMFILE</code></a> — <span class="docstring-category">Constant</span></header><section><div><p>The file that stores all default parameters: <code>src/parameters.toml</code></p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L10-L12">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.flattenTOML-Tuple{Any}" href="#Persefone.flattenTOML-Tuple{Any}"><code>Persefone.flattenTOML</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">flattenTOML(dict)</code></pre><p>An internal utility function to convert the two-dimensional dict returned by <code>TOML.parsefile()</code> into a one-dimensional dict, so that instead of writing <code>settings["domain"]["param"]</code> one can use <code>settings["domain.param"]</code>. Can be reversed with <a href="io.html#Persefone.prepareTOML-Tuple{Any}"><code>prepareTOML</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L102-L109">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.getsettings" href="#Persefone.getsettings"><code>Persefone.getsettings</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">getsettings(configfile, seed=nothing)</code></pre><p>Combines all configuration options to produce a single settings dict. Precedence: commandline parameters - user config file - default values</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L38-L43">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.loadmodelobject-Tuple{String}" href="#Persefone.loadmodelobject-Tuple{String}"><code>Persefone.loadmodelobject</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">loadmodelobject(fullfilename)</code></pre><p>Deserialise a model object that was previously saved with <code>[savemodelobject](@ref)</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L190-L194">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.parsecommandline-Tuple{}" href="#Persefone.parsecommandline-Tuple{}"><code>Persefone.parsecommandline</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">parsecommandline()</code></pre><p>Certain software parameters can be set via the commandline.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L153-L157">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.preprocessparameters-Tuple{Dict{String, Any}, String}" href="#Persefone.preprocessparameters-Tuple{Dict{String, Any}, String}"><code>Persefone.preprocessparameters</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">preprocessparameters(settings)</code></pre><p>Take the raw input parameters and process them where necessary (e.g. convert types or perform checks). This is a helper function for <a href="io.html#Persefone.getsettings"><code>getsettings</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L76-L81">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@chance-Tuple{Any}" href="#Persefone.@chance-Tuple{Any}"><code>Persefone.@chance</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@chance(odds)</code></pre><p>Return true if a random number is less than the odds (0.0 <= <code>odds</code> <= 1.0), using the model RNG. This is a utility wrapper that can only be used a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L142-L148">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@param-Tuple{Any}" href="#Persefone.@param-Tuple{Any}"><code>Persefone.@param</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@param(domainparam)</code></pre><p>Return a configuration parameter from the global settings. The argument should be in the form <code><domain>.<parameter></code>, for example <code>@param(core.outdir)</code>. Possible values for <code><domain></code> are <code>core</code>, <code>nature</code>, <code>farm</code>, or <code>crop</code>. For a full list of parameters, see <code>src/parameters.toml</code>.</p><p>Note: this macro only works in a context where the <code>model</code> object is available!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L20-L31">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@rand-Tuple" href="#Persefone.@rand-Tuple"><code>Persefone.@rand</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@rand(args...)</code></pre><p>Return a random number or element from the sample, using the model RNG. This is a utility wrapper that can only be used a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L120-L126">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@shuffle!-Tuple{Any}" href="#Persefone.@shuffle!-Tuple{Any}"><code>Persefone.@shuffle!</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@shuffle!(collection)</code></pre><p>Shuffle the given collection in place, using the model RNG. This is a utility wrapper that can only be used a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/input.jl#L131-L137">source</a></section></article><h2 id="output.jl"><a class="docs-heading-anchor" href="#output.jl">output.jl</a><a id="output.jl-1"></a><a class="docs-heading-anchor-permalink" href="#output.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.LOGFILE" href="#Persefone.LOGFILE"><code>Persefone.LOGFILE</code></a> — <span class="docstring-category">Constant</span></header><section><div><p>Log output is saved to <code>simulation.log</code> in the output directory</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L8">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.RECORDDIR" href="#Persefone.RECORDDIR"><code>Persefone.RECORDDIR</code></a> — <span class="docstring-category">Constant</span></header><section><div><p>All input data are copied to the <code>inputs</code> folder within the output directory</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.DataOutput" href="#Persefone.DataOutput"><code>Persefone.DataOutput</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">DataOutput</code></pre><p>A struct for organising model output. This is used to collect model data in an in-memory dataframe or for CSV output. Submodels can register their own output functions using <a href="io.html#Persefone.newdataoutput!"><code>newdataoutput!</code></a>.</p><p>Struct fields: - name: a string identifier for the data collection (used as file name) - header: a list of column names - outputfunction: a function that takes a model object and returns data values to record (formatted as a vector of vectors) - frequency: how often to call the output function (daily/monthly/yearly/end/never) - plotfunction: a function that takes a model object and returns a Makie figure object (optional)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L142-L155">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.createdatadir-Tuple{String, Union{Bool, String}}" href="#Persefone.createdatadir-Tuple{String, Union{Bool, String}}"><code>Persefone.createdatadir</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">createdatadir(outdir, overwrite)</code></pre><p>Creates the output directory, dealing with possible conflicts.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L17-L21">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.modellogger" href="#Persefone.modellogger"><code>Persefone.modellogger</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">modellogger(loglevel, outdir, output="both")</code></pre><p>Create a logger object that writes output to screen and/or a logfile. This object is stored as <code>model.logger</code> and can then be used with <code>with_logger()</code>. Note: requires <a href="io.html#Persefone.createdatadir-Tuple{String, Union{Bool, String}}"><code>createdatadir</code></a> to be run first.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L39-L45">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.newdataoutput!" href="#Persefone.newdataoutput!"><code>Persefone.newdataoutput!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">newdataoutput!(model, name, header, outputfunction, frequency)</code></pre><p>Create and register a new data output. This function must be called by all submodels that want to have their output functions called regularly.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L164-L169">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.outputdata" href="#Persefone.outputdata"><code>Persefone.outputdata</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">outputdata(model, force=false)</code></pre><p>Cycle through all registered data outputs and activate them according to their configured frequency. If <code>force</code> is <code>true</code>, activate all outputs regardless of their configuration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L194-L200">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.prepareTOML-Tuple{Any}" href="#Persefone.prepareTOML-Tuple{Any}"><code>Persefone.prepareTOML</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">prepareTOML(dict)</code></pre><p>An internal utility function to re-convert the one-dimensional dict created by <a href="io.html#Persefone.flattenTOML-Tuple{Any}"><code>flattenTOML</code></a> into the two-dimensional dict needed by <code>TOML.print</code>, and convert any data types into TOML-compatible types where necessary.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L119-L125">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.saveinputfiles-Tuple{SimulationModel}" href="#Persefone.saveinputfiles-Tuple{SimulationModel}"><code>Persefone.saveinputfiles</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">saveinputfiles(model)</code></pre><p>Copy all input files into the output directory, including the actual parameter settings used. This allows replicating a run in future.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L82-L87">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.savemodelobject-Tuple{SimulationModel, String}" href="#Persefone.savemodelobject-Tuple{SimulationModel, String}"><code>Persefone.savemodelobject</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">savemodelobject(model, filename)</code></pre><p>Serialise a model object and save it to file for later reference. Includes the current model and Julia versions for compatibility checking.</p><p>WARNING: produces large files (>100 MB) and takes a while to execute.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L249-L256">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.visualiseoutput-Tuple{SimulationModel}" href="#Persefone.visualiseoutput-Tuple{SimulationModel}"><code>Persefone.visualiseoutput</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">visualiseoutput(model)</code></pre><p>Cycle through all data outputs and call their respective plot functions, saving each figure to file.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L232-L237">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.withtestlogger-Tuple{SimulationModel}" href="#Persefone.withtestlogger-Tuple{SimulationModel}"><code>Persefone.withtestlogger</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">withtestlogger(model)</code></pre><p>Replace the model logger with the currently active logger. This is intended to be used in the testsuite to circumvent a <a href="https://github.com/JuliaLang/julia/issues/48456">Julia issue</a>, where <code>@test_logs</code> doesn't work with local loggers.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/output.jl#L68-L74">source</a></section></article><h2 id="makieplots.jl"><a class="docs-heading-anchor" href="#makieplots.jl">makieplots.jl</a><a id="makieplots.jl-1"></a><a class="docs-heading-anchor-permalink" href="#makieplots.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.gettickmarks-Tuple{Any}" href="#Persefone.gettickmarks-Tuple{Any}"><code>Persefone.gettickmarks</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">gettickmarks(dates)</code></pre><p>Given a vector of dates, construct a selection to use as tick mark locations. Helper function for <code>[populationtrends](@ref)</code></p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/analysis/makieplots.jl#L74-L79">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.populationtrends-Tuple{SimulationModel}" href="#Persefone.populationtrends-Tuple{SimulationModel}"><code>Persefone.populationtrends</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">populationtrends(model)</code></pre><p>Plot a line graph of population sizes of each species over time. Returns a Makie figure object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/analysis/makieplots.jl#L50-L55">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.visualisemap" href="#Persefone.visualisemap"><code>Persefone.visualisemap</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">visualisemap(model, date, landcover)</code></pre><p>Draw the model's land cover map and plot all individuals as points on it at the specified date. If no date is passed, use the last date for which data are available. Optionally, you can pass a landcover map image (this is needed to reduce the frequency of disk I/O for Persefone Desktop). Returns a Makie figure object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/analysis/makieplots.jl#L6-L14">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="simulation.html">« Simulation</a><a class="docs-footer-nextpage" href="nature.html">Nature »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Input and Output · Persefone.jl</title><meta name="title" content="Input and Output · Persefone.jl"/><meta property="og:title" content="Input and Output · Persefone.jl"/><meta property="twitter:title" content="Input and Output · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li class="is-active"><a class="tocitem" href="io.html">Input and Output</a><ul class="internal"><li><a class="tocitem" href="#input.jl"><span>input.jl</span></a></li><li><a class="tocitem" href="#output.jl"><span>output.jl</span></a></li><li><a class="tocitem" href="#makieplots.jl"><span>makieplots.jl</span></a></li></ul></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Software API</a></li><li class="is-active"><a href="io.html">Input and Output</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="io.html">Input and Output</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/io.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Input-and-Output"><a class="docs-heading-anchor" href="#Input-and-Output">Input and Output</a><a id="Input-and-Output-1"></a><a class="docs-heading-anchor-permalink" href="#Input-and-Output" title="Permalink"></a></h1><p>These functions are responsible for reading in all model configurations (passed by config file or commandline), administrating them during a run, and printing or plotting any output.</p><h2 id="input.jl"><a class="docs-heading-anchor" href="#input.jl">input.jl</a><a id="input.jl-1"></a><a class="docs-heading-anchor-permalink" href="#input.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.PARAMFILE" href="#Persefone.PARAMFILE"><code>Persefone.PARAMFILE</code></a> — <span class="docstring-category">Constant</span></header><section><div><p>The file that stores all default parameters: <code>src/parameters.toml</code></p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L10-L12">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.flattenTOML-Tuple{Any}" href="#Persefone.flattenTOML-Tuple{Any}"><code>Persefone.flattenTOML</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">flattenTOML(dict)</code></pre><p>An internal utility function to convert the two-dimensional dict returned by <code>TOML.parsefile()</code> into a one-dimensional dict, so that instead of writing <code>settings["domain"]["param"]</code> one can use <code>settings["domain.param"]</code>. Can be reversed with <a href="io.html#Persefone.prepareTOML-Tuple{Any}"><code>prepareTOML</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L102-L109">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.getsettings" href="#Persefone.getsettings"><code>Persefone.getsettings</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">getsettings(configfile, seed=nothing)</code></pre><p>Combines all configuration options to produce a single settings dict. Precedence: commandline parameters - user config file - default values</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L38-L43">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.loadmodelobject-Tuple{String}" href="#Persefone.loadmodelobject-Tuple{String}"><code>Persefone.loadmodelobject</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">loadmodelobject(fullfilename)</code></pre><p>Deserialise a model object that was previously saved with <code>[savemodelobject](@ref)</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L190-L194">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.parsecommandline-Tuple{}" href="#Persefone.parsecommandline-Tuple{}"><code>Persefone.parsecommandline</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">parsecommandline()</code></pre><p>Certain software parameters can be set via the commandline.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L153-L157">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.preprocessparameters-Tuple{Dict{String, Any}, String}" href="#Persefone.preprocessparameters-Tuple{Dict{String, Any}, String}"><code>Persefone.preprocessparameters</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">preprocessparameters(settings)</code></pre><p>Take the raw input parameters and process them where necessary (e.g. convert types or perform checks). This is a helper function for <a href="io.html#Persefone.getsettings"><code>getsettings</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L76-L81">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@chance-Tuple{Any}" href="#Persefone.@chance-Tuple{Any}"><code>Persefone.@chance</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@chance(odds)</code></pre><p>Return true if a random number is less than the odds (0.0 <= <code>odds</code> <= 1.0), using the model RNG. This is a utility wrapper that can only be used a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L142-L148">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@param-Tuple{Any}" href="#Persefone.@param-Tuple{Any}"><code>Persefone.@param</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@param(domainparam)</code></pre><p>Return a configuration parameter from the global settings. The argument should be in the form <code><domain>.<parameter></code>, for example <code>@param(core.outdir)</code>. Possible values for <code><domain></code> are <code>core</code>, <code>nature</code>, <code>farm</code>, or <code>crop</code>. For a full list of parameters, see <code>src/parameters.toml</code>.</p><p>Note: this macro only works in a context where the <code>model</code> object is available!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L20-L31">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@rand-Tuple" href="#Persefone.@rand-Tuple"><code>Persefone.@rand</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@rand(args...)</code></pre><p>Return a random number or element from the sample, using the model RNG. This is a utility wrapper that can only be used a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L120-L126">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@shuffle!-Tuple{Any}" href="#Persefone.@shuffle!-Tuple{Any}"><code>Persefone.@shuffle!</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@shuffle!(collection)</code></pre><p>Shuffle the given collection in place, using the model RNG. This is a utility wrapper that can only be used a context where the <code>model</code> object is available.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/input.jl#L131-L137">source</a></section></article><h2 id="output.jl"><a class="docs-heading-anchor" href="#output.jl">output.jl</a><a id="output.jl-1"></a><a class="docs-heading-anchor-permalink" href="#output.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.LOGFILE" href="#Persefone.LOGFILE"><code>Persefone.LOGFILE</code></a> — <span class="docstring-category">Constant</span></header><section><div><p>Log output is saved to <code>simulation.log</code> in the output directory</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L8">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.RECORDDIR" href="#Persefone.RECORDDIR"><code>Persefone.RECORDDIR</code></a> — <span class="docstring-category">Constant</span></header><section><div><p>All input data are copied to the <code>inputs</code> folder within the output directory</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.DataOutput" href="#Persefone.DataOutput"><code>Persefone.DataOutput</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">DataOutput</code></pre><p>A struct for organising model output. This is used to collect model data in an in-memory dataframe or for CSV output. Submodels can register their own output functions using <a href="io.html#Persefone.newdataoutput!"><code>newdataoutput!</code></a>.</p><p>Struct fields: - name: a string identifier for the data collection (used as file name) - header: a list of column names - outputfunction: a function that takes a model object and returns data values to record (formatted as a vector of vectors) - frequency: how often to call the output function (daily/monthly/yearly/end/never) - plotfunction: a function that takes a model object and returns a Makie figure object (optional)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L142-L155">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.createdatadir-Tuple{String, Union{Bool, String}}" href="#Persefone.createdatadir-Tuple{String, Union{Bool, String}}"><code>Persefone.createdatadir</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">createdatadir(outdir, overwrite)</code></pre><p>Creates the output directory, dealing with possible conflicts.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L17-L21">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.modellogger" href="#Persefone.modellogger"><code>Persefone.modellogger</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">modellogger(loglevel, outdir, output="both")</code></pre><p>Create a logger object that writes output to screen and/or a logfile. This object is stored as <code>model.logger</code> and can then be used with <code>with_logger()</code>. Note: requires <a href="io.html#Persefone.createdatadir-Tuple{String, Union{Bool, String}}"><code>createdatadir</code></a> to be run first.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L39-L45">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.newdataoutput!" href="#Persefone.newdataoutput!"><code>Persefone.newdataoutput!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">newdataoutput!(model, name, header, outputfunction, frequency)</code></pre><p>Create and register a new data output. This function must be called by all submodels that want to have their output functions called regularly.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L164-L169">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.outputdata" href="#Persefone.outputdata"><code>Persefone.outputdata</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">outputdata(model, force=false)</code></pre><p>Cycle through all registered data outputs and activate them according to their configured frequency. If <code>force</code> is <code>true</code>, activate all outputs regardless of their configuration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L194-L200">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.prepareTOML-Tuple{Any}" href="#Persefone.prepareTOML-Tuple{Any}"><code>Persefone.prepareTOML</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">prepareTOML(dict)</code></pre><p>An internal utility function to re-convert the one-dimensional dict created by <a href="io.html#Persefone.flattenTOML-Tuple{Any}"><code>flattenTOML</code></a> into the two-dimensional dict needed by <code>TOML.print</code>, and convert any data types into TOML-compatible types where necessary.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L119-L125">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.saveinputfiles-Tuple{SimulationModel}" href="#Persefone.saveinputfiles-Tuple{SimulationModel}"><code>Persefone.saveinputfiles</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">saveinputfiles(model)</code></pre><p>Copy all input files into the output directory, including the actual parameter settings used. This allows replicating a run in future.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L82-L87">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.savemodelobject-Tuple{SimulationModel, String}" href="#Persefone.savemodelobject-Tuple{SimulationModel, String}"><code>Persefone.savemodelobject</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">savemodelobject(model, filename)</code></pre><p>Serialise a model object and save it to file for later reference. Includes the current model and Julia versions for compatibility checking.</p><p>WARNING: produces large files (>100 MB) and takes a while to execute.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L249-L256">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.visualiseoutput-Tuple{SimulationModel}" href="#Persefone.visualiseoutput-Tuple{SimulationModel}"><code>Persefone.visualiseoutput</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">visualiseoutput(model)</code></pre><p>Cycle through all data outputs and call their respective plot functions, saving each figure to file.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L232-L237">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.withtestlogger-Tuple{SimulationModel}" href="#Persefone.withtestlogger-Tuple{SimulationModel}"><code>Persefone.withtestlogger</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">withtestlogger(model)</code></pre><p>Replace the model logger with the currently active logger. This is intended to be used in the testsuite to circumvent a <a href="https://github.com/JuliaLang/julia/issues/48456">Julia issue</a>, where <code>@test_logs</code> doesn't work with local loggers.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/output.jl#L68-L74">source</a></section></article><h2 id="makieplots.jl"><a class="docs-heading-anchor" href="#makieplots.jl">makieplots.jl</a><a id="makieplots.jl-1"></a><a class="docs-heading-anchor-permalink" href="#makieplots.jl" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.gettickmarks-Tuple{Any}" href="#Persefone.gettickmarks-Tuple{Any}"><code>Persefone.gettickmarks</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">gettickmarks(dates)</code></pre><p>Given a vector of dates, construct a selection to use as tick mark locations. Helper function for <code>[populationtrends](@ref)</code></p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/analysis/makieplots.jl#L74-L79">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.populationtrends-Tuple{SimulationModel}" href="#Persefone.populationtrends-Tuple{SimulationModel}"><code>Persefone.populationtrends</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">populationtrends(model)</code></pre><p>Plot a line graph of population sizes of each species over time. Returns a Makie figure object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/analysis/makieplots.jl#L50-L55">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.visualisemap" href="#Persefone.visualisemap"><code>Persefone.visualisemap</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">visualisemap(model, date, landcover)</code></pre><p>Draw the model's land cover map and plot all individuals as points on it at the specified date. If no date is passed, use the last date for which data are available. Optionally, you can pass a landcover map image (this is needed to reduce the frequency of disk I/O for Persefone Desktop). Returns a Makie figure object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/analysis/makieplots.jl#L6-L14">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="simulation.html">« Simulation</a><a class="docs-footer-nextpage" href="nature.html">Nature submodel »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/management.html b/docs/build/management.html new file mode 100644 index 0000000000000000000000000000000000000000..767627b252aa8b256e85a7108fd60f371a1fc99c --- /dev/null +++ b/docs/build/management.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Farm management · Persefone.jl</title><meta name="title" content="Farm management · Persefone.jl"/><meta property="og:title" content="Farm management · Persefone.jl"/><meta property="twitter:title" content="Farm management · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li class="is-active"><a class="tocitem" href="management.html">Farm management</a><ul class="internal"><li><a class="tocitem" href="#Crop-rotations-and-management"><span>Crop rotations and management</span></a></li><li><a class="tocitem" href="#Environmental-regulations"><span>Environmental regulations</span></a></li></ul></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Scientific documentation</a></li><li class="is-active"><a href="management.html">Farm management</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="management.html">Farm management</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/management.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Farm-management"><a class="docs-heading-anchor" href="#Farm-management">Farm management</a><a id="Farm-management-1"></a><a class="docs-heading-anchor-permalink" href="#Farm-management" title="Permalink"></a></h1><p><em>TODO</em></p><h2 id="Crop-rotations-and-management"><a class="docs-heading-anchor" href="#Crop-rotations-and-management">Crop rotations and management</a><a id="Crop-rotations-and-management-1"></a><a class="docs-heading-anchor-permalink" href="#Crop-rotations-and-management" title="Permalink"></a></h2><h2 id="Environmental-regulations"><a class="docs-heading-anchor" href="#Environmental-regulations">Environmental regulations</a><a id="Environmental-regulations-1"></a><a class="docs-heading-anchor-permalink" href="#Environmental-regulations" title="Permalink"></a></h2></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="config.html">« Configuration</a><a class="docs-footer-nextpage" href="crop-models.html">Crop models »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/nature.html b/docs/build/nature.html index b6e600fb2370ad4b01c954f74249f80f5391e39a..9f299fc79ef4fad0313e078e95d536293dd11ea6 100644 --- a/docs/build/nature.html +++ b/docs/build/nature.html @@ -1,14 +1,14 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Nature · Persefone.jl</title><meta name="title" content="Nature · Persefone.jl"/><meta property="og:title" content="Nature · Persefone.jl"/><meta property="twitter:title" content="Nature · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li class="is-active"><a class="tocitem" href="nature.html">Nature</a><ul class="internal"><li><a class="tocitem" href="#nature.jl"><span>nature.jl</span></a></li><li><a class="tocitem" href="#macros.jl"><span>macros.jl</span></a></li><li><a class="tocitem" href="#populations.jl"><span>populations.jl</span></a></li><li><a class="tocitem" href="#insects.jl"><span>insects.jl</span></a></li><li><a class="tocitem" href="#ecologicaldata.jl"><span>ecologicaldata.jl</span></a></li></ul></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Nature</a></li><li class="is-active"><a href="nature.html">Nature</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="nature.html">Nature</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/nature.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Nature"><a class="docs-heading-anchor" href="#Nature">Nature</a><a id="Nature-1"></a><a class="docs-heading-anchor-permalink" href="#Nature" title="Permalink"></a></h1><h2 id="nature.jl"><a class="docs-heading-anchor" href="#nature.jl">nature.jl</a><a id="nature.jl-1"></a><a class="docs-heading-anchor-permalink" href="#nature.jl" title="Permalink"></a></h2><p>This file is responsible for managing the animal modules.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Animal" href="#Persefone.Animal"><code>Persefone.Animal</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Animal</code></pre><p>This is the generic agent type for all animals. Individual species are created using the <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a> macro. In addition to user-defined, species-specific fields, all species contain the following fields:</p><ul><li><code>id</code> An integer unique identifier for this individual.</li><li><code>sex</code> male, female, or hermaphrodite.</li><li><code>parents</code> The IDs of the individual's parents.</li><li><code>pos</code> An (x, y) coordinate tuple.</li><li><code>age</code> The age of the individual in days.</li><li><code>phase</code> The update function to be called during the individual's current life phase.</li><li><code>energy</code> A <a href="@ref">DEBparameters</a> struct for calculating energy budgets.</li><li><code>offspring</code> A vector containing the IDs of an individual's children.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L12-L27">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.animalid-Tuple{Animal}" href="#Persefone.animalid-Tuple{Animal}"><code>Persefone.animalid</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">animalid(animal)</code></pre><p>A small utility function to return a string with the species name and ID of an animal.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L60-L64">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.create!-Tuple{Animal, SimulationModel}" href="#Persefone.create!-Tuple{Animal, SimulationModel}"><code>Persefone.create!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">create!(animal, model)</code></pre><p>The <code>create!</code> function is called for every individual at birth or at model initialisation. Species must use <a href="nature.html#Persefone.@create-Tuple{Any, Any}"><code>@create</code></a> to define a species-specific method. This is the fall- back method, in case none is implemented for a species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L69-L75">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initnature!-Tuple{SimulationModel}" href="#Persefone.initnature!-Tuple{SimulationModel}"><code>Persefone.initnature!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initnature!(model)</code></pre><p>Initialise the model with all simulated animal populations.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L90-L94">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.killallanimals!-Tuple{Any}" href="#Persefone.killallanimals!-Tuple{Any}"><code>Persefone.killallanimals!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">killallanimals!(model)</code></pre><p>Remove all animal individuals from the simulation.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L127-L131">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.speciesof-Tuple{Union{Animal, Type}}" href="#Persefone.speciesof-Tuple{Union{Animal, Type}}"><code>Persefone.speciesof</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">speciesof(animal)</code></pre><p>Return the species name of this animal as a string.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L30-L34">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.speciestype-Tuple{String}" href="#Persefone.speciestype-Tuple{String}"><code>Persefone.speciestype</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">speciestype(name)</code></pre><p>Return the Type of this species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L42-L46">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepagent!-Tuple{Animal, SimulationModel}" href="#Persefone.stepagent!-Tuple{Animal, SimulationModel}"><code>Persefone.stepagent!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(animal, model)</code></pre><p>Update an animal by one day, executing it's currently active phase function.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L80-L84">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.updatenature!-Tuple{SimulationModel}" href="#Persefone.updatenature!-Tuple{SimulationModel}"><code>Persefone.updatenature!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">updatenature!(model)</code></pre><p>Run processes that affect all animals.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/nature.jl#L105-L109">source</a></section></article><h2 id="macros.jl"><a class="docs-heading-anchor" href="#macros.jl">macros.jl</a><a id="macros.jl-1"></a><a class="docs-heading-anchor-permalink" href="#macros.jl" title="Permalink"></a></h2><p>This file contains all the macros that can be used in the species DSL.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@animal-Tuple{Any}" href="#Persefone.@animal-Tuple{Any}"><code>Persefone.@animal</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@animal(id)</code></pre><p>Return the animal object associated with this ID number. This can only be used in a context where the <code>model</code> object is available (e.g. nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L142-L148">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@countanimals-Tuple" href="#Persefone.@countanimals-Tuple"><code>Persefone.@countanimals</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@countanimals(radius=0, species="")</code></pre><p>Count the number of animals at or near this location, optionally filtering by species. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L386-L391">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@create-Tuple{Any, Any}" href="#Persefone.@create-Tuple{Any, Any}"><code>Persefone.@create</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@create(species, body)</code></pre><p>Define a special phase function (<a href="nature.html#Persefone.create!-Tuple{Animal, SimulationModel}"><code>create!</code></a>()) that will be called when an individual of this species is created, at the initialisation of the simulation or at birth.</p><p>As for <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>, the body of this macro has access to the variables <code>self</code> (the individual being created) and <code>model</code> (the simulation world), and can thus use all macros available in <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L121-L131">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@cropheight-Tuple{}" href="#Persefone.@cropheight-Tuple{}"><code>Persefone.@cropheight</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@cropheight</code></pre><p>Return the height of the crop at this position, or 0 if there is no crop here. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L307-L313">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@cropname-Tuple{}" href="#Persefone.@cropname-Tuple{}"><code>Persefone.@cropname</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@cropname</code></pre><p>Return the name of the local croptype, or an empty string if there is no crop here. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L296-L302">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@directionto-Tuple{Any}" href="#Persefone.@directionto-Tuple{Any}"><code>Persefone.@directionto</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@directionto</code></pre><p>Calculate the direction to an animal or the closest habitat of the specified type or descriptor. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L318-L324">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@distanceto-Tuple{Any}" href="#Persefone.@distanceto-Tuple{Any}"><code>Persefone.@distanceto</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@distanceto</code></pre><p>Calculate the distance to an animal or the closest habitat of the specified type or descriptor. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L329-L335">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@distancetoedge-Tuple{}" href="#Persefone.@distancetoedge-Tuple{}"><code>Persefone.@distancetoedge</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@distancetoedge</code></pre><p>Calculate the distance to the closest neighbouring habitat. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L340-L346">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@follow-Tuple{Any, Any}" href="#Persefone.@follow-Tuple{Any, Any}"><code>Persefone.@follow</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@follow(leader, distance)</code></pre><p>Move to a location within the given distance of the leading animal. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L433-L438">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@habitat-Tuple{Any}" href="#Persefone.@habitat-Tuple{Any}"><code>Persefone.@habitat</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@habitat</code></pre><p>Specify habitat suitability for spatial ecological processes.</p><p>This macro works by creating an anonymous function that takes in a model object and a position, and returns <code>true</code> or <code>false</code> depending on the conditions specified in the macro body.</p><p>Several utility macros can be used within the body of <code>@habitat</code> as a short-hand for common expressions: <a href="nature.html#Persefone.@landcover-Tuple{}"><code>@landcover</code></a>, <a href="nature.html#Persefone.@cropname-Tuple{}"><code>@cropname</code></a>, <a href="nature.html#Persefone.@cropheight-Tuple{}"><code>@cropheight</code></a>, <a href="nature.html#Persefone.@distanceto-Tuple{Any}"><code>@distanceto</code></a>, <a href="nature.html#Persefone.@distancetoedge-Tuple{}"><code>@distancetoedge</code></a>, <a href="nature.html#Persefone.@countanimals-Tuple"><code>@countanimals</code></a>. The variables <code>model</code> and <code>pos</code> can be used for checks that don't have a macro available.</p><p>Two example uses of <code>@habitat</code> might look like this:</p><pre><code class="language-julia hljs">movementhabitat = @habitat(@landcover() in (grass agriculture soil)) +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Nature submodel · Persefone.jl</title><meta name="title" content="Nature submodel · Persefone.jl"/><meta property="og:title" content="Nature submodel · Persefone.jl"/><meta property="twitter:title" content="Nature submodel · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li class="is-active"><a class="tocitem" href="nature.html">Nature submodel</a><ul class="internal"><li><a class="tocitem" href="#nature.jl"><span>nature.jl</span></a></li><li><a class="tocitem" href="#macros.jl"><span>macros.jl</span></a></li><li><a class="tocitem" href="#individuals.jl"><span>individuals.jl</span></a></li><li><a class="tocitem" href="#populations.jl"><span>populations.jl</span></a></li><li><a class="tocitem" href="#ecologicaldata.jl"><span>ecologicaldata.jl</span></a></li></ul></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Software API</a></li><li class="is-active"><a href="nature.html">Nature submodel</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="nature.html">Nature submodel</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/nature.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Nature-submodel"><a class="docs-heading-anchor" href="#Nature-submodel">Nature submodel</a><a id="Nature-submodel-1"></a><a class="docs-heading-anchor-permalink" href="#Nature-submodel" title="Permalink"></a></h1><h2 id="nature.jl"><a class="docs-heading-anchor" href="#nature.jl">nature.jl</a><a id="nature.jl-1"></a><a class="docs-heading-anchor-permalink" href="#nature.jl" title="Permalink"></a></h2><p>This file is responsible for managing the animal modules.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Animal" href="#Persefone.Animal"><code>Persefone.Animal</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Animal</code></pre><p>This is the generic agent type for all animals. Individual species are created using the <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a> macro. In addition to user-defined, species-specific fields, all species contain the following fields:</p><ul><li><code>id</code> An integer unique identifier for this individual.</li><li><code>sex</code> male, female, or hermaphrodite.</li><li><code>parents</code> The IDs of the individual's parents.</li><li><code>pos</code> An (x, y) coordinate tuple.</li><li><code>age</code> The age of the individual in days.</li><li><code>phase</code> The update function to be called during the individual's current life phase.</li><li><code>energy</code> A <a href="@ref">DEBparameters</a> struct for calculating energy budgets.</li><li><code>offspring</code> A vector containing the IDs of an individual's children.</li><li><code>territory</code> A vector of coordinates that comprise the individual's territory.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L12-L28">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.animalid-Tuple{Animal}" href="#Persefone.animalid-Tuple{Animal}"><code>Persefone.animalid</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">animalid(animal)</code></pre><p>A small utility function to return a string with the species name and ID of an animal.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L61-L65">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.create!-Tuple{Animal, SimulationModel}" href="#Persefone.create!-Tuple{Animal, SimulationModel}"><code>Persefone.create!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">create!(animal, model)</code></pre><p>The <code>create!</code> function is called for every individual at birth or at model initialisation. Species must use <a href="nature.html#Persefone.@create-Tuple{Any, Any}"><code>@create</code></a> to define a species-specific method. This is the fall- back method, in case none is implemented for a species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L70-L76">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initnature!-Tuple{SimulationModel}" href="#Persefone.initnature!-Tuple{SimulationModel}"><code>Persefone.initnature!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initnature!(model)</code></pre><p>Initialise the model with all simulated animal populations.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L91-L95">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.killallanimals!-Tuple{Any}" href="#Persefone.killallanimals!-Tuple{Any}"><code>Persefone.killallanimals!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">killallanimals!(model)</code></pre><p>Remove all animal individuals from the simulation.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L128-L132">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.speciesof-Tuple{Union{Animal, Type}}" href="#Persefone.speciesof-Tuple{Union{Animal, Type}}"><code>Persefone.speciesof</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">speciesof(animal)</code></pre><p>Return the species name of this animal as a string.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L31-L35">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.speciestype-Tuple{String}" href="#Persefone.speciestype-Tuple{String}"><code>Persefone.speciestype</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">speciestype(name)</code></pre><p>Return the Type of this species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L43-L47">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepagent!-Tuple{Animal, SimulationModel}" href="#Persefone.stepagent!-Tuple{Animal, SimulationModel}"><code>Persefone.stepagent!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(animal, model)</code></pre><p>Update an animal by one day, executing it's currently active phase function.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L81-L85">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.updatenature!-Tuple{SimulationModel}" href="#Persefone.updatenature!-Tuple{SimulationModel}"><code>Persefone.updatenature!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">updatenature!(model)</code></pre><p>Run processes that affect all animals.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/nature.jl#L106-L110">source</a></section></article><h2 id="macros.jl"><a class="docs-heading-anchor" href="#macros.jl">macros.jl</a><a id="macros.jl-1"></a><a class="docs-heading-anchor-permalink" href="#macros.jl" title="Permalink"></a></h2><p>This file contains all the macros that can be used in the species DSL.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@animal-Tuple{Any}" href="#Persefone.@animal-Tuple{Any}"><code>Persefone.@animal</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@animal(id)</code></pre><p>Return the animal object associated with this ID number. This can only be used in a context where the <code>model</code> object is available (e.g. nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L143-L149">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@countanimals-Tuple" href="#Persefone.@countanimals-Tuple"><code>Persefone.@countanimals</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@countanimals(radius=0, species="")</code></pre><p>Count the number of animals at or near this location, optionally filtering by species. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L438-L443">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@create-Tuple{Any, Any}" href="#Persefone.@create-Tuple{Any, Any}"><code>Persefone.@create</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@create(species, body)</code></pre><p>Define a special phase function (<a href="nature.html#Persefone.create!-Tuple{Animal, SimulationModel}"><code>create!</code></a>()) that will be called when an individual of this species is created, at the initialisation of the simulation or at birth.</p><p>As for <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>, the body of this macro has access to the variables <code>self</code> (the individual being created) and <code>model</code> (the simulation world), and can thus use all macros available in <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L122-L132">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@cropcover-Tuple{}" href="#Persefone.@cropcover-Tuple{}"><code>Persefone.@cropcover</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@cropcover</code></pre><p>Return the percentage ground cover of the crop at this position, or nothing if there is no crop here. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L359-L365">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@cropheight-Tuple{}" href="#Persefone.@cropheight-Tuple{}"><code>Persefone.@cropheight</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@cropheight</code></pre><p>Return the height of the crop at this position, or nothing if there is no crop here. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L348-L354">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@cropname-Tuple{}" href="#Persefone.@cropname-Tuple{}"><code>Persefone.@cropname</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@cropname</code></pre><p>Return the name of the local croptype, or an empty string if there is no crop here. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L337-L343">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@directionto-Tuple{Any}" href="#Persefone.@directionto-Tuple{Any}"><code>Persefone.@directionto</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@directionto</code></pre><p>Calculate the direction to an animal or the closest habitat of the specified type or descriptor. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L370-L376">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@distanceto-Tuple{Any}" href="#Persefone.@distanceto-Tuple{Any}"><code>Persefone.@distanceto</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@distanceto</code></pre><p>Calculate the distance to an animal or the closest habitat of the specified type or descriptor. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L381-L387">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@distancetoedge-Tuple{}" href="#Persefone.@distancetoedge-Tuple{}"><code>Persefone.@distancetoedge</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@distancetoedge</code></pre><p>Calculate the distance to the closest neighbouring habitat. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L392-L398">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@follow-Tuple{Any, Any}" href="#Persefone.@follow-Tuple{Any, Any}"><code>Persefone.@follow</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@follow(leader, distance)</code></pre><p>Move to a location within the given distance of the leading animal. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L485-L490">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@habitat-Tuple{Any}" href="#Persefone.@habitat-Tuple{Any}"><code>Persefone.@habitat</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@habitat</code></pre><p>Specify habitat suitability for spatial ecological processes.</p><p>This macro works by creating an anonymous function that takes in a model object and a position, and returns <code>true</code> or <code>false</code> depending on the conditions specified in the macro body.</p><p>Several utility macros can be used within the body of <code>@habitat</code> as a short-hand for common expressions: <a href="nature.html#Persefone.@landcover-Tuple{}"><code>@landcover</code></a>, <a href="nature.html#Persefone.@cropname-Tuple{}"><code>@cropname</code></a>, <a href="nature.html#Persefone.@cropheight-Tuple{}"><code>@cropheight</code></a>, <a href="nature.html#Persefone.@distanceto-Tuple{Any}"><code>@distanceto</code></a>, <a href="nature.html#Persefone.@distancetoedge-Tuple{}"><code>@distancetoedge</code></a>, <a href="nature.html#Persefone.@countanimals-Tuple"><code>@countanimals</code></a>. The variables <code>model</code> and <code>pos</code> can be used for checks that don't have a macro available.</p><p>Two example uses of <code>@habitat</code> might look like this:</p><pre><code class="language-julia hljs">movementhabitat = @habitat(@landcover() in (grass agriculture soil)) nestinghabitat = @habitat((@landcover() == grass || (@landcover() == agriculture && @cropname() != "maize" && @cropheight() < 10)) && - @distanceto(forest) > 20)</code></pre><p>For more complex habitat suitability checks, the use of this macro can be circumvented by directly creating an equivalent function.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L240-L267">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@here-Tuple{}" href="#Persefone.@here-Tuple{}"><code>Persefone.@here</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@here()</code></pre><p>Return the landscape pixel of this animal's current location. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L164-L169">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@isalive-Tuple{Any}" href="#Persefone.@isalive-Tuple{Any}"><code>Persefone.@isalive</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@isalive(id)</code></pre><p>Test whether the animal with the given ID is still alive. This can only be used in a context where the <code>model</code> object is available (e.g. nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L153-L159">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@kill-Tuple" href="#Persefone.@kill-Tuple"><code>Persefone.@kill</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@kill</code></pre><p>Kill this animal (and immediately abort its current update if it dies). This is a thin wrapper around <a href="nature.html#Persefone.kill!"><code>kill!</code></a>, and passes on any arguments. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L198-L204">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@killother-Tuple{Any, Vararg{Any}}" href="#Persefone.@killother-Tuple{Any, Vararg{Any}}"><code>Persefone.@killother</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@killother</code></pre><p>Kill another animal. This is a thin wrapper around <a href="nature.html#Persefone.kill!"><code>kill!</code></a>, and passes on any arguments. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L209-L214">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@landcover-Tuple{}" href="#Persefone.@landcover-Tuple{}"><code>Persefone.@landcover</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@landcover</code></pre><p>Returns the local landcover. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L286-L291">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@migrate-Tuple{Any}" href="#Persefone.@migrate-Tuple{Any}"><code>Persefone.@migrate</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@migrate(arrival)</code></pre><p>Remove this animal from the map and add it to the migrant species pool. It will be returned to its current location at the specified <code>arrival</code> date. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L229-L235">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@move-Tuple{Any}" href="#Persefone.@move-Tuple{Any}"><code>Persefone.@move</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@move(position)</code></pre><p>Move the current individual to a new position. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L409-L414">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@nearby_animals-Tuple" href="#Persefone.@nearby_animals-Tuple"><code>Persefone.@nearby_animals</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@nearby_animals(radius=0, species="")</code></pre><p>Return an iterator over all animals in the given radius around the current position. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L373-L378">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@neighbours-Tuple" href="#Persefone.@neighbours-Tuple"><code>Persefone.@neighbours</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@neighbours(radius=0, conspecifics=true)</code></pre><p>Return an iterator over all (by default conspecific) animals in the given radius around this animal, excluding itself. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L397-L402">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@phase-Tuple{Any, Any, Any}" href="#Persefone.@phase-Tuple{Any, Any, Any}"><code>Persefone.@phase</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@phase(name, body)</code></pre><p>Use this macro to describe a species' behaviour during a given phase of its life. The idea behind this is that species show very different behaviour at different times of their lives. Therefore, <code>@phase</code> can be used define the behaviour for one such phase, and the conditions under which the animal transitions to another phase.</p><p><code>@phase</code> works by creating a function that will be called by the model if the animal is in the relevant phase. When it is called, it has access to the following variables:</p><ul><li><code>self</code> a reference to the animal itself. This provides access to all the variables defined in the <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a> definition, as well as all standard <a href="nature.html#Persefone.Animal"><code>Animal</code></a> variables (e.g. <code>self.age</code>, <code>self.sex</code>, <code>self.offspring</code>).</li><li><code>pos</code> gives the animal's current position as a coordinate tuple.</li><li><code>model</code> a reference to the model world (an object of type <a href="simulation.html#Persefone.SimulationModel"><code>SimulationModel</code></a>). This allows access, amongst others, to <code>model.date</code> (the current simulation date) and <code>model.landscape</code> (a two-dimensional array of pixels containing geographic information).</li></ul><p>Many macros are available to make the code within the body of <code>@phase</code> more succinct. Some of the most important of these are: <a href="nature.html#Persefone.@setphase-Tuple{Any}"><code>@setphase</code></a>, <a href="nature.html#Persefone.@respond-Tuple{Any, Any}"><code>@respond</code></a>, <a href="nature.html#Persefone.@kill-Tuple"><code>@kill</code></a>, <a href="nature.html#Persefone.@reproduce-Tuple"><code>@reproduce</code></a>, <a href="nature.html#Persefone.@neighbours-Tuple"><code>@neighbours</code></a>, <a href="nature.html#Persefone.@migrate-Tuple{Any}"><code>@migrate</code></a>, <a href="nature.html#Persefone.@move-Tuple{Any}"><code>@move</code></a>, <a href="io.html#Persefone.@rand-Tuple"><code>@rand</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L86-L110">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@populate-Tuple{Any, Any}" href="#Persefone.@populate-Tuple{Any, Any}"><code>Persefone.@populate</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@populate(species, params)</code></pre><p>Set the parameters that are used to initialise this species' population. For parameter options, see <a href="nature.html#Persefone.PopInitParams"><code>PopInitParams</code></a>.</p><pre><code class="language-julia hljs">@populate <species> begin + @distanceto(forest) > 20)</code></pre><p>For more complex habitat suitability checks, the use of this macro can be circumvented by directly creating an equivalent function.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L281-L308">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@here-Tuple{}" href="#Persefone.@here-Tuple{}"><code>Persefone.@here</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@here()</code></pre><p>Return the landscape pixel of this animal's current location. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L165-L170">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@isalive-Tuple{Any}" href="#Persefone.@isalive-Tuple{Any}"><code>Persefone.@isalive</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@isalive(id)</code></pre><p>Test whether the animal with the given ID is still alive. This can only be used in a context where the <code>model</code> object is available (e.g. nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L154-L160">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@isoccupied-Tuple{Any}" href="#Persefone.@isoccupied-Tuple{Any}"><code>Persefone.@isoccupied</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@isoccupied(position)</code></pre><p>Test whether this position is already occupied by an animal of this species. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L251-L256">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@kill-Tuple" href="#Persefone.@kill-Tuple"><code>Persefone.@kill</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@kill</code></pre><p>Kill this animal (and immediately abort its current update if it dies). This is a thin wrapper around <a href="nature.html#Persefone.kill!"><code>kill!</code></a>, and passes on any arguments. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L199-L205">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@killother-Tuple{Any, Vararg{Any}}" href="#Persefone.@killother-Tuple{Any, Vararg{Any}}"><code>Persefone.@killother</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@killother</code></pre><p>Kill another animal. This is a thin wrapper around <a href="nature.html#Persefone.kill!"><code>kill!</code></a>, and passes on any arguments. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L210-L215">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@landcover-Tuple{}" href="#Persefone.@landcover-Tuple{}"><code>Persefone.@landcover</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@landcover</code></pre><p>Returns the local landcover. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L327-L332">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@migrate-Tuple{Any}" href="#Persefone.@migrate-Tuple{Any}"><code>Persefone.@migrate</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@migrate(arrival)</code></pre><p>Remove this animal from the map and add it to the migrant species pool. It will be returned to its current location at the specified <code>arrival</code> date. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L230-L236">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@move-Tuple{Any}" href="#Persefone.@move-Tuple{Any}"><code>Persefone.@move</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@move(position)</code></pre><p>Move the current individual to a new position. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L461-L466">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@nearby_animals-Tuple" href="#Persefone.@nearby_animals-Tuple"><code>Persefone.@nearby_animals</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@nearby_animals(radius=0, species="")</code></pre><p>Return an iterator over all animals in the given radius around the current position. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> or <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L425-L430">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@neighbours-Tuple" href="#Persefone.@neighbours-Tuple"><code>Persefone.@neighbours</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@neighbours(radius=0, conspecifics=true)</code></pre><p>Return an iterator over all (by default conspecific) animals in the given radius around this animal, excluding itself. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L449-L454">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@occupy-Tuple{Any}" href="#Persefone.@occupy-Tuple{Any}"><code>Persefone.@occupy</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@occupy(position)</code></pre><p>Add the given position to this animal's territory. Use <a href="nature.html#Persefone.@vacate-Tuple{Any}"><code>@vacate</code></a> to remove positions from the territory again. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L241-L246">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@phase-Tuple{Any, Any, Any}" href="#Persefone.@phase-Tuple{Any, Any, Any}"><code>Persefone.@phase</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@phase(name, body)</code></pre><p>Use this macro to describe a species' behaviour during a given phase of its life. The idea behind this is that species show very different behaviour at different times of their lives. Therefore, <code>@phase</code> can be used define the behaviour for one such phase, and the conditions under which the animal transitions to another phase.</p><p><code>@phase</code> works by creating a function that will be called by the model if the animal is in the relevant phase. When it is called, it has access to the following variables:</p><ul><li><code>self</code> a reference to the animal itself. This provides access to all the variables defined in the <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a> definition, as well as all standard <a href="nature.html#Persefone.Animal"><code>Animal</code></a> variables (e.g. <code>self.age</code>, <code>self.sex</code>, <code>self.offspring</code>).</li><li><code>pos</code> gives the animal's current position as a coordinate tuple.</li><li><code>model</code> a reference to the model world (an object of type <a href="simulation.html#Persefone.SimulationModel"><code>SimulationModel</code></a>). This allows access, amongst others, to <code>model.date</code> (the current simulation date) and <code>model.landscape</code> (a two-dimensional array of pixels containing geographic information).</li></ul><p>Many macros are available to make the code within the body of <code>@phase</code> more succinct. Some of the most important of these are: <a href="nature.html#Persefone.@setphase-Tuple{Any}"><code>@setphase</code></a>, <a href="nature.html#Persefone.@respond-Tuple{Any, Any}"><code>@respond</code></a>, <a href="nature.html#Persefone.@kill-Tuple"><code>@kill</code></a>, <a href="nature.html#Persefone.@reproduce-Tuple"><code>@reproduce</code></a>, <a href="nature.html#Persefone.@neighbours-Tuple"><code>@neighbours</code></a>, <a href="nature.html#Persefone.@migrate-Tuple{Any}"><code>@migrate</code></a>, <a href="nature.html#Persefone.@move-Tuple{Any}"><code>@move</code></a>, <a href="nature.html#Persefone.@occupy-Tuple{Any}"><code>@occupy</code></a>, <a href="io.html#Persefone.@rand-Tuple"><code>@rand</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L87-L111">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@populate-Tuple{Any, Any}" href="#Persefone.@populate-Tuple{Any, Any}"><code>Persefone.@populate</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@populate(species, params)</code></pre><p>Set the parameters that are used to initialise this species' population. For parameter options, see <a href="nature.html#Persefone.PopInitParams"><code>PopInitParams</code></a>.</p><pre><code class="language-julia hljs">@populate <species> begin <parameter> = <value> ... -end </code></pre></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L60-L72">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@randomdirection-Tuple" href="#Persefone.@randomdirection-Tuple"><code>Persefone.@randomdirection</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@randomdirection(range=1)</code></pre><p>Return a random direction tuple that can be passed to <a href="nature.html#Persefone.@walk-Tuple"><code>@walk</code></a>. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L363-L368">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@randompixel-Tuple" href="#Persefone.@randompixel-Tuple"><code>Persefone.@randompixel</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@randompixel(range, habitatdescriptor)</code></pre><p>Find a random pixel within a given <code>range</code> of the animal's location that matches the habitatdescriptor (create this using <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>). This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L351-L358">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@reproduce-Tuple" href="#Persefone.@reproduce-Tuple"><code>Persefone.@reproduce</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@reproduce</code></pre><p>Let this animal reproduce. This is a thin wrapper around <a href="energy.html#Persefone.reproduce!-Tuple{Persefone.EnergyBudget}"><code>reproduce!</code></a>, and passes on any arguments. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L219-L224">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@respond-Tuple{Any, Any}" href="#Persefone.@respond-Tuple{Any, Any}"><code>Persefone.@respond</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@respond(eventname, body)</code></pre><p>Define how an animal responds to a landscape event that affects its current position. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L184-L189">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@setphase-Tuple{Any}" href="#Persefone.@setphase-Tuple{Any}"><code>Persefone.@setphase</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@setphase(newphase)</code></pre><p>Switch this animal over to a different phase. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L174-L179">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@species-Tuple{Any, Any}" href="#Persefone.@species-Tuple{Any, Any}"><code>Persefone.@species</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@species(name, body)</code></pre><p>A macro used to add new species types to the nature model. Use this to define species-specific variables and parameters.</p><p>The macro works by creating a keyword-defined mutable struct that contains the standard fields described for the <a href="nature.html#Persefone.Animal"><code>Animal</code></a> type, as well as any new fields that the user adds:</p><pre><code class="language-julia hljs">@species <name> begin +end </code></pre></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L61-L73">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@randomdirection-Tuple" href="#Persefone.@randomdirection-Tuple"><code>Persefone.@randomdirection</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@randomdirection(range=1)</code></pre><p>Return a random direction tuple that can be passed to <a href="nature.html#Persefone.@walk-Tuple"><code>@walk</code></a>. This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L415-L420">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@randompixel-Tuple" href="#Persefone.@randompixel-Tuple"><code>Persefone.@randompixel</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@randompixel(range, habitatdescriptor)</code></pre><p>Find a random pixel within a given <code>range</code> of the animal's location that matches the habitatdescriptor (create this using <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>). This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L403-L410">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@reproduce-Tuple" href="#Persefone.@reproduce-Tuple"><code>Persefone.@reproduce</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@reproduce</code></pre><p>Let this animal reproduce. This is a thin wrapper around <a href="energy.html#Persefone.reproduce!-Tuple{Persefone.EnergyBudget}"><code>reproduce!</code></a>, and passes on any arguments. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L220-L225">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@respond-Tuple{Any, Any}" href="#Persefone.@respond-Tuple{Any, Any}"><code>Persefone.@respond</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@respond(eventname, body)</code></pre><p>Define how an animal responds to a landscape event that affects its current position. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L185-L190">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@setphase-Tuple{Any}" href="#Persefone.@setphase-Tuple{Any}"><code>Persefone.@setphase</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@setphase(newphase)</code></pre><p>Switch this animal over to a different phase. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L175-L180">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@species-Tuple{Any, Any}" href="#Persefone.@species-Tuple{Any, Any}"><code>Persefone.@species</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@species(name, body)</code></pre><p>A macro used to add new species types to the nature model. Use this to define species-specific variables and parameters.</p><p>The macro works by creating a keyword-defined mutable struct that contains the standard fields described for the <a href="nature.html#Persefone.Animal"><code>Animal</code></a> type, as well as any new fields that the user adds:</p><pre><code class="language-julia hljs">@species <name> begin <var1> = <value> <var2> = <value> ... -end</code></pre><p>To complete the species definition, the <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>, <a href="nature.html#Persefone.@create-Tuple{Any, Any}"><code>@create</code></a>, and <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a> macros also need to be used.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L16-L36">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@walk-Tuple" href="#Persefone.@walk-Tuple"><code>Persefone.@walk</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@walk(direction, speed)</code></pre><p>Walk the animal in a given direction, which is specified by a tuple of coordinates relative to the animal's current position (i.e. <code>(2, -3)</code> increments the X coordinate by 2 and decrements the Y coordinate by 3.) This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/macros.jl#L419-L426">source</a></section></article><h2 id="populations.jl"><a class="docs-heading-anchor" href="#populations.jl">populations.jl</a><a id="populations.jl-1"></a><a class="docs-heading-anchor-permalink" href="#populations.jl" title="Permalink"></a></h2><p>This file contains a set of utility functions for species, including initialisation, reproduction, and mortality.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.PopInitParams" href="#Persefone.PopInitParams"><code>Persefone.PopInitParams</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">PopInitParams</code></pre><p>A set of parameters used by <a href="@ref"><code>initpopulation</code></a> to initialise the population of a species at the start of a simulation. Define these parameters for each species using <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a>.</p><ul><li><p><code>initphase</code> determines which life phase individuals will be assigned to at model initialisation (required).</p></li><li><p><code>birthphase</code> determines which life phase individuals will be assigned to at birth (required).</p></li><li><p><code>habitat</code> is a function that determines whether a given location is suitable or not (create this using <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>). By default, every cell will be occupied.</p></li><li><p><code>popsize</code> determines the number of individuals that will be created, dispersed over the suitable locations in the landscape. If this is zero or negative, one individual will be created in every suitable location. If it is greater than the number of suitable locations, multiple individuals will be created per location. Alternately, use <code>indarea</code>.</p></li><li><p><code>indarea</code>: if this is greater than zero, it determines the habitat area allocated to each individual or pair. To be precise, the chance of creating an individual (or pair of individuals) at a suitable location is 1/indarea. Use this as an alternative to <code>popsize</code>.</p></li><li><p>If <code>pairs</code> is true, a male and a female individual will be created in each selected location, otherwise, only one individual will be created at a time. (default: false)</p></li><li><p>If <code>asexual</code> is true, all created individuals are assigned the sex <code>hermaphrodite</code>, otherwise, they are randomly assigned <code>male</code> or <code>female</code>. If <code>pairs</code> is true, <code>asexual</code> is ignored. (default: false)</p></li></ul></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L7-L37">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.countanimals-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.countanimals-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.countanimals</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">countanimals(pos, model; radius=0, species="")</code></pre><p>Return the number of animals in the given radius around this position, optionally filtering by species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L251-L256">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}" href="#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}"><code>Persefone.directionto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">directionto(pos, model, animal)</code></pre><p>Calculate the direction from the given position to the animal.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L275-L279">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}" href="#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}"><code>Persefone.distanceto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distanceto(pos, model, animal)</code></pre><p>Calculate the distance from the given position to the animal.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L285-L289">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.followanimal!" href="#Persefone.followanimal!"><code>Persefone.followanimal!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">followanimal!(follower, leader, model, distance=0)</code></pre><p>Move the follower animal to a location near the leading animal.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L296-L300">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initindividuals!-Tuple{Type, Tuple{Int64, Int64}, Persefone.PopInitParams, SimulationModel}" href="#Persefone.initindividuals!-Tuple{Type, Tuple{Int64, Int64}, Persefone.PopInitParams, SimulationModel}"><code>Persefone.initindividuals!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initindividuals!(species, pos, popinitparams, model)</code></pre><p>Initialise one or two individuals (depending on the <code>pairs</code> parameter) in the given location. Returns the number of created individuals. (Internal helper function for <code>initpopulation!()</code>.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L113-L119">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initpopulation!-Tuple{String, SimulationModel}" href="#Persefone.initpopulation!-Tuple{String, SimulationModel}"><code>Persefone.initpopulation!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initpopulation!(speciesname, model)</code></pre><p>Initialise the population of the given species, based on the parameters stored in <a href="nature.html#Persefone.PopInitParams"><code>PopInitParams</code></a>. Define these using <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L57-L62">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initpopulation!-Tuple{Type, Persefone.PopInitParams, SimulationModel}" href="#Persefone.initpopulation!-Tuple{Type, Persefone.PopInitParams, SimulationModel}"><code>Persefone.initpopulation!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initpopulation!(speciestype, popinitparams, model)</code></pre><p>Initialise the population of the given species, based on the given initialisation parameters. This is an internal function called by <code>initpopulation!()</code>, and was split off from it to allow better testing.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L69-L75">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.isalive-Tuple{Int64, SimulationModel}" href="#Persefone.isalive-Tuple{Int64, SimulationModel}"><code>Persefone.isalive</code></a> — <span class="docstring-category">Method</span></header><section><div><p>isalive(id, model)</p><p>Test whether the animal with the given ID is still alive.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L207-L211">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.kill!" href="#Persefone.kill!"><code>Persefone.kill!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">kill!(animal, model, probability=1.0, cause="")</code></pre><p>Kill this animal, optionally with a given percentage probability. Returns true if the animal dies, false if not.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L169-L174">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.migrate!-Tuple{Animal, SimulationModel, Dates.Date}" href="#Persefone.migrate!-Tuple{Animal, SimulationModel, Dates.Date}"><code>Persefone.migrate!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">migrate!(animal, model, arrival)</code></pre><p>Remove this animal from the map and add it to the migrant species pool. It will be returned to its current location at the specified <code>arrival</code> date.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L187-L192">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.move!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}" href="#Persefone.move!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}"><code>Persefone.move!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">move!(animal, model, position)</code></pre><p>Move the animal to the given position, making sure that this is in-bounds. If the position is out of bounds, the animal stops at the map edge.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L310-L315">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nearby_animals-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.nearby_animals-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.nearby_animals</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">nearby_animals(pos, model; radius= 0, species="")</code></pre><p>Return a list of animals in the given radius around this position, optionally filtering by species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L235-L239">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nearby_ids-Tuple{Tuple{Int64, Int64}, SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}" href="#Persefone.nearby_ids-Tuple{Tuple{Int64, Int64}, SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}"><code>Persefone.nearby_ids</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">nearby_ids(pos, model, radius)</code></pre><p>Return a list of IDs of the animals within a given radius of the position.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L216-L220">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.neighbours" href="#Persefone.neighbours"><code>Persefone.neighbours</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">neighbours(animal, model, radius=0, conspecifics=true)</code></pre><p>Return a list of animals in the given radius around this animal, excluding itself. By default, only return conspecific animals.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L262-L267">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.populationparameters-Tuple{Type}" href="#Persefone.populationparameters-Tuple{Type}"><code>Persefone.populationparameters</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">populationparameters(type)</code></pre><p>A function that returns a <a href="nature.html#Persefone.PopInitParams"><code>PopInitParams</code></a> object for the given species type. Parametric methods for each species are defined with <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a>. This is the catch-all method, which throws an error if no species-specific function is defined.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L48-L54">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.reproduce!" href="#Persefone.reproduce!"><code>Persefone.reproduce!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">reproduce!(animal, model, mate, n=1)</code></pre><p>Produce one or more offspring for the given animal at its current location. The <code>mate</code> argument gives the ID of the reproductive partner.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L142-L147">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.walk!" href="#Persefone.walk!"><code>Persefone.walk!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">walk!(animal, model, direction, distance=-1)</code></pre><p>Let the animal move in the given direction, where the direction is defined by an (x, y) tuple to specify the shift in coordinates. If maxdist >= 0, move no further than the specified distance.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L356-L362">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.walk!" href="#Persefone.walk!"><code>Persefone.walk!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">walk!(animal, model, direction, distance=1pixel)</code></pre><p>Let the animal move a given number of steps in the given direction ("north", "northeast", "east", "southeast", "south", "southwest", "west", "northwest", "random").</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/populations.jl#L324-L329">source</a></section></article><h2 id="insects.jl"><a class="docs-heading-anchor" href="#insects.jl">insects.jl</a><a id="insects.jl-1"></a><a class="docs-heading-anchor-permalink" href="#insects.jl" title="Permalink"></a></h2><p>This file contains the insect submodel, which calculates the likely insect biomass in a given location at a given time.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.insectbiomass-Tuple{Pixel, SimulationModel}" href="#Persefone.insectbiomass-Tuple{Pixel, SimulationModel}"><code>Persefone.insectbiomass</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">insectbiomass(pixel, model)</code></pre><p>Calculate the insect biomass in this location, using the factors configured in the <code>nature.insectmodel</code> settings (any combination of: "season", "habitat", "weather", "pesticides"). Returns a float value in g/m².</p><p><strong>Biological note:</strong> this is a very approximate calculation! Insect biomass varies wildly in time and space and is hard to measure. This calculation is based on the idea of a parabolic seasonal development of insect abundance, modified by habitat suitability, weather, and pesticide application. Although it is based on empirical studies, it can only deliver a rough, order-of-magnitude estimation of likely insect biomass in a given location.</p><p><strong>Sources:</strong></p><ul><li>Odderskær et al. (1997). Skylark Reproduction in Pesticide Treated and Untreated Fields (32; Pesticides Research). Danish Environmental Protection Agency.</li><li>Grüebler et al. (2008). A predictive model of the density of airborne insects in agricultural environments. Agriculture, Ecosystems & Environment, 123(1), 75–80. https://doi.org/10.1016/j.agee.2007.05.001</li><li>Paquette et al. (2013). Seasonal patterns in Tree Swallow prey (Diptera) abundance are affected by agricultural intensification. Ecological Applications, 23(1), 122–133. https://doi.org/10.1890/12-0068.1</li><li>Püttmanns et al. (2022). Habitat use and foraging parameters of breeding Skylarks indicate no seasonal decrease in food availability in heterogeneous farmland. Ecology and Evolution, 12(1), e8461. https://doi.org/10.1002/ece3.8461</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/insects.jl#L6-L26">source</a></section></article><h2 id="ecologicaldata.jl"><a class="docs-heading-anchor" href="#ecologicaldata.jl">ecologicaldata.jl</a><a id="ecologicaldata.jl-1"></a><a class="docs-heading-anchor-permalink" href="#ecologicaldata.jl" title="Permalink"></a></h2><p>This file contains a set of life-history related utility functions needed by species.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initecologicaldata-Tuple{SimulationModel}" href="#Persefone.initecologicaldata-Tuple{SimulationModel}"><code>Persefone.initecologicaldata</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initecologicaldata()</code></pre><p>Create output files for each data group collected by the nature model.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/ecologicaldata.jl#L7-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.saveindividualdata-Tuple{SimulationModel}" href="#Persefone.saveindividualdata-Tuple{SimulationModel}"><code>Persefone.saveindividualdata</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">saveindividualdata(model)</code></pre><p>Return a data table (to be printed to <code>individuals.csv</code>), listing all properties of all animal individuals in the model. May be called never, daily, monthly, yearly, or at the end of a simulation, depending on the parameter <code>nature.indoutfreq</code>. WARNING: Produces very big files!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/ecologicaldata.jl#L43-L50">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.savepopulationdata-Tuple{SimulationModel}" href="#Persefone.savepopulationdata-Tuple{SimulationModel}"><code>Persefone.savepopulationdata</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">savepopulationdata(model)</code></pre><p>Return a data table (to be printed to <code>populations.csv</code>), giving the current date and population size for each animal species. May be called never, daily, monthly, yearly, or at the end of a simulation, depending on the parameter <code>nature.popoutfreq</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/ecologicaldata.jl#L19-L26">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="io.html">« Input and Output</a><a class="docs-footer-nextpage" href="energy.html">Dynamic Energy Budgets »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +end</code></pre><p>To complete the species definition, the <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>, <a href="nature.html#Persefone.@create-Tuple{Any, Any}"><code>@create</code></a>, and <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a> macros also need to be used.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L16-L36">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@vacate-Tuple{Any}" href="#Persefone.@vacate-Tuple{Any}"><code>Persefone.@vacate</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@vacate(position)</code></pre><p>Remove the given position from this animal's territory. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L261-L266">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@vacate-Tuple{}" href="#Persefone.@vacate-Tuple{}"><code>Persefone.@vacate</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@vacate()</code></pre><p>Remove this animal's complete territory. This can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L271-L276">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.@walk-Tuple" href="#Persefone.@walk-Tuple"><code>Persefone.@walk</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@walk(direction, speed)</code></pre><p>Walk the animal in a given direction, which is specified by a tuple of coordinates relative to the animal's current position (i.e. <code>(2, -3)</code> increments the X coordinate by 2 and decrements the Y coordinate by 3.) This is a utility wrapper that can only be used nested within <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/macros.jl#L471-L478">source</a></section></article><h2 id="individuals.jl"><a class="docs-heading-anchor" href="#individuals.jl">individuals.jl</a><a id="individuals.jl-1"></a><a class="docs-heading-anchor-permalink" href="#individuals.jl" title="Permalink"></a></h2><p>This file contains life-history and other ecological functions that apply to all animal individuals, such reproduction, death, and movement.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.followanimal!" href="#Persefone.followanimal!"><code>Persefone.followanimal!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">followanimal!(follower, leader, model, distance=0)</code></pre><p>Move the follower animal to a location near the leading animal.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L112-L116">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.kill!" href="#Persefone.kill!"><code>Persefone.kill!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">kill!(animal, model, probability=1.0, cause="")</code></pre><p>Kill this animal, optionally with a given percentage probability. Returns true if the animal dies, false if not.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L34-L39">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.migrate!-Tuple{Animal, SimulationModel, Dates.Date}" href="#Persefone.migrate!-Tuple{Animal, SimulationModel, Dates.Date}"><code>Persefone.migrate!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">migrate!(animal, model, arrival)</code></pre><p>Remove this animal from the map and add it to the migrant species pool. It will be returned to its current location at the specified <code>arrival</code> date.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L57-L62">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.move!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}" href="#Persefone.move!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}"><code>Persefone.move!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">move!(animal, model, position)</code></pre><p>Move the animal to the given position, making sure that this is in-bounds. If the position is out of bounds, the animal stops at the map edge.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L126-L131">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.occupy!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}" href="#Persefone.occupy!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}"><code>Persefone.occupy!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">occupy!(animal, model, position)</code></pre><p>Add the given location to the animal's territory.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L77-L81">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.reproduce!" href="#Persefone.reproduce!"><code>Persefone.reproduce!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">reproduce!(animal, model, mate, n=1)</code></pre><p>Produce one or more offspring for the given animal at its current location. The <code>mate</code> argument gives the ID of the reproductive partner.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L7-L12">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.vacate!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}" href="#Persefone.vacate!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}"><code>Persefone.vacate!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">vacate!(animal, model, position)</code></pre><p>Remove this position from the animal's territory.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L90-L94">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.vacate!-Tuple{Animal, SimulationModel}" href="#Persefone.vacate!-Tuple{Animal, SimulationModel}"><code>Persefone.vacate!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">vacate!(animal, model)</code></pre><p>Remove the animal's complete territory.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L100-L104">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.walk!" href="#Persefone.walk!"><code>Persefone.walk!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">walk!(animal, model, direction, distance=-1)</code></pre><p>Let the animal move in the given direction, where the direction is defined by an (x, y) tuple to specify the shift in coordinates. If maxdist >= 0, move no further than the specified distance.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L175-L181">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.walk!" href="#Persefone.walk!"><code>Persefone.walk!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">walk!(animal, model, direction, distance=1pixel)</code></pre><p>Let the animal move a given number of steps in the given direction ("north", "northeast", "east", "southeast", "south", "southwest", "west", "northwest", "random").</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/individuals.jl#L140-L145">source</a></section></article><h2 id="populations.jl"><a class="docs-heading-anchor" href="#populations.jl">populations.jl</a><a id="populations.jl-1"></a><a class="docs-heading-anchor-permalink" href="#populations.jl" title="Permalink"></a></h2><p>This file contains functions that apply to all animal populations, such as for initialisation, or querying for neighbours.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.PopInitParams" href="#Persefone.PopInitParams"><code>Persefone.PopInitParams</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">PopInitParams</code></pre><p>A set of parameters used by <a href="nature.html#Persefone.initpopulation!-Tuple{String, SimulationModel}"><code>initpopulation!</code></a> to initialise the population of a species at the start of a simulation. Define these parameters for each species using <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a>.</p><ul><li><p><code>initphase</code> determines which life phase individuals will be assigned to at model initialisation (required).</p></li><li><p><code>birthphase</code> determines which life phase individuals will be assigned to at birth (required).</p></li><li><p><code>habitat</code> is a function that determines whether a given location is suitable or not (create this using <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>). By default, every cell will be occupied.</p></li><li><p><code>popsize</code> determines the number of individuals that will be created, dispersed over the suitable locations in the landscape. If this is zero or negative, one individual will be created in every suitable location. If it is greater than the number of suitable locations, multiple individuals will be created per location. Alternately, use <code>indarea</code>.</p></li><li><p><code>indarea</code>: if this is greater than zero, it determines the habitat area allocated to each individual or pair. To be precise, the chance of creating an individual (or pair of individuals) at a suitable location is 1/indarea. Use this as an alternative to <code>popsize</code>.</p></li><li><p>If <code>pairs</code> is true, a male and a female individual will be created in each selected location, otherwise, only one individual will be created at a time. (default: false)</p></li><li><p>If <code>asexual</code> is true, all created individuals are assigned the sex <code>hermaphrodite</code>, otherwise, they are randomly assigned <code>male</code> or <code>female</code>. If <code>pairs</code> is true, <code>asexual</code> is ignored. (default: false)</p></li></ul></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L7-L37">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.countanimals-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.countanimals-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.countanimals</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">countanimals(pos, model; radius=0, species="")</code></pre><p>Return the number of animals in the given radius around this position, optionally filtering by species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L198-L203">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}" href="#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}"><code>Persefone.directionto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">directionto(pos, model, animal)</code></pre><p>Calculate the direction from the given position to the animal.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L222-L226">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}" href="#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}"><code>Persefone.distanceto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distanceto(pos, model, animal)</code></pre><p>Calculate the distance from the given position to the animal.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L232-L236">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initindividuals!-Tuple{Type, Tuple{Int64, Int64}, Persefone.PopInitParams, SimulationModel}" href="#Persefone.initindividuals!-Tuple{Type, Tuple{Int64, Int64}, Persefone.PopInitParams, SimulationModel}"><code>Persefone.initindividuals!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initindividuals!(species, pos, popinitparams, model)</code></pre><p>Initialise one or two individuals (depending on the <code>pairs</code> parameter) in the given location. Returns the number of created individuals. (Internal helper function for <code>initpopulation!()</code>.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L113-L119">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initpopulation!-Tuple{String, SimulationModel}" href="#Persefone.initpopulation!-Tuple{String, SimulationModel}"><code>Persefone.initpopulation!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initpopulation!(speciesname, model)</code></pre><p>Initialise the population of the given species, based on the parameters stored in <a href="nature.html#Persefone.PopInitParams"><code>PopInitParams</code></a>. Define these using <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L57-L62">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initpopulation!-Tuple{Type, Persefone.PopInitParams, SimulationModel}" href="#Persefone.initpopulation!-Tuple{Type, Persefone.PopInitParams, SimulationModel}"><code>Persefone.initpopulation!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initpopulation!(speciestype, popinitparams, model)</code></pre><p>Initialise the population of the given species, based on the given initialisation parameters. This is an internal function called by <code>initpopulation!()</code>, and was split off from it to allow better testing.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L69-L75">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.isalive-Tuple{Int64, SimulationModel}" href="#Persefone.isalive-Tuple{Int64, SimulationModel}"><code>Persefone.isalive</code></a> — <span class="docstring-category">Method</span></header><section><div><p>isalive(id, model)</p><p>Test whether the animal with the given ID is still alive.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L154-L158">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.isoccupied-Tuple{SimulationModel, String, Tuple{Int64, Int64}}" href="#Persefone.isoccupied-Tuple{SimulationModel, String, Tuple{Int64, Int64}}"><code>Persefone.isoccupied</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">isoccupied(model, position, species)</code></pre><p>Test whether this location is part of the territory of an animal of the given species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L142-L146">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nearby_animals-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.nearby_animals-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.nearby_animals</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">nearby_animals(pos, model; radius= 0, species="")</code></pre><p>Return a list of animals in the given radius around this position, optionally filtering by species.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L182-L186">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nearby_ids-Tuple{Tuple{Int64, Int64}, SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}" href="#Persefone.nearby_ids-Tuple{Tuple{Int64, Int64}, SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}"><code>Persefone.nearby_ids</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">nearby_ids(pos, model, radius)</code></pre><p>Return a list of IDs of the animals within a given radius of the position.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L163-L167">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.neighbours" href="#Persefone.neighbours"><code>Persefone.neighbours</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">neighbours(animal, model, radius=0, conspecifics=true)</code></pre><p>Return a list of animals in the given radius around this animal, excluding itself. By default, only return conspecific animals.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L209-L214">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.populationparameters-Tuple{Type}" href="#Persefone.populationparameters-Tuple{Type}"><code>Persefone.populationparameters</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">populationparameters(type)</code></pre><p>A function that returns a <a href="nature.html#Persefone.PopInitParams"><code>PopInitParams</code></a> object for the given species type. Parametric methods for each species are defined with <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a>. This is the catch-all method, which throws an error if no species-specific function is defined.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/populations.jl#L48-L54">source</a></section></article><h2 id="ecologicaldata.jl"><a class="docs-heading-anchor" href="#ecologicaldata.jl">ecologicaldata.jl</a><a id="ecologicaldata.jl-1"></a><a class="docs-heading-anchor-permalink" href="#ecologicaldata.jl" title="Permalink"></a></h2><p>This file contains a set of life-history related utility functions needed by species.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initecologicaldata-Tuple{SimulationModel}" href="#Persefone.initecologicaldata-Tuple{SimulationModel}"><code>Persefone.initecologicaldata</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initecologicaldata()</code></pre><p>Create output files for each data group collected by the nature model.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/ecologicaldata.jl#L7-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.saveindividualdata-Tuple{SimulationModel}" href="#Persefone.saveindividualdata-Tuple{SimulationModel}"><code>Persefone.saveindividualdata</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">saveindividualdata(model)</code></pre><p>Return a data table (to be printed to <code>individuals.csv</code>), listing all properties of all animal individuals in the model. May be called never, daily, monthly, yearly, or at the end of a simulation, depending on the parameter <code>nature.indoutfreq</code>. WARNING: Produces very big files!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/ecologicaldata.jl#L43-L50">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.savepopulationdata-Tuple{SimulationModel}" href="#Persefone.savepopulationdata-Tuple{SimulationModel}"><code>Persefone.savepopulationdata</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">savepopulationdata(model)</code></pre><p>Return a data table (to be printed to <code>populations.csv</code>), giving the current date and population size for each animal species. May be called never, daily, monthly, yearly, or at the end of a simulation, depending on the parameter <code>nature.popoutfreq</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/ecologicaldata.jl#L19-L26">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="io.html">« Input and Output</a><a class="docs-footer-nextpage" href="species.html">Species models »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/odd.html b/docs/build/odd.html index a88c1739d80a6aa55331b16f73a16204f65e7a47..8e0e5ac78a3707c5e257b7371308260a6161a865 100644 --- a/docs/build/odd.html +++ b/docs/build/odd.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Overview, Design, Details (ODD) · Persefone.jl</title><meta name="title" content="Overview, Design, Details (ODD) · Persefone.jl"/><meta property="og:title" content="Overview, Design, Details (ODD) · Persefone.jl"/><meta property="twitter:title" content="Overview, Design, Details (ODD) · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="odd.html">Overview, Design, Details (ODD)</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="odd.html">Overview, Design, Details (ODD)</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/odd.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Overview,-Design,-Details-(ODD)"><a class="docs-heading-anchor" href="#Overview,-Design,-Details-(ODD)">Overview, Design, Details (ODD)</a><a id="Overview,-Design,-Details-(ODD)-1"></a><a class="docs-heading-anchor-permalink" href="#Overview,-Design,-Details-(ODD)" title="Permalink"></a></h1><p><em>TODO</em></p></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Overview, Design, Details (ODD) · Persefone.jl</title><meta name="title" content="Overview, Design, Details (ODD) · Persefone.jl"/><meta property="og:title" content="Overview, Design, Details (ODD) · Persefone.jl"/><meta property="twitter:title" content="Overview, Design, Details (ODD) · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="odd.html">Overview, Design, Details (ODD)</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="odd.html">Overview, Design, Details (ODD)</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/odd.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Overview,-Design,-Details-(ODD)"><a class="docs-heading-anchor" href="#Overview,-Design,-Details-(ODD)">Overview, Design, Details (ODD)</a><a id="Overview,-Design,-Details-(ODD)-1"></a><a class="docs-heading-anchor-permalink" href="#Overview,-Design,-Details-(ODD)" title="Permalink"></a></h1><p>The model description follows the ODD (Overview, Design concepts, Details) protocol (Grimm et al., <a href="https://doi.org/10.1016/j.ecolmodel.2006.04.023">2006</a>; <a href="https://doi.org/10.1016/j.ecolmodel.2010.08.019">2010</a>; <a href="https://doi.org/10.18564/jasss.4259">2020</a>):</p><h2 id=".-Purpose"><a class="docs-heading-anchor" href="#.-Purpose">1. Purpose</a><a id=".-Purpose-1"></a><a class="docs-heading-anchor-permalink" href="#.-Purpose" title="Permalink"></a></h2><h2 id=".-Entities,-state-variables,-and-scales"><a class="docs-heading-anchor" href="#.-Entities,-state-variables,-and-scales">2. Entities, state variables, and scales</a><a id=".-Entities,-state-variables,-and-scales-1"></a><a class="docs-heading-anchor-permalink" href="#.-Entities,-state-variables,-and-scales" title="Permalink"></a></h2><h2 id=".-Process-overview-and-scheduling"><a class="docs-heading-anchor" href="#.-Process-overview-and-scheduling">3. Process overview and scheduling</a><a id=".-Process-overview-and-scheduling-1"></a><a class="docs-heading-anchor-permalink" href="#.-Process-overview-and-scheduling" title="Permalink"></a></h2><h2 id=".-Design-concepts"><a class="docs-heading-anchor" href="#.-Design-concepts">4. Design concepts</a><a id=".-Design-concepts-1"></a><a class="docs-heading-anchor-permalink" href="#.-Design-concepts" title="Permalink"></a></h2><h3 id=".1-Basic-principles"><a class="docs-heading-anchor" href="#.1-Basic-principles">4.1 Basic principles</a><a id=".1-Basic-principles-1"></a><a class="docs-heading-anchor-permalink" href="#.1-Basic-principles" title="Permalink"></a></h3><h3 id=".2-Emergence"><a class="docs-heading-anchor" href="#.2-Emergence">4.2 Emergence</a><a id=".2-Emergence-1"></a><a class="docs-heading-anchor-permalink" href="#.2-Emergence" title="Permalink"></a></h3><h3 id=".3-Adaptation"><a class="docs-heading-anchor" href="#.3-Adaptation">4.3 Adaptation</a><a id=".3-Adaptation-1"></a><a class="docs-heading-anchor-permalink" href="#.3-Adaptation" title="Permalink"></a></h3><h3 id=".4-Objectives"><a class="docs-heading-anchor" href="#.4-Objectives">4.4 Objectives</a><a id=".4-Objectives-1"></a><a class="docs-heading-anchor-permalink" href="#.4-Objectives" title="Permalink"></a></h3><h3 id=".5-Learning"><a class="docs-heading-anchor" href="#.5-Learning">4.5 Learning</a><a id=".5-Learning-1"></a><a class="docs-heading-anchor-permalink" href="#.5-Learning" title="Permalink"></a></h3><h3 id=".6-Prediction"><a class="docs-heading-anchor" href="#.6-Prediction">4.6 Prediction</a><a id=".6-Prediction-1"></a><a class="docs-heading-anchor-permalink" href="#.6-Prediction" title="Permalink"></a></h3><h3 id=".7-Sensing"><a class="docs-heading-anchor" href="#.7-Sensing">4.7 Sensing</a><a id=".7-Sensing-1"></a><a class="docs-heading-anchor-permalink" href="#.7-Sensing" title="Permalink"></a></h3><h3 id=".8-Interaction"><a class="docs-heading-anchor" href="#.8-Interaction">4.8 Interaction</a><a id=".8-Interaction-1"></a><a class="docs-heading-anchor-permalink" href="#.8-Interaction" title="Permalink"></a></h3><h3 id=".9-Stochasticity"><a class="docs-heading-anchor" href="#.9-Stochasticity">4.9 Stochasticity</a><a id=".9-Stochasticity-1"></a><a class="docs-heading-anchor-permalink" href="#.9-Stochasticity" title="Permalink"></a></h3><h3 id=".10-Collectives"><a class="docs-heading-anchor" href="#.10-Collectives">4.10 Collectives</a><a id=".10-Collectives-1"></a><a class="docs-heading-anchor-permalink" href="#.10-Collectives" title="Permalink"></a></h3><h3 id=".11-Observation"><a class="docs-heading-anchor" href="#.11-Observation">4.11 Observation</a><a id=".11-Observation-1"></a><a class="docs-heading-anchor-permalink" href="#.11-Observation" title="Permalink"></a></h3><h2 id=".-Initialisation"><a class="docs-heading-anchor" href="#.-Initialisation">5. Initialisation</a><a id=".-Initialisation-1"></a><a class="docs-heading-anchor-permalink" href="#.-Initialisation" title="Permalink"></a></h2><h2 id=".-Input-data"><a class="docs-heading-anchor" href="#.-Input-data">6. Input data</a><a id=".-Input-data-1"></a><a class="docs-heading-anchor-permalink" href="#.-Input-data" title="Permalink"></a></h2><h2 id=".-Submodels"><a class="docs-heading-anchor" href="#.-Submodels">7. Submodels</a><a id=".-Submodels-1"></a><a class="docs-heading-anchor-permalink" href="#.-Submodels" title="Permalink"></a></h2><h2 id=".-References"><a class="docs-heading-anchor" href="#.-References">8. References</a><a id=".-References-1"></a><a class="docs-heading-anchor-permalink" href="#.-References" title="Permalink"></a></h2></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/search_index.js b/docs/build/search_index.js index e06aaa9c79cba951a4a3468b565fd5fac04c7825..aa28d39b68dde9896ad7c0dcfd274c25f7ffb3a6 100644 --- a/docs/build/search_index.js +++ b/docs/build/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"energy.html#Dynamic-Energy-Budgets","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"","category":"section"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"Persefone's nature module uses Kooijman's Dynamic Energy Budget theory to model energy flows within individuals.","category":"page"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"(Image: \"The standard model of the Dynamic Energy Budget theory\")","category":"page"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"The standard model of the Dynamic Energy Budget theory. (Fig. 1 from Sousa et al. (2010).)","category":"page"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"Sousa et al. (2010). Dynamic energy budget theory restores coherence in biology. Philosophical Transactions of the Royal Society B: Biological Sciences, 365(1557), 3413–3428.\nKooijman, S. A. L. M. (2009). Dynamic energy and mass budgets in biological systems (3rd ed). Cambridge University Press.\nSibly et al. (2013). Representing the acquisition and use of energy by individuals in agent-based models of animal populations. Methods in Ecology and Evolution, 4(2), 151–161.","category":"page"},{"location":"energy.html#energy.jl","page":"Dynamic Energy Budgets","title":"energy.jl","text":"","category":"section"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"Modules = [Persefone]\nPages = [\"nature/energy.jl\"]","category":"page"},{"location":"energy.html#Persefone.DEBparameters","page":"Dynamic Energy Budgets","title":"Persefone.DEBparameters","text":"DEBparameters\n\nAn immutable struct to save the parameter list for a species' Dynamic Energy Budget model. (See Sousa et al., 2010.)\n\n\n\n\n\n","category":"type"},{"location":"energy.html#Persefone.EnergyBudget","page":"Dynamic Energy Budgets","title":"Persefone.EnergyBudget","text":"EnergyBudget\n\nThis struct represents an individual's energy balance, as conceptualised by the Dynamic Energy Budget theory. Upon assimilation, energy is first stored as biomass in a reserve buffer, before being used for maintenance, growth, and reproduction. (Note that this is a simplified model form which ignores maturity as a separate buffer.)\n\nSources:\n\nMalishev & Kramer-Schadt (2021). Movement, models, and metabolism: Individual-based energy budget models as next-generation extensions for predicting animal movement outcomes across scales. Ecological Modelling, 441, 109413. https://doi.org/10.1016/j.ecolmodel.2020.109413\nMarques et al. (2018). The AmP project: Comparing species on the basis of dynamic energy budget parameters. PLOS Computational Biology,14(5), e1006100. https://doi.org/10.1371/journal.pcbi.1006100\nSibly et al. (2013). Representing the acquisition and use of energy by individuals in agent-based models of animal populations. Methods in Ecology and Evolution, 4(2), 151–161. https://doi.org/10.1111/2041-210x.12002\nSousa et al. (2010). Dynamic energy budget theory restores coherence in biology. Philosophical Transactions of the Royal Society B: Biological Sciences, 365(1557), 3413–3428. https://doi.org/10.1098/rstb.2010.0166\nKooijman, S. A. L. M. (2009). Dynamic energy and mass budgets in biological systems (3rd ed). Cambridge University Press. https://www.researchgate.net/profile/Edgar-Meza-3/post/Isthereatoxicokineticmodelfordaphniamagnaorotherzooplankton/attachment/59d62cf579197b807798b396/AS%3A348547653357569%401460111644286/download/Dynamic+Energy+Budget+theory+-+Kooijman.pdf\ncompare with: Brown et al. (2004). Toward a metabolic theory of ecology. Ecology, 85(7), 1771–1789. https://doi.org/10.1890/03-9000\n\n\n\n\n\n","category":"type"},{"location":"energy.html#Persefone.feed!-Tuple{Float64, Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.feed!","text":"feed!(quantity, energybudget)\n\nConsume a given quantity of food. Expands the energy reserve by an amount determined by the assimilation rate. Returns true if successful, false if the reserve is already full.\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.growthrate-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.growthrate","text":"growthrate(energybudget)\n\nCalculate the specific growth rate r. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.investmentratio-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.investmentratio","text":"investmentratio(energybudget)\n\nCalculate the investment ratio g. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.maturitymaintenance-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.maturitymaintenance","text":"maturitymaintenance(energybudget)\n\nCalculate the specific maturity maintenance k_J. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.mobilisation-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.mobilisation","text":"mobilisation(energybudget)\n\nCalculate the mobilisation rate J_EC. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.reproduce!-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.reproduce!","text":"reproduce!(energybudget)\n\nIf there is sufficient energy in the offspring buffer of an adult, produce an embryo/egg, reducing the parent energy in the process. Returns the embryo's energy budget, or nothing if the conditions are not met.\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.scaledreservedensity-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.scaledreservedensity","text":"scaledreservedensity(energybudget)\n\nCalculate the scaled reserve density e. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.update!-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.update!","text":"update!(energybudget)\n\nCarry out a daily update of the energy budget. Mobilises reserves and allocates these to maintenance (prioritised), growth, and reproduction.\n\nReturn true if the individual has enough energy to survive, or false if the reserve is empty and it starves.\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.volumetriclength-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.volumetriclength","text":"volumetriclength(energybudget)\n\nCalculate the structural length in cm based on an individual's weight (assuming a density of 1 g/cm³ to calculate volume, see Kooijman 2009).\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Nature","page":"Nature","title":"Nature","text":"","category":"section"},{"location":"nature.html#nature.jl","page":"Nature","title":"nature.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature","title":"Nature","text":"This file is responsible for managing the animal modules.","category":"page"},{"location":"nature.html","page":"Nature","title":"Nature","text":"Modules = [Persefone]\nPages = [\"nature/nature.jl\"]","category":"page"},{"location":"nature.html#Persefone.Animal","page":"Nature","title":"Persefone.Animal","text":"Animal\n\nThis is the generic agent type for all animals. Individual species are created using the @species macro. In addition to user-defined, species-specific fields, all species contain the following fields:\n\nid An integer unique identifier for this individual.\nsex male, female, or hermaphrodite.\nparents The IDs of the individual's parents.\npos An (x, y) coordinate tuple.\nage The age of the individual in days.\nphase The update function to be called during the individual's current life phase.\nenergy A DEBparameters struct for calculating energy budgets.\noffspring A vector containing the IDs of an individual's children.\n\n\n\n\n\n","category":"type"},{"location":"nature.html#Persefone.animalid-Tuple{Animal}","page":"Nature","title":"Persefone.animalid","text":"animalid(animal)\n\nA small utility function to return a string with the species name and ID of an animal.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.create!-Tuple{Animal, SimulationModel}","page":"Nature","title":"Persefone.create!","text":"create!(animal, model)\n\nThe create! function is called for every individual at birth or at model initialisation. Species must use @create to define a species-specific method. This is the fall- back method, in case none is implemented for a species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.initnature!-Tuple{SimulationModel}","page":"Nature","title":"Persefone.initnature!","text":"initnature!(model)\n\nInitialise the model with all simulated animal populations.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.killallanimals!-Tuple{Any}","page":"Nature","title":"Persefone.killallanimals!","text":"killallanimals!(model)\n\nRemove all animal individuals from the simulation.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.speciesof-Tuple{Union{Animal, Type}}","page":"Nature","title":"Persefone.speciesof","text":"speciesof(animal)\n\nReturn the species name of this animal as a string.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.speciestype-Tuple{String}","page":"Nature","title":"Persefone.speciestype","text":"speciestype(name)\n\nReturn the Type of this species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.stepagent!-Tuple{Animal, SimulationModel}","page":"Nature","title":"Persefone.stepagent!","text":"stepagent!(animal, model)\n\nUpdate an animal by one day, executing it's currently active phase function.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.updatenature!-Tuple{SimulationModel}","page":"Nature","title":"Persefone.updatenature!","text":"updatenature!(model)\n\nRun processes that affect all animals.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#macros.jl","page":"Nature","title":"macros.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature","title":"Nature","text":"This file contains all the macros that can be used in the species DSL.","category":"page"},{"location":"nature.html","page":"Nature","title":"Nature","text":"Modules = [Persefone]\nPages = [\"nature/macros.jl\"]","category":"page"},{"location":"nature.html#Persefone.@animal-Tuple{Any}","page":"Nature","title":"Persefone.@animal","text":"@animal(id)\n\nReturn the animal object associated with this ID number. This can only be used in a context where the model object is available (e.g. nested within @phase).\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@countanimals-Tuple","page":"Nature","title":"Persefone.@countanimals","text":"@countanimals(radius=0, species=\"\")\n\nCount the number of animals at or near this location, optionally filtering by species. This can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@create-Tuple{Any, Any}","page":"Nature","title":"Persefone.@create","text":"@create(species, body)\n\nDefine a special phase function (create!()) that will be called when an individual of this species is created, at the initialisation of the simulation or at birth.\n\nAs for @phase, the body of this macro has access to the variables self (the individual being created) and model (the simulation world), and can thus use all macros available in @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@cropheight-Tuple{}","page":"Nature","title":"Persefone.@cropheight","text":"@cropheight\n\nReturn the height of the crop at this position, or 0 if there is no crop here. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@cropname-Tuple{}","page":"Nature","title":"Persefone.@cropname","text":"@cropname\n\nReturn the name of the local croptype, or an empty string if there is no crop here. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@directionto-Tuple{Any}","page":"Nature","title":"Persefone.@directionto","text":"@directionto\n\nCalculate the direction to an animal or the closest habitat of the specified type or descriptor. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@distanceto-Tuple{Any}","page":"Nature","title":"Persefone.@distanceto","text":"@distanceto\n\nCalculate the distance to an animal or the closest habitat of the specified type or descriptor. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@distancetoedge-Tuple{}","page":"Nature","title":"Persefone.@distancetoedge","text":"@distancetoedge\n\nCalculate the distance to the closest neighbouring habitat. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@follow-Tuple{Any, Any}","page":"Nature","title":"Persefone.@follow","text":"@follow(leader, distance)\n\nMove to a location within the given distance of the leading animal. This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@habitat-Tuple{Any}","page":"Nature","title":"Persefone.@habitat","text":"@habitat\n\nSpecify habitat suitability for spatial ecological processes.\n\nThis macro works by creating an anonymous function that takes in a model object and a position, and returns true or false depending on the conditions specified in the macro body.\n\nSeveral utility macros can be used within the body of @habitat as a short-hand for common expressions: @landcover, @cropname, @cropheight, @distanceto, @distancetoedge, @countanimals. The variables model and pos can be used for checks that don't have a macro available.\n\nTwo example uses of @habitat might look like this:\n\nmovementhabitat = @habitat(@landcover() in (grass agriculture soil))\n\nnestinghabitat = @habitat((@landcover() == grass || \n (@landcover() == agriculture && @cropname() != \"maize\" &&\n @cropheight() < 10)) &&\n @distanceto(forest) > 20)\n\nFor more complex habitat suitability checks, the use of this macro can be circumvented by directly creating an equivalent function.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@here-Tuple{}","page":"Nature","title":"Persefone.@here","text":"@here()\n\nReturn the landscape pixel of this animal's current location. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@isalive-Tuple{Any}","page":"Nature","title":"Persefone.@isalive","text":"@isalive(id)\n\nTest whether the animal with the given ID is still alive. This can only be used in a context where the model object is available (e.g. nested within @phase).\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@kill-Tuple","page":"Nature","title":"Persefone.@kill","text":"@kill\n\nKill this animal (and immediately abort its current update if it dies). This is a thin wrapper around kill!, and passes on any arguments. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@killother-Tuple{Any, Vararg{Any}}","page":"Nature","title":"Persefone.@killother","text":"@killother\n\nKill another animal. This is a thin wrapper around kill!, and passes on any arguments. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@landcover-Tuple{}","page":"Nature","title":"Persefone.@landcover","text":"@landcover\n\nReturns the local landcover. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@migrate-Tuple{Any}","page":"Nature","title":"Persefone.@migrate","text":"@migrate(arrival)\n\nRemove this animal from the map and add it to the migrant species pool. It will be returned to its current location at the specified arrival date. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@move-Tuple{Any}","page":"Nature","title":"Persefone.@move","text":"@move(position)\n\nMove the current individual to a new position. This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@nearby_animals-Tuple","page":"Nature","title":"Persefone.@nearby_animals","text":"@nearby_animals(radius=0, species=\"\")\n\nReturn an iterator over all animals in the given radius around the current position. This can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@neighbours-Tuple","page":"Nature","title":"Persefone.@neighbours","text":"@neighbours(radius=0, conspecifics=true)\n\nReturn an iterator over all (by default conspecific) animals in the given radius around this animal, excluding itself. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@phase-Tuple{Any, Any, Any}","page":"Nature","title":"Persefone.@phase","text":"@phase(name, body)\n\nUse this macro to describe a species' behaviour during a given phase of its life. The idea behind this is that species show very different behaviour at different times of their lives. Therefore, @phase can be used define the behaviour for one such phase, and the conditions under which the animal transitions to another phase.\n\n@phase works by creating a function that will be called by the model if the animal is in the relevant phase. When it is called, it has access to the following variables:\n\nself a reference to the animal itself. This provides access to all the variables defined in the @species definition, as well as all standard Animal variables (e.g. self.age, self.sex, self.offspring).\npos gives the animal's current position as a coordinate tuple.\nmodel a reference to the model world (an object of type SimulationModel). This allows access, amongst others, to model.date (the current simulation date) and model.landscape (a two-dimensional array of pixels containing geographic information).\n\nMany macros are available to make the code within the body of @phase more succinct. Some of the most important of these are: @setphase, @respond, @kill, @reproduce, @neighbours, @migrate, @move, @rand.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@populate-Tuple{Any, Any}","page":"Nature","title":"Persefone.@populate","text":"@populate(species, params)\n\nSet the parameters that are used to initialise this species' population. For parameter options, see PopInitParams.\n\n@populate <species> begin\n <parameter> = <value>\n ...\nend \n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@randomdirection-Tuple","page":"Nature","title":"Persefone.@randomdirection","text":"@randomdirection(range=1)\n\nReturn a random direction tuple that can be passed to @walk. This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@randompixel-Tuple","page":"Nature","title":"Persefone.@randompixel","text":"@randompixel(range, habitatdescriptor)\n\nFind a random pixel within a given range of the animal's location that matches the habitatdescriptor (create this using @habitat). This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@reproduce-Tuple","page":"Nature","title":"Persefone.@reproduce","text":"@reproduce\n\nLet this animal reproduce. This is a thin wrapper around reproduce!, and passes on any arguments. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@respond-Tuple{Any, Any}","page":"Nature","title":"Persefone.@respond","text":"@respond(eventname, body)\n\nDefine how an animal responds to a landscape event that affects its current position. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@setphase-Tuple{Any}","page":"Nature","title":"Persefone.@setphase","text":"@setphase(newphase)\n\nSwitch this animal over to a different phase. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@species-Tuple{Any, Any}","page":"Nature","title":"Persefone.@species","text":"@species(name, body)\n\nA macro used to add new species types to the nature model. Use this to define species-specific variables and parameters.\n\nThe macro works by creating a keyword-defined mutable struct that contains the standard fields described for the Animal type, as well as any new fields that the user adds:\n\n@species <name> begin\n <var1> = <value>\n <var2> = <value>\n ...\nend\n\nTo complete the species definition, the @phase, @create, and @populate macros also need to be used.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@walk-Tuple","page":"Nature","title":"Persefone.@walk","text":"@walk(direction, speed)\n\nWalk the animal in a given direction, which is specified by a tuple of coordinates relative to the animal's current position (i.e. (2, -3) increments the X coordinate by 2 and decrements the Y coordinate by 3.) This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#populations.jl","page":"Nature","title":"populations.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature","title":"Nature","text":"This file contains a set of utility functions for species, including initialisation, reproduction, and mortality.","category":"page"},{"location":"nature.html","page":"Nature","title":"Nature","text":"Modules = [Persefone]\nPages = [\"nature/populations.jl\"]","category":"page"},{"location":"nature.html#Persefone.PopInitParams","page":"Nature","title":"Persefone.PopInitParams","text":"PopInitParams\n\nA set of parameters used by initpopulation to initialise the population of a species at the start of a simulation. Define these parameters for each species using @populate.\n\ninitphase determines which life phase individuals will be assigned to at model initialisation (required).\nbirthphase determines which life phase individuals will be assigned to at birth (required).\nhabitat is a function that determines whether a given location is suitable or not (create this using @habitat). By default, every cell will be occupied.\npopsize determines the number of individuals that will be created, dispersed over the suitable locations in the landscape. If this is zero or negative, one individual will be created in every suitable location. If it is greater than the number of suitable locations, multiple individuals will be created per location. Alternately, use indarea.\nindarea: if this is greater than zero, it determines the habitat area allocated to each individual or pair. To be precise, the chance of creating an individual (or pair of individuals) at a suitable location is 1/indarea. Use this as an alternative to popsize.\nIf pairs is true, a male and a female individual will be created in each selected location, otherwise, only one individual will be created at a time. (default: false)\nIf asexual is true, all created individuals are assigned the sex hermaphrodite, otherwise, they are randomly assigned male or female. If pairs is true, asexual is ignored. (default: false)\n\n\n\n\n\n","category":"type"},{"location":"nature.html#Persefone.countanimals-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Nature","title":"Persefone.countanimals","text":"countanimals(pos, model; radius=0, species=\"\")\n\nReturn the number of animals in the given radius around this position, optionally filtering by species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}","page":"Nature","title":"Persefone.directionto","text":"directionto(pos, model, animal)\n\nCalculate the direction from the given position to the animal.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}","page":"Nature","title":"Persefone.distanceto","text":"distanceto(pos, model, animal)\n\nCalculate the distance from the given position to the animal.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.followanimal!","page":"Nature","title":"Persefone.followanimal!","text":"followanimal!(follower, leader, model, distance=0)\n\nMove the follower animal to a location near the leading animal.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.initindividuals!-Tuple{Type, Tuple{Int64, Int64}, Persefone.PopInitParams, SimulationModel}","page":"Nature","title":"Persefone.initindividuals!","text":"initindividuals!(species, pos, popinitparams, model)\n\nInitialise one or two individuals (depending on the pairs parameter) in the given location. Returns the number of created individuals. (Internal helper function for initpopulation!().)\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.initpopulation!-Tuple{String, SimulationModel}","page":"Nature","title":"Persefone.initpopulation!","text":"initpopulation!(speciesname, model)\n\nInitialise the population of the given species, based on the parameters stored in PopInitParams. Define these using @populate.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.initpopulation!-Tuple{Type, Persefone.PopInitParams, SimulationModel}","page":"Nature","title":"Persefone.initpopulation!","text":"initpopulation!(speciestype, popinitparams, model)\n\nInitialise the population of the given species, based on the given initialisation parameters. This is an internal function called by initpopulation!(), and was split off from it to allow better testing.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.isalive-Tuple{Int64, SimulationModel}","page":"Nature","title":"Persefone.isalive","text":"isalive(id, model)\n\nTest whether the animal with the given ID is still alive.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.kill!","page":"Nature","title":"Persefone.kill!","text":"kill!(animal, model, probability=1.0, cause=\"\")\n\nKill this animal, optionally with a given percentage probability. Returns true if the animal dies, false if not.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.migrate!-Tuple{Animal, SimulationModel, Dates.Date}","page":"Nature","title":"Persefone.migrate!","text":"migrate!(animal, model, arrival)\n\nRemove this animal from the map and add it to the migrant species pool. It will be returned to its current location at the specified arrival date.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.move!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}","page":"Nature","title":"Persefone.move!","text":"move!(animal, model, position)\n\nMove the animal to the given position, making sure that this is in-bounds. If the position is out of bounds, the animal stops at the map edge.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.nearby_animals-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Nature","title":"Persefone.nearby_animals","text":"nearby_animals(pos, model; radius= 0, species=\"\")\n\nReturn a list of animals in the given radius around this position, optionally filtering by species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.nearby_ids-Tuple{Tuple{Int64, Int64}, SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}","page":"Nature","title":"Persefone.nearby_ids","text":"nearby_ids(pos, model, radius)\n\nReturn a list of IDs of the animals within a given radius of the position.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.neighbours","page":"Nature","title":"Persefone.neighbours","text":"neighbours(animal, model, radius=0, conspecifics=true)\n\nReturn a list of animals in the given radius around this animal, excluding itself. By default, only return conspecific animals.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.populationparameters-Tuple{Type}","page":"Nature","title":"Persefone.populationparameters","text":"populationparameters(type)\n\nA function that returns a PopInitParams object for the given species type. Parametric methods for each species are defined with @populate. This is the catch-all method, which throws an error if no species-specific function is defined.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.reproduce!","page":"Nature","title":"Persefone.reproduce!","text":"reproduce!(animal, model, mate, n=1)\n\nProduce one or more offspring for the given animal at its current location. The mate argument gives the ID of the reproductive partner.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.walk!","page":"Nature","title":"Persefone.walk!","text":"walk!(animal, model, direction, distance=-1)\n\nLet the animal move in the given direction, where the direction is defined by an (x, y) tuple to specify the shift in coordinates. If maxdist >= 0, move no further than the specified distance.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.walk!-2","page":"Nature","title":"Persefone.walk!","text":"walk!(animal, model, direction, distance=1pixel)\n\nLet the animal move a given number of steps in the given direction (\"north\", \"northeast\", \"east\", \"southeast\", \"south\", \"southwest\", \"west\", \"northwest\", \"random\").\n\n\n\n\n\n","category":"function"},{"location":"nature.html#insects.jl","page":"Nature","title":"insects.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature","title":"Nature","text":"This file contains the insect submodel, which calculates the likely insect biomass in a given location at a given time.","category":"page"},{"location":"nature.html","page":"Nature","title":"Nature","text":"Modules = [Persefone]\nPages = [\"nature/insects.jl\"]","category":"page"},{"location":"nature.html#Persefone.insectbiomass-Tuple{Pixel, SimulationModel}","page":"Nature","title":"Persefone.insectbiomass","text":"insectbiomass(pixel, model)\n\nCalculate the insect biomass in this location, using the factors configured in the nature.insectmodel settings (any combination of: \"season\", \"habitat\", \"weather\", \"pesticides\"). Returns a float value in g/m².\n\nBiological note: this is a very approximate calculation! Insect biomass varies wildly in time and space and is hard to measure. This calculation is based on the idea of a parabolic seasonal development of insect abundance, modified by habitat suitability, weather, and pesticide application. Although it is based on empirical studies, it can only deliver a rough, order-of-magnitude estimation of likely insect biomass in a given location.\n\nSources:\n\nOdderskær et al. (1997). Skylark Reproduction in Pesticide Treated and Untreated Fields (32; Pesticides Research). Danish Environmental Protection Agency.\nGrüebler et al. (2008). A predictive model of the density of airborne insects in agricultural environments. Agriculture, Ecosystems & Environment, 123(1), 75–80. https://doi.org/10.1016/j.agee.2007.05.001\nPaquette et al. (2013). Seasonal patterns in Tree Swallow prey (Diptera) abundance are affected by agricultural intensification. Ecological Applications, 23(1), 122–133. https://doi.org/10.1890/12-0068.1\nPüttmanns et al. (2022). Habitat use and foraging parameters of breeding Skylarks indicate no seasonal decrease in food availability in heterogeneous farmland. Ecology and Evolution, 12(1), e8461. https://doi.org/10.1002/ece3.8461\n\n\n\n\n\n","category":"method"},{"location":"nature.html#ecologicaldata.jl","page":"Nature","title":"ecologicaldata.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature","title":"Nature","text":"This file contains a set of life-history related utility functions needed by species.","category":"page"},{"location":"nature.html","page":"Nature","title":"Nature","text":"Modules = [Persefone]\nPages = [\"nature/ecologicaldata.jl\"]","category":"page"},{"location":"nature.html#Persefone.initecologicaldata-Tuple{SimulationModel}","page":"Nature","title":"Persefone.initecologicaldata","text":"initecologicaldata()\n\nCreate output files for each data group collected by the nature model.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.saveindividualdata-Tuple{SimulationModel}","page":"Nature","title":"Persefone.saveindividualdata","text":"saveindividualdata(model)\n\nReturn a data table (to be printed to individuals.csv), listing all properties of all animal individuals in the model. May be called never, daily, monthly, yearly, or at the end of a simulation, depending on the parameter nature.indoutfreq. WARNING: Produces very big files!\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.savepopulationdata-Tuple{SimulationModel}","page":"Nature","title":"Persefone.savepopulationdata","text":"savepopulationdata(model)\n\nReturn a data table (to be printed to populations.csv), giving the current date and population size for each animal species. May be called never, daily, monthly, yearly, or at the end of a simulation, depending on the parameter nature.popoutfreq.\n\n\n\n\n\n","category":"method"},{"location":"gui.html#Graphical-User-Interface","page":"Graphical User Interface","title":"Graphical User Interface","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Due to the computational demands of simulating many individuals at high temporal and spatial resolution, Persefone.jl is primarily designed to be run non-interactively on an HPC. However, to allow interactive exploratory simulations to be conducted while learning or developing the model, a graphical user interface is available as an additional package: Persefone Desktop.","category":"page"},{"location":"gui.html#Install-and-run","page":"Graphical User Interface","title":"Install and run","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"For more detailed installation instructions, see here.","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"To install: Install Julia and download/clone the repository. Open a Julia REPL in the downloaded folder and execute the following to install all dependencies:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"using Pkg\nPkg.activate(\".\")\nPkg.instantiate()","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"To run: Run desktop.jl. Alternatively, open a Julia REPL in this folder and run:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"using Pkg\nPkg.activate(\".\")\nusing PersefoneDesktop\nlaunch()","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Note: Due to the necessary pre-compilation done by Julia, installing and launching the application can take quite a long time. (Start-up time with desktop.jl is currently about 2 minutes.) We will reduce this as much as possible in future releases.","category":"page"},{"location":"gui.html#User-interface","page":"Graphical User Interface","title":"User interface","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"(Image: Persefone.jl Desktop screenshot)","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"The main window component is the map view. This displays a land cover map of the simulated region: dark green are forests, light green grassland, yellow fields, red built-up areas and blue water. On it, little circles show the position of individual animals, with different species denoted by different colours.","category":"page"},{"location":"gui.html#Control-bar","page":"Graphical User Interface","title":"Control bar","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Back button: Rewind the simulation by one day.\nStep button: Advance the simulation by one day.\nRun button: Run the simulation until the button is pressed again or the end date is reached.\nProgress bar: Shows the percentage of time elapsed between the start and end dates of the simulation.\nSpeed slider: Set the time delay between each simulation step when running.\nDate: Shows the simulation date currently displayed on the map.","category":"page"},{"location":"gui.html#Menu-bar","page":"Graphical User Interface","title":"Menu bar","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Simulation:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"New simulation: Reset the model and start over.\nConfigure simulation: Change the model settings (not yet implemented).\nLoad saved state: Load a model object file saved by a previous simulation run.\nSave current state: Save a model object file for later use.\nQuit: Close the application.","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Data:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Show population graph: Show a window with a graph of population sizes over time in the current model run.\nSave simulation output: Save the model output data to file (saves both raw CSV data and generated graphics).","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Help:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Documentation: Open the Persefone.jl online documentation in a browser.\nWebsite: Open the main Persefone.jl website in a browser.\nAbout: Show a window with core information about the application.","category":"page"},{"location":"io.html#Input-and-Output","page":"Input and Output","title":"Input and Output","text":"","category":"section"},{"location":"io.html","page":"Input and Output","title":"Input and Output","text":"These functions are responsible for reading in all model configurations (passed by config file or commandline), administrating them during a run, and printing or plotting any output.","category":"page"},{"location":"io.html#input.jl","page":"Input and Output","title":"input.jl","text":"","category":"section"},{"location":"io.html","page":"Input and Output","title":"Input and Output","text":"Modules = [Persefone]\nPages = [\"core/input.jl\"]","category":"page"},{"location":"io.html#Persefone.PARAMFILE","page":"Input and Output","title":"Persefone.PARAMFILE","text":"The file that stores all default parameters: src/parameters.toml\n\n\n\n\n\n","category":"constant"},{"location":"io.html#Persefone.flattenTOML-Tuple{Any}","page":"Input and Output","title":"Persefone.flattenTOML","text":"flattenTOML(dict)\n\nAn internal utility function to convert the two-dimensional dict returned by TOML.parsefile() into a one-dimensional dict, so that instead of writing settings[\"domain\"][\"param\"] one can use settings[\"domain.param\"]. Can be reversed with prepareTOML.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.getsettings","page":"Input and Output","title":"Persefone.getsettings","text":"getsettings(configfile, seed=nothing)\n\nCombines all configuration options to produce a single settings dict. Precedence: commandline parameters - user config file - default values\n\n\n\n\n\n","category":"function"},{"location":"io.html#Persefone.loadmodelobject-Tuple{String}","page":"Input and Output","title":"Persefone.loadmodelobject","text":"loadmodelobject(fullfilename)\n\nDeserialise a model object that was previously saved with [savemodelobject](@ref).\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.parsecommandline-Tuple{}","page":"Input and Output","title":"Persefone.parsecommandline","text":"parsecommandline()\n\nCertain software parameters can be set via the commandline.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.preprocessparameters-Tuple{Dict{String, Any}, String}","page":"Input and Output","title":"Persefone.preprocessparameters","text":"preprocessparameters(settings)\n\nTake the raw input parameters and process them where necessary (e.g. convert types or perform checks). This is a helper function for getsettings.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.@chance-Tuple{Any}","page":"Input and Output","title":"Persefone.@chance","text":"@chance(odds)\n\nReturn true if a random number is less than the odds (0.0 <= odds <= 1.0), using the model RNG. This is a utility wrapper that can only be used a context where the model object is available.\n\n\n\n\n\n","category":"macro"},{"location":"io.html#Persefone.@param-Tuple{Any}","page":"Input and Output","title":"Persefone.@param","text":"@param(domainparam)\n\nReturn a configuration parameter from the global settings. The argument should be in the form <domain>.<parameter>, for example @param(core.outdir). Possible values for <domain> are core, nature, farm, or crop. For a full list of parameters, see src/parameters.toml.\n\nNote: this macro only works in a context where the model object is available!\n\n\n\n\n\n","category":"macro"},{"location":"io.html#Persefone.@rand-Tuple","page":"Input and Output","title":"Persefone.@rand","text":"@rand(args...)\n\nReturn a random number or element from the sample, using the model RNG. This is a utility wrapper that can only be used a context where the model object is available.\n\n\n\n\n\n","category":"macro"},{"location":"io.html#Persefone.@shuffle!-Tuple{Any}","page":"Input and Output","title":"Persefone.@shuffle!","text":"@shuffle!(collection)\n\nShuffle the given collection in place, using the model RNG. This is a utility wrapper that can only be used a context where the model object is available.\n\n\n\n\n\n","category":"macro"},{"location":"io.html#output.jl","page":"Input and Output","title":"output.jl","text":"","category":"section"},{"location":"io.html","page":"Input and Output","title":"Input and Output","text":"Modules = [Persefone]\nPages = [\"core/output.jl\"]","category":"page"},{"location":"io.html#Persefone.LOGFILE","page":"Input and Output","title":"Persefone.LOGFILE","text":"Log output is saved to simulation.log in the output directory\n\n\n\n\n\n","category":"constant"},{"location":"io.html#Persefone.RECORDDIR","page":"Input and Output","title":"Persefone.RECORDDIR","text":"All input data are copied to the inputs folder within the output directory\n\n\n\n\n\n","category":"constant"},{"location":"io.html#Persefone.DataOutput","page":"Input and Output","title":"Persefone.DataOutput","text":"DataOutput\n\nA struct for organising model output. This is used to collect model data in an in-memory dataframe or for CSV output. Submodels can register their own output functions using newdataoutput!.\n\nStruct fields: - name: a string identifier for the data collection (used as file name) - header: a list of column names - outputfunction: a function that takes a model object and returns data values to record (formatted as a vector of vectors) - frequency: how often to call the output function (daily/monthly/yearly/end/never) - plotfunction: a function that takes a model object and returns a Makie figure object (optional)\n\n\n\n\n\n","category":"type"},{"location":"io.html#Persefone.createdatadir-Tuple{String, Union{Bool, String}}","page":"Input and Output","title":"Persefone.createdatadir","text":"createdatadir(outdir, overwrite)\n\nCreates the output directory, dealing with possible conflicts.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.modellogger","page":"Input and Output","title":"Persefone.modellogger","text":"modellogger(loglevel, outdir, output=\"both\")\n\nCreate a logger object that writes output to screen and/or a logfile. This object is stored as model.logger and can then be used with with_logger(). Note: requires createdatadir to be run first.\n\n\n\n\n\n","category":"function"},{"location":"io.html#Persefone.newdataoutput!","page":"Input and Output","title":"Persefone.newdataoutput!","text":"newdataoutput!(model, name, header, outputfunction, frequency)\n\nCreate and register a new data output. This function must be called by all submodels that want to have their output functions called regularly.\n\n\n\n\n\n","category":"function"},{"location":"io.html#Persefone.outputdata","page":"Input and Output","title":"Persefone.outputdata","text":"outputdata(model, force=false)\n\nCycle through all registered data outputs and activate them according to their configured frequency. If force is true, activate all outputs regardless of their configuration.\n\n\n\n\n\n","category":"function"},{"location":"io.html#Persefone.prepareTOML-Tuple{Any}","page":"Input and Output","title":"Persefone.prepareTOML","text":"prepareTOML(dict)\n\nAn internal utility function to re-convert the one-dimensional dict created by flattenTOML into the two-dimensional dict needed by TOML.print, and convert any data types into TOML-compatible types where necessary.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.saveinputfiles-Tuple{SimulationModel}","page":"Input and Output","title":"Persefone.saveinputfiles","text":"saveinputfiles(model)\n\nCopy all input files into the output directory, including the actual parameter settings used. This allows replicating a run in future.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.savemodelobject-Tuple{SimulationModel, String}","page":"Input and Output","title":"Persefone.savemodelobject","text":"savemodelobject(model, filename)\n\nSerialise a model object and save it to file for later reference. Includes the current model and Julia versions for compatibility checking.\n\nWARNING: produces large files (>100 MB) and takes a while to execute.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.visualiseoutput-Tuple{SimulationModel}","page":"Input and Output","title":"Persefone.visualiseoutput","text":"visualiseoutput(model)\n\nCycle through all data outputs and call their respective plot functions, saving each figure to file.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.withtestlogger-Tuple{SimulationModel}","page":"Input and Output","title":"Persefone.withtestlogger","text":"withtestlogger(model)\n\nReplace the model logger with the currently active logger. This is intended to be used in the testsuite to circumvent a Julia issue, where @test_logs doesn't work with local loggers.\n\n\n\n\n\n","category":"method"},{"location":"io.html#makieplots.jl","page":"Input and Output","title":"makieplots.jl","text":"","category":"section"},{"location":"io.html","page":"Input and Output","title":"Input and Output","text":"Modules = [Persefone]\nPages = [\"analysis/makieplots.jl\"]","category":"page"},{"location":"io.html#Persefone.gettickmarks-Tuple{Any}","page":"Input and Output","title":"Persefone.gettickmarks","text":"gettickmarks(dates)\n\nGiven a vector of dates, construct a selection to use as tick mark locations. Helper function for [populationtrends](@ref)\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.populationtrends-Tuple{SimulationModel}","page":"Input and Output","title":"Persefone.populationtrends","text":"populationtrends(model)\n\nPlot a line graph of population sizes of each species over time. Returns a Makie figure object.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.visualisemap","page":"Input and Output","title":"Persefone.visualisemap","text":"visualisemap(model, date, landcover)\n\nDraw the model's land cover map and plot all individuals as points on it at the specified date. If no date is passed, use the last date for which data are available. Optionally, you can pass a landcover map image (this is needed to reduce the frequency of disk I/O for Persefone Desktop). Returns a Makie figure object.\n\n\n\n\n\n","category":"function"},{"location":"config.html#Configuration","page":"Configuration","title":"Configuration","text":"","category":"section"},{"location":"config.html","page":"Configuration","title":"Configuration","text":"Persefone requires three input files: a configuration file and two map files. How to generate the map files is documented elsewhere. The configuration file defines parameter values and looks like this (see src/parameters.toml for the default):","category":"page"},{"location":"config.html","page":"Configuration","title":"Configuration","text":"### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe.\n###\n### This is the default configuration file for Persefone, containing all model parameters.\n### The syntax is described here: https://toml.io/en/\n\n[core]\nconfigfile = \"src/parameters.toml\" # location of the configuration file\noutdir = \"results\" # location and name of the output folder\noverwrite = \"ask\" # overwrite the output directory? (true/false/\"ask\")\nlogoutput = \"both\" # log output to screen/file/both\ncsvoutput = true # save collected data in CSV files\nvisualise = true # generate result graphs\nstoredata = true # keep collected data in memory\nloglevel = \"debug\" # verbosity level: \"debug\", \"info\", \"warn\"\nprocessors = 2 # number of processors to use on parallel runs\nseed = 2 # seed value for the RNG (0 -> random value)\nstartdate = 2022-01-01 # first day of the simulation\nenddate = 2022-12-31 # last day of the simulation\n\n[world]\nlandcovermap = \"data/regions/jena/landcover.tif\" # location of the landcover map\nfarmfieldsmap = \"data/regions/jena/fields.tif\" # location of the field geometry map\nweatherfile = \"data/regions/jena/weather.csv\" # location of the weather data file\n\t\n[farm]\nfarmmodel = \"FieldManager\" # which version of the farm model to use (not yet implemented)\n\n[nature]\ntargetspecies = [\"Wolpertinger\", \"Wyvern\"] # list of target species to simulate\npopoutfreq = \"daily\" # output frequency population-level data, daily/monthly/yearly/end/never\nindoutfreq = \"end\" # output frequency individual-level data, daily/monthly/yearly/end/never\ninsectmodel = [\"season\", \"habitat\", \"pesticides\", \"weather\"] # factors affecting insect growth\n\t\n[crop]\ncropmodel = \"almass\" # crop growth model to use, \"almass\" or \"aquacrop\"\ncropfile = \"data/crops/almass/crop_data_general.csv\" # file with general crop parameters\ngrowthfile = \"data/crops/almass/almass_crop_growth_curves.csv\" # file with crop growth parameters\t","category":"page"},{"location":"config.html","page":"Configuration","title":"Configuration","text":"info: Parameter scanning\nYou can set any parameter to a list of different values, e.g. seed = [1,2,3]. Persefone will then set up and run multiple simulations, one for every possible combination of parameters that you entered (i.e. do a full-factorial simulation experiment).","category":"page"},{"location":"using.html#The-Persefone.jl-Package","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"","category":"section"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"This page describes how to run Persefone.jl as a command line application or Julia package, which is the default mode. To use the model with a graphical user interface, see here.","category":"page"},{"location":"using.html#Installation","page":"The Persefone.jl Package","title":"Installation","text":"","category":"section"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"For more detailed installation instructions, see here.","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"Install the latest version of the Julia programming language (1.10+). The recommended editors are VSCode or Emacs. To install the package dependencies, open a Julia REPL in this folder and run:","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"using Pkg\nPkg.activate(\".\")\nPkg.instantiate()","category":"page"},{"location":"using.html#Running-from-the-command-line","page":"The Persefone.jl Package","title":"Running from the command line","text":"","category":"section"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"This is the normal mode of operation. Simply execute run.jl in a terminal, typically like so (in Linux):","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"> julia run.jl -c <config>","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"where <config> specifies the configuration file to use. The recommended workflow is to copy scr/parameters.toml to a location of your choice and edit the copy to suit your requirements. The adapted config file can then be passed to run.jl. (If no configuration file is specified, Persefone will run with its default settings.)","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"The full list of commandline arguments is:","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"usage: run.jl [-c CONFIGFILE] [-s SEED] [-o OUTDIR] [-l LOGLEVEL] \n [--version] [-h]\n\noptional arguments:\n -c, --configfile CONFIGFILE\n name of the configuration file\n -s, --seed SEED inital random seed (type: Int64)\n -o, --outdir OUTDIR location of the output directory\n -l, --loglevel LOGLEVEL\n verbosity: \"debug\", \"info\", or \"quiet\"\n --version show version information and exit\n -h, --help show this help message and exit","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"To run the test suite, switch to the test directory and execute runtests.jl.","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"If you are on Linux or MacOS, you can also use make:","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"> make run # run a simulation with default values\n> make test # run the test suite\n> make profile # run and profile a default simulation\n> make docs # build the documentation\n> make release # create a release","category":"page"},{"location":"using.html#Running-from-within-Julia","page":"The Persefone.jl Package","title":"Running from within Julia","text":"","category":"section"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"To use the model from within Julia (either inside an interactive REPL or if you want to import it from your own software), do the following:","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"using Pkg\nPkg.activate(\".\") # assuming you're in the Persefone root folder\nusing Persefone","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"You can then access all Persefone functions, such as simulate, initialise, stepsimulation!, simulate!, or visualiseoutput. (See src/Persefone.jl for a list of exported functions.)","category":"page"},{"location":"architecture.html#Source-code-architecture","page":"Source code architecture","title":"Source code architecture","text":"","category":"section"},{"location":"architecture.html#Model-components","page":"Source code architecture","title":"Model components","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"(Image: \"model architecture\")","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"Persefone is divided into four components, three of which are semi-independent submodels:","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"core and world: These two directories provide the foundation of the model software, which sets up and executes simulation runs. It also reads all input files (the configuration file, landscape maps, and weather data), and provides data output functionality.\nnature: This is an individual-based model of species in agricultural landscapes. It defines the Animal agent type, and a set of macros that can be used to rapidly create new species. It also includes ecological process functions that are useful for all species.\nfarm: This is an agent-based model of farmer decision making. It is not yet implemented, but will provide the Farmer agent type.\ncrop: This is a mathematical growth model for various crops. It is not yet implemented, but already provides the agent type FarmPlot, representing one field and its associated extent and crop type.","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"Conceptually, core provides functionality that is needed by all of the submodels. Decisions made by Farmers affect the FarmPlots they own, and (directly or indirectly) the Animals in the model landscape.","category":"page"},{"location":"architecture.html#Important-implementation-details","page":"Source code architecture","title":"Important implementation details","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"(Image: \"the model object\")","category":"page"},{"location":"architecture.html#The-model-object","page":"Source code architecture","title":"The model object","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"A cursory reading of the source code will quickly show that most functions take an SimulationModel object as one of their arguments. The concrete type for this is AgricultureModel, a struct that holds all state that is in any way relevant to a simulation run. (Persefone has a strict \"no global state\" policy to avoid state-dependent bugs and allow parallelisation.) The model object gives access to all agent instances. It also stores the configuration (model.settings), the landscape (model.landscape, a matrix of Pixel objects that store the local land cover, amongst other things), and the current simulation date (model.date). (See Persefone.initmodel for details.)","category":"page"},{"location":"architecture.html#Model-configuration/the-@param-macro","page":"Source code architecture","title":"Model configuration/the @param macro","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"The model is configured via a TOML file, the default version of which is at src/parameters.toml. An individual run can be configured using a user-defined configuration file, commandline arguments, or function calls (when Persefone is used as a package rather than an application). During a model run, the @param macro can be used to access parameter values. Note that parameter names are prepended with the name of the component they are associated with. For example, the outdir parameter belongs to the [core] section of the TOML file, and must therefore be referenced as @param(core.outdir). (See src/core/input.jl for details.)","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"info: @param and other macros\nAs @param(parameter) expands to model.settings[\"parameter\"], it can obviously only be used in a context where the model object is actually available. (This is the case for most functions in Persefone, but not for all.) Similarly, many of the nature macros depend on specific variables being available where they are called, and can therefore only be used in specific contexts (this is indicated in their documentation).","category":"page"},{"location":"architecture.html#Output-data","page":"Source code architecture","title":"Output data","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"Persefone can output model data into text files with a specified frequency (daily, monthly, yearly, or at the simulation end). Submodels can use Persefone.newdataoutput! to plug into this system. For an example of how to use this, see src/nature/ecologicaldata.jl. (See src/core/output.jl for details.)","category":"page"},{"location":"architecture.html#Farm-events","page":"Source code architecture","title":"Farm events","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"The FarmEvent struct is used to communicate farming-related events between submodels. An event can be triggered with createevent! and affects all pixels within a FarmPlot. (See src/core/landscape.jl for details.)","category":"page"},{"location":"architecture.html#Random-numbers-and-logging","page":"Source code architecture","title":"Random numbers and logging","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"By default in Julia, the random number generator (RNG) and the system logger are two globally accessible variables. As Persefone needs to avoid all global data (since this would interfere with reproducibility in parallel runs), the model object stores a local logger and a local RNG. The local logger generally does not change the way the model uses log statements, it is only relevant for some functions in src/core/simulation.jl.","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"info: Using the model RNG\nWhenever you need to use a random number, you must use the model.rng. The easiest way to do this is with the @rand and @shuffle! macros. (Note that these, too, require access to the model object.)","category":"page"},{"location":"species.html#Species","page":"Species","title":"Species","text":"","category":"section"},{"location":"species.html","page":"Species","title":"Species","text":"The ecological submodel in Persefone simulates a range of species in agricultural landscapes.","category":"page"},{"location":"species.html#Skylark","page":"Species","title":"Skylark","text":"","category":"section"},{"location":"species.html","page":"Species","title":"Species","text":"Modules = [Persefone]\nPages = [\"nature/species/skylark.jl\"]","category":"page"},{"location":"species.html#Persefone.Skylark","page":"Species","title":"Persefone.Skylark","text":"Skylark\n\nAlauda arvensis is a common and charismatic species of agricultural landscapes. At the moment, this implementation is still in development.\n\nSources: - Bauer, H.-G., Bezzel, E., & Fiedler, W. (Eds.). (2012). Das Kompendium der Vögel Mitteleuropas: Ein umfassendes Handbuch zu Biologie, Gefährdung und Schutz (Einbändige Sonderausg. der 2., vollständig überarb. und erw. Aufl. 2005). AULA-Verlag - Glutz von Blotzheim, Urs N. (Ed.). (1985). Handbuch der Vögel Mitteleuropas. Bd. 10. Passeriformes (Teil 1) 1. Alaudidae - Hirundidae. AULA-Verlag, Wiesbaden. ISBN 3-89104-019-9\n\n\n\n\n\n","category":"type"},{"location":"species.html#Persefone.breeding-Tuple{Persefone.Skylark, SimulationModel}","page":"Species","title":"Persefone.breeding","text":"Do lots of foraging (not yet implemented).\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.create!-Tuple{Persefone.Skylark, SimulationModel}","page":"Species","title":"Persefone.create!","text":"Initialise a skylark individual. Selects migration dates and checks if the bird should currently be on migration. Also sets other individual-specific variables.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.egg-Tuple{Persefone.Skylark, SimulationModel}","page":"Species","title":"Persefone.egg","text":"As an egg, simply check for mortality and hatching.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.fledgling-Tuple{Persefone.Skylark, SimulationModel}","page":"Species","title":"Persefone.fledgling","text":"As a fledgling, move around a little, but mainly wait for maturity and check mortality.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.mating-Tuple{Persefone.Skylark, SimulationModel}","page":"Species","title":"Persefone.mating","text":"Move around until a mate is found.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.migrationdates-Tuple{Animal, SimulationModel}","page":"Species","title":"Persefone.migrationdates","text":"migrationdates(skylark, model)\n\nSelect the dates on which this skylark will leave for / return from its migration, based on observed migration patterns.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.nestbuilding-Tuple{Persefone.Skylark, SimulationModel}","page":"Species","title":"Persefone.nestbuilding","text":"Females select a location and build a nest. Males do nothing. (Sound familiar?)\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.nestling-Tuple{Persefone.Skylark, SimulationModel}","page":"Species","title":"Persefone.nestling","text":"As a nestling, simply check for mortality and fledging.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.nonbreeding-Tuple{Persefone.Skylark, SimulationModel}","page":"Species","title":"Persefone.nonbreeding","text":"As a non-breeding adult, move around with other individuals and check for migration.\n\n\n\n\n\n","category":"method"},{"location":"species-dsl.html#Defining-new-species","page":"Defining new species","title":"Defining new species","text":"","category":"section"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"In order to make implementing new species as easy as possible, Persefone includes a domain-specific language (DSL) built from a collection of macros and functions.","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"Here is an example of what this looks like, using a hypothetical mermaid species:","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"@species Mermaid begin\n ageofmaturity = 2\n pesticidemortality = 1.0\nend\n\n@create Mermaid begin\n @debug \"Created $(animalid(self)).\"\nend\n\n@phase Mermaid life begin\n @debug \"$(animalid(self)) is swimming happily in its pond.\"\n @respond pesticide @kill(self.pesticidemortality, \"poisoning\")\n @respond harvesting @setphase(drought)\n if self.sex == female && length(@neighbours()) < 3 &&\n self.age >= self.ageofmaturity && @landcover() == water\n @reproduce()\n end\nend\n\n@phase Mermaid drought begin\n n = sum(1 for a in @neighbours())\n @debug \"$(animalid(self)) is experiencing drought with $n neighbour(s).\"\n @respond sowing @setphase(life)\nend\n\n@populate Mermaid begin\n birthphase = life\n initphase = life\n habitat = @habitat(@landcover() == water)\n pairs=true\nend","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"A complete species definition consists of one call each to @species, @create, @populate, and one or more calls to @phase. Another important macro is @habitat. Further macros are available to provide convenience wrappers for common functions. (See src/nature/nature.jl for details.)","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"The first macro to call is @species. This takes two arguments: a species name and a definition block (enclosed in begin and end tags). Within the block, species-specific parameters and variables can be defined (and optionally given values) that should be available throughout a species' lifetime. ","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"Next, each species must define one or more @phase blocks. The concept behind this is that species show different behaviours at different phases of their lifecycle. Each @phase block defines the behaviour in one of these phases. (Technically, it defines a function that will be called daily, so long as the species' phase variable is set to this phase.) Code in this section has access to the model object as well as a self object, which is the currently active Animal agent. Within a phase block, @respond can be used to define the species' response to a FarmEvent that affects the species' current location, while a variety of other macros provide wrappers to life history and movement functions from src/nature/populations.jl.","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"The third macro to call is @create. Like @phase, this defines a function with access to the world and self objects. This function is called whenever a new individual of this species is created (either at birth, or when the model is initialised).","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"The last macro that must be called is [@populate]. Whereas @create regulates the creation of individual animals, @populate determines how the population of a species is initialised at the start of a simulation. It does this by defining values for the parameters used by initpopulation!. The full list of parameters that can be used is documented under PopInitParams.","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"The final important macro is @habitat. This defines a \"habitat descriptor\", i.e. a predicate function that tests whether or not a given landscape pixel is suitable for a specified purpose. Such habitat descriptors are used as arguments to various functions, for example for population initialisation or movement. The argument to @habitat consists of a logical expression, which has access to the animal's current position (the pos tuple variable) and the model. Various macros are available to easily reference information about the current location, such as @landcover or @distancetoedge.","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"All of these macros are defined in src/nature/macros.jl.","category":"page"},{"location":"developing.html#Developing-Persefone","page":"Developing Persefone","title":"Developing Persefone","text":"","category":"section"},{"location":"developing.html#Setting-up","page":"Developing Persefone","title":"Setting up","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"If you haven't worked with Julia before, here are detailed instructions for how to set up your development environment. The main development is currently done on Linux (and as the primary execution platform will be an HPC, Linux compatibility is important), but developing on Windows works too.","category":"page"},{"location":"developing.html#Visual-Studio-Code-on-Windows","page":"Developing Persefone","title":"Visual Studio Code on Windows","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Download and install Julia, git and Visual Studio Code.\nInstall the Julia extension for VS Code: In VS Code, open the extensions pane (Ctrl+Shift+X). Search for and install Julia Language Support.\nClone the Gitlab repository: In VS Code, open the source control pane (Ctrl+Shift+G). Click on Clone and enter the repo URL. Then select a folder on your computer to download the files into, and let VS Code open the project once it has been cloned.\nStart a Julia REPL: In VS Code, bring up the command palette (Ctrl+Shift+P). Execute the command Julia: Start REPL. Then install all dependencies of Persefone by running using Pkg; Pkg.activate(\".\"); Pkg.instantiate(). (This will take some time.)\nOpen the file run.jl and click Execute (triangular button in the top right). The source code will compile (this can take a lot of time the first time you do it) and run a default simulation.\nFurther steps: You may want to familiarise yourself with how to use git with VS Code. You may also want to clone the Persefone Desktop repository (repeat steps 3 to 5).","category":"page"},{"location":"developing.html#Emacs-on-Linux","page":"Developing Persefone","title":"Emacs on Linux","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"You can of course also use VS Code on Linux. In that case, follow the instructions above.","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Make sure you have git and Julia installed. Git should be in your distro's repos (e.g. sudo apt install git). To install Julia, download the binary and unpack it. For greater ease of use, copy the unpacked files to /usr/local/lib/julia (or similar) and create a symlink to the executable: sudo ln -s /usr/local/lib/julia/bin/julia /usr/local/bin/julia. Then go the to folder that you want to use for development and run git clone https://git.idiv.de/persefone/persefone-model.git . in your terminal.","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"There are a couple of addons that make working with Julia much nicer in Emacs:","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"julia-mode gives syntax highlighting. Install with M-x package-install julia-mode.\njulia-snail provides IDE-like features, especially a fully-functional REPL and the ability to evaluate code straight from inside a buffer. Note that the installation can be somewhat tricky. You first need to manually install all the dependencies of its dependency vterm, then install vterm itself with M-x package-install vterm, before you can do M-x package-install julia-snail. Then add it to your init.el with (require 'julia-snail) and (add-hook 'julia-mode-hook #'julia-snail-mode).\ncompany-mode integrates with Snail to give code completion. Install with M-x package-install company, then add (add-hook 'julia-mode-hook #'company-mode) and (global-set-key (kbd \"C-<tab>\") 'company-complete) to your init.el.\nmagit is a great git interface for Emacs. Install with M-x package-install magit and add (global-set-key (kbd \"C-x g\") 'magit-status) to your init.el.","category":"page"},{"location":"developing.html#Development-workflow","page":"Developing Persefone","title":"Development workflow","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Pull the current version from the master branch on Gitlab: https://git.idiv.de/persefone/persefone-model.\nIf you are working on a new feature, create a new branch to avoid breaking the master branch. (The master branch on Github should always be in a runnable and error-free state.)\nImplement your changes.\nRun an example simulation and the test suite to make sure everything works without crashing (make run and make test on Linux, or execute run.jl and test/runtests.jl manually.)\nCommit your work frequently, and try to keep each commit small. Don't forget to add relevant tests to the test suite.\nOnce your satisfied with your work, do another pull/merge from the master branch in case somebody else changed the branch in the meantime. Then merge your work into master and push to the Gitlab server.\nRepeat :-)","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"The Gitlab issue tracker can be used to create, discuss, and assign tasks, as well as to monitor progress towards milestones/releases. Once we have a first release, we will start using semantic versioning and a changelog.","category":"page"},{"location":"developing.html#Important-libraries","page":"Developing Persefone","title":"Important libraries","text":"","category":"section"},{"location":"developing.html#Revise.jl","page":"Developing Persefone","title":"Revise.jl","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Revise.jl allows one to reload code without restarting the Julia interpreter. Get it with Pkg.add(\"Revise\"), then add using Revise to .julia/config/startup.jl to have it automatically available.","category":"page"},{"location":"developing.html#Test","page":"Developing Persefone","title":"Test","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Persefone uses the inbuilt Julia testing framework. All new functions should have appropriate tests written for them in the appropriate file in the test directory. (See test/runtests.jl for details.) There are three ways to run the test suite: in the terminal, executing make test or cd test; julia runtests.jl; or in the Julia REPL, Pkg.activate(\".\"); Pkg.test().","category":"page"},{"location":"developing.html#Documenter.jl","page":"Developing Persefone","title":"Documenter.jl","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"The HTML documentation is generated using Documenter.jl. Therefore, all new functions should have docstrings attached. New files need to be integrated into the relevant documentation source files in docs/src, and if necessary into docs/builddocs.jl. To build the documentation, run make docs, or cd docs; julia builddocs.jl (if using the latter, don't forget to update the date and commit in docs/src/index.md).","category":"page"},{"location":"developing.html#Graphics-and-user-interface","page":"Developing Persefone","title":"Graphics and user interface","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Persefone uses Makie as a plotting library to generate its output graphics. Additionally, Persefone Desktop uses QML.jl to create its graphical user interface.","category":"page"},{"location":"developing.html#Unitful.jl","page":"Developing Persefone","title":"Unitful.jl","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Throughout the source code, variables can be tagged with their appropriate units using the Unitful.jl library. This makes the code easier to understand, and also allows automatic unit conversion:","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"julia> 1ha == 10000m²\ntrue\n\njulia> 2km |> m\n2000 m\n\njulia> 2km / 10m\n200.0","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Within Persefone, the following units and dimensions have been imported for direct usage: cm, m, km, m², ha, km², mg, g, kg, Length, Area, Mass.","category":"page"},{"location":"simulation.html#Simulation","page":"Simulation","title":"Simulation","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"The core and world directories hold source files that are important for all submodels, including scheduling, landscape, weather, and input/output functions.","category":"page"},{"location":"simulation.html#Persefone.jl","page":"Simulation","title":"Persefone.jl","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"This file defines the module, including all exported symbols and two high-level types.","category":"page"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"Modules = [Persefone]\nPages = [\"Persefone.jl\"]","category":"page"},{"location":"simulation.html#Persefone.ModelAgent","page":"Simulation","title":"Persefone.ModelAgent","text":"ModelAgent\n\nThe supertype of all agents in the model (animal species, farmer types, farmplots).\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.SimulationModel","page":"Simulation","title":"Persefone.SimulationModel","text":"SimulationModel\n\nThe supertype of AgricultureModel. This is needed to avoid circular dependencies (most types and functions depend on SimulationModel, but the definition of the model struct depends on these types).\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#simulation.jl","page":"Simulation","title":"simulation.jl","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"This file includes the basal functions for initialising and running simulations.","category":"page"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"Modules = [Persefone]\nPages = [\"core/simulation.jl\"]","category":"page"},{"location":"simulation.html#Persefone.AgricultureModel","page":"Simulation","title":"Persefone.AgricultureModel","text":"AgricultureModel\n\nThis is the heart of the model - a struct that holds all data and state for one simulation run. It is created by initialise and passed as input to most model functions.\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.finalise!-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.finalise!","text":"finalise!(model)\n\nWrap up the simulation. Finalises and visualises output, then terminates.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.initialise","page":"Simulation","title":"Persefone.initialise","text":"initialise(config=PARAMFILE, seed=nothing)\n\nInitialise the model: read in parameters, create the output data directory, and instantiate the SimulationModel object(s). Optionally allows specifying the configuration file and overriding the seed parameter. This returns a single model object, unless the config file contains multiple values for one or more parameters, in which case it creates a full-factorial simulation experiment and returns a vector of model objects.\n\n\n\n\n\n","category":"function"},{"location":"simulation.html#Persefone.initmodel-Tuple{Dict{String, Any}}","page":"Simulation","title":"Persefone.initmodel","text":"initmodel(settings)\n\nInitialise a model object using a ready-made settings dict. This is a helper function for initialise().\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.nagents-Tuple{AgricultureModel}","page":"Simulation","title":"Persefone.nagents","text":"nagents(model)\n\nReturn the total number of agents in a model object.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.paramscan-Tuple{Dict{String, Any}, Vector{String}}","page":"Simulation","title":"Persefone.paramscan","text":"paramscan(settings)\n\nCreate a list of settings dicts, covering all possible parameter combinations given by the input settings (i.e. a full-factorial experiment). This is a helper function for initialise().\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.simulate","page":"Simulation","title":"Persefone.simulate","text":"simulate(config=PARAMFILE, seed=nothing)\n\nInitialise one or more model objects and carry out a full simulation experiment, optionally specifying a configuration file and a seed for the RNG.\n\nThis is the default way to run a Persefone simulation.\n\n\n\n\n\n","category":"function"},{"location":"simulation.html#Persefone.simulate!-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.simulate!","text":"simulate!(model)\n\nCarry out a complete simulation run using a pre-initialised model object.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.stepagent!-Tuple{ModelAgent, SimulationModel}","page":"Simulation","title":"Persefone.stepagent!","text":"stepagent!(agent, model)\n\nAll agent types must define a stepagent!() method that will be called daily.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.stepsimulation!-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.stepsimulation!","text":"stepsimulation!(model)\n\nExecute one update of the model.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#landscape.jl","page":"Simulation","title":"landscape.jl","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"This file manages the landscape maps that underlie the model.","category":"page"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"Modules = [Persefone]\nPages = [\"world/landscape.jl\"]","category":"page"},{"location":"simulation.html#Persefone.FarmEvent","page":"Simulation","title":"Persefone.FarmEvent","text":"FarmEvent\n\nA data structure to define a landscape event, giving its type, spatial extent, and duration.\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.LandCover","page":"Simulation","title":"Persefone.LandCover","text":"The land cover classes encoded in the Mundialis Sentinel data.\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.Management","page":"Simulation","title":"Persefone.Management","text":"The types of management event that can be simulated\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.Pixel","page":"Simulation","title":"Persefone.Pixel","text":"Pixel\n\nA pixel is a simple data structure to combine land use and ownership information in a single object. The model landscape consists of a matrix of pixels. (Note: further landscape information may be added here in future.)\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.createevent!","page":"Simulation","title":"Persefone.createevent!","text":"createevent!(model, pixels, name, duration=1)\n\nAdd a farm event to the specified pixels (a vector of position tuples) for a given duration.\n\n\n\n\n\n","category":"function"},{"location":"simulation.html#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}","page":"Simulation","title":"Persefone.directionto","text":"directionto(pos, model, habitatdescriptor)\n\nCalculate the direction from the given location to the closest location matching the habitat descriptor function. Returns a coordinate tuple (target - position), or nothing if no matching habitat is found. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}","page":"Simulation","title":"Persefone.directionto","text":"directionto(pos, model, habitattype)\n\nCalculate the direction from the given location to the closest habitat of the specified type. Returns a coordinate tuple (target - position), or nothing if no matching habitat is found. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}","page":"Simulation","title":"Persefone.distanceto","text":"distanceto(pos, model, habitatdescriptor)\n\nCalculate the distance from the given location to the closest location matching the habitat descriptor function. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}","page":"Simulation","title":"Persefone.distanceto","text":"distanceto(pos, model, habitattype)\n\nCalculate the distance from the given location to the closest habitat of the specified type. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.distancetoedge-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Simulation","title":"Persefone.distancetoedge","text":"distancetoedge(pos, model)\n\nCalculate the distance from the given location to the closest neighbouring habitat. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.farmplot-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Simulation","title":"Persefone.farmplot","text":"farmplot(position, model)\n\nReturn the farm plot at this position, or nothing if there is none (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.inbounds-Tuple{Any, Any}","page":"Simulation","title":"Persefone.inbounds","text":"inbounds(pos, model)\n\nIs the given position within the bounds of the model landscape?\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.initlandscape-Tuple{String, String, String}","page":"Simulation","title":"Persefone.initlandscape","text":"initlandscape(directory, landcovermap, farmfieldsmap)\n\nInitialise the model landscape based on the map files specified in the configuration. Returns a matrix of pixels.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.landcover-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Simulation","title":"Persefone.landcover","text":"landcover(position, model)\n\nReturn the land cover class at this position (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.randomdirection-Tuple{SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}","page":"Simulation","title":"Persefone.randomdirection","text":"randomdirection(model, distance)\n\nGet a random direction coordinate tuple within the specified distance.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.randompixel","page":"Simulation","title":"Persefone.randompixel","text":"randompixel(position, model, range, habitatdescriptor)\n\nFind a random pixel within a given range of the position that matches the habitatdescriptor (create this using @habitat).\n\n\n\n\n\n","category":"function"},{"location":"simulation.html#Persefone.safebounds-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Simulation","title":"Persefone.safebounds","text":"safebounds(pos, model)\n\nMake sure that a given position is within the bounds of the model landscape.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.updateevents!-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.updateevents!","text":"updateevents!(model)\n\nCycle through the list of events, removing those that have expired.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#weather.jl","page":"Simulation","title":"weather.jl","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"This file reads in weather data and makes it available to the model.","category":"page"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"Modules = [Persefone]\nPages = [\"world/weather.jl\"]","category":"page"},{"location":"simulation.html#Persefone.Weather","page":"Simulation","title":"Persefone.Weather","text":"Weather\n\nA single weather datum, combining the observations from one day.\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.initweather-Tuple{String, Dates.Date, Dates.Date}","page":"Simulation","title":"Persefone.initweather","text":"initweather(weatherfile, startdate, enddate)\n\nLoad a weather file, extract the values that are relevant to this model run (specified by start and end dates), and return a dictionary of Weather objects mapped to dates.\n\nNote: This requires a weather file in the format produced by data/extract_weather_data.R.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.maxtemp-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.maxtemp","text":"maxtemp(model)\n\nReturn today's maximum temperature in °C.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.meantemp-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.meantemp","text":"meantemp(model)\n\nReturn today's mean temperature in °C.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.mintemp-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.mintemp","text":"mintemp(model)\n\nReturn today's minimum temperature in °C.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.precipitation-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.precipitation","text":"precipitation(model)\n\nReturn today's total precipitation in mm.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.sunshine-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.sunshine","text":"sunshine(model)\n\nReturn today's sunshine duration in hours.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.vapourpressure-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.vapourpressure","text":"vapourpressure(model)\n\nReturn today's average vapour pressure in hPa.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.windspeed-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.windspeed","text":"windspeed(model)\n\nReturn today's average windspeed in m/s.\n\n\n\n\n\n","category":"method"},{"location":"farm.html#Farm-submodel","page":"Farm submodel","title":"Farm submodel","text":"","category":"section"},{"location":"farm.html","page":"Farm submodel","title":"Farm submodel","text":"Eventually, the aim is to create a full socio-economic farm decision model for Persefone. However, for the time being, we will restrict ourselves to a simple model that executes typical farm operations and crop rotations.","category":"page"},{"location":"farm.html#farm.jl","page":"Farm submodel","title":"farm.jl","text":"","category":"section"},{"location":"farm.html","page":"Farm submodel","title":"Farm submodel","text":"This file is responsible for managing the farm module(s).","category":"page"},{"location":"farm.html","page":"Farm submodel","title":"Farm submodel","text":"Modules = [Persefone]\nPages = [\"farm/farm.jl\"]","category":"page"},{"location":"farm.html#Persefone.Farmer","page":"Farm submodel","title":"Persefone.Farmer","text":"Farmer\n\nThis is the agent type for the farm ABM. (Not yet implemented.)\n\n\n\n\n\n","category":"type"},{"location":"farm.html#Persefone.initfarms!-Tuple{SimulationModel}","page":"Farm submodel","title":"Persefone.initfarms!","text":"initfarms!(model)\n\nInitialise the model with a set of farm agents.\n\n\n\n\n\n","category":"method"},{"location":"farm.html#Persefone.stepagent!-Tuple{Farmer, SimulationModel}","page":"Farm submodel","title":"Persefone.stepagent!","text":"stepagent!(farmer, model)\n\nUpdate a farmer by one day.\n\n\n\n\n\n","category":"method"},{"location":"adapting.html#Adapting-Persefone","page":"Adapting Persefone","title":"Adapting Persefone","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"A key development goal of Persefone is to be FAIR: findable, accessible, interoperable, and reusable. We aim to build a model that is both easy to use and easy to adapt to new situations.","category":"page"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"There are multiple ways to adapt Persefone for a new modelling study:","category":"page"},{"location":"adapting.html#Changing-the-parameters","page":"Adapting Persefone","title":"Changing the parameters","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"The simplest way to adapt Persefone is simply by changing the parameters. Copy src/parameters.toml to a new location, adjust it to your needs, and run the model using julia run.jl -c <configfile>.","category":"page"},{"location":"adapting.html#Changing-the-region","page":"Adapting Persefone","title":"Changing the region","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"To apply Persefone to a new region, you need to create new input maps of land cover and farmplots. How to do so is described here.","category":"page"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"You may also need to change aspects of the farm submodel. This is not yet implemented.","category":"page"},{"location":"adapting.html#Adding-new-animal-species","page":"Adapting Persefone","title":"Adding new animal species","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"To implement a new species to the nature submodel, add a new file to the src/nature/species directory and include it in src/Persefone.jl, as well as adding the name of the species to the nature.targetspecies parameter. In the new file, implement the species using the @species syntax as described here.","category":"page"},{"location":"adapting.html#Adding-new-crop-species","page":"Adapting Persefone","title":"Adding new crop species","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"Crop growth is not yet implemented.","category":"page"},{"location":"adapting.html#Adding-new-farmer-behaviour","page":"Adapting Persefone","title":"Adding new farmer behaviour","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"Farmer behaviour is not yet implemented.","category":"page"},{"location":"adapting.html#Adding-a-new-submodel","page":"Adapting Persefone","title":"Adding a new submodel","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"To add a new submodel in addition to the existing ones (nature, crop, and farm), you need to familiarise yourself with the software architecture. In particular, you need to understand how initialisation and scheduling works in src/core/simulation.jl, and what information is stored in the model object.","category":"page"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"If you want to add a new agent type, create a subtype of ModelAgent, implement a stepagent! function for it and add it to Persefone.initmodel.","category":"page"},{"location":"adapting.html#Linking-to-another-model","page":"Adapting Persefone","title":"Linking to another model","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"Persefone can also be used as a software library and be called from another application. For this purpose, it is set up as a Julia package, with a module exporting various model functions, types, and macros (see src/Persefone.jl). Of particular interest are the functions simulate (set up and run a complete simulation based on a config file), initialise (create one or more model objects from a config file), simulate! (do a simulation run with an existing model object), and stepsimulation! (update a model object by one time step).","category":"page"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"To interface with Julia from another language, see the Julia docs here and here.","category":"page"},{"location":"odd.html#Overview,-Design,-Details-(ODD)","page":"Overview, Design, Details (ODD)","title":"Overview, Design, Details (ODD)","text":"","category":"section"},{"location":"odd.html","page":"Overview, Design, Details (ODD)","title":"Overview, Design, Details (ODD)","text":"TODO","category":"page"},{"location":"gis.html#Maps-and-weather-data","page":"Maps and weather data","title":"Maps and weather data","text":"","category":"section"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Persefone currently requires two separate map input files: one for land cover, the other for field geometry. Additionally, a weather input file is needed. This documents describe how to obtain and process the data needed for each of these.","category":"page"},{"location":"gis.html#Land-cover-maps","page":"Maps and weather data","title":"Land cover maps","text":"","category":"section"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Land cover maps for Germany at 10m resolution can be obtained from Mundialis. These are generated annually from Sentinel data and comprise the following land cover classes:","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"10: forest\n20: low vegetation\n30: water\n40: built-up\n50: bare soil\n60: agriculture","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"To create a Persefone map input file, you need to crop the national Mundialis map to the extent that you want to simulate (suggestion: approx. 10x10km is a reasonable size).","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"To do so, download the Mundialis map and import it into QGIS. Then create a new vector layer and create a rectangle feature to delimit the extent of your region. Then go to Raster -> Extraction -> Clip Raster by Extent. Select the Mundialis map as the input layer, set the clipping extent by choosing your region vector layer under Calculate from Layer and specify the output file name before clicking Run. This will generate a TIF file that you can pass to Persefone as the landcovermap parameter.","category":"page"},{"location":"gis.html#Field-ID-maps","page":"Maps and weather data","title":"Field ID maps","text":"","category":"section"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"In addition to the land cover data explained above, Persefone also needs information about agricultural field boundaries in order to assign these to the farming agents. Unfortunately, getting this is rather more complicated.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"In the EU, every country runs a Land Parcel Information System (LPIS) to administer CAP payments. In Germany, this is called InVeKoS and is run by the Länder. For example, you can view and download the InVeKoS data for Thüringen here. This gives you a vector layer which can be loaded into QGIS. However, it needs to be converted to a raster layer and cropped to your region extent before it can be used in Persefone.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"The first thing to do is to make sure that the vector layer has a numeric (!) field with a unique identifier for each field block (check the attribute table). The Thüringen data has the FBI (\"Feldblockident\") field, but this is a string value and therefore not usable by the rasteriser. So, we set the vector layer to edit mode, open the field calculator, enter the information for a new field (call it \"FID\" and set it to a 32-bit integer), and enter @row_number in the expression field. Then save the layer and close the calculator.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Secondly, you need to filter out all non-field/non-grassland plot types. (LPIS also has data on forests and various landscape elements that are not relevant to our use case.) Assuming you're working with the Thüringen InVeKoS data (other data sets may have a different structure), right-click on the layer name in QGIS' layer overview and click on \"Filter...\". Then, enter this expression in the query builder: \"BNK\" = 'AL' OR \"BNK\" = 'GL' and click \"OK\". This will select only field and grassland plots.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Next, open the rasteriser (Raster -> Conversion -> Rasterize). Select your FID field as the \"Field to use for a burn-in value\", and your land cover map (as created above - this ensures the two layers match) as the output extent. Make sure the \"fixed value to burn\" is \"Not set\". Then choose \"Georeferenced units\" as the \"Out raster size units\" and set horizontal and vertical resolution to 10.0. In the advanced parameters, set the output data type to UInt32. Finally, enter an output file name and run. The resulting TIF file can be passed to Persefone as the farmfieldmap parameter.","category":"page"},{"location":"gis.html#Weather-data","page":"Maps and weather data","title":"Weather data","text":"","category":"section"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Currently, Persefone uses historical weather data from the closes weather station as its weather input. (In future, this may be changed to a more detailed raster input, which could then also provide future weather predictions under climate change.) Weather data can be downloaded from the German weather service (DWD). The relevant data are in the folder daily/kl/historical.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"The description of this data set and the list of weather stations can be found in the Persefone repository, in the docs folder (or downloaded from the link above). Using the list of weather stations, select the one closest to the area of study. Note that not all stations were continuously in operation; make sure that the selected station covers the years of interest.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Region Jena: station number 02444 (\"Jena (Sternwarte)\")\nRegion Eichsfeld:\nRegion Thüringer Becken:\nRegion Hohenlohe:\nRegion Bodensee:\nRegion Nördlicher Oberrhein:","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"From the link above, download the ZIP file associated with the station number. Check the included meta-data if there is any important missing data, or other relevant information (e.g. the station moved position).","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Then use data/extract_weather_data.R to process the data into the format needed by Persefone:","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"library(tidyverse)\n\n## replace this with the correct file name\nweatherfile = \"produkt_klima_tag_18210101_20221231_02444.txt\"\n\ndata = read.table(weatherfile, sep=\";\", header=T)\n\nweather = data %>%\n ## drop values before 2000 to save space\n filter(MESS_DATUM>=20000101) %>%\n ## select relevant variables and convert place-holder values to NA\n select(MESS_DATUM, FM, RSK, SDK, VPM, TMK, TXK, TNK) %>%\n mutate(date=MESS_DATUM, MESS_DATUM=NULL,\n mean_windspeed=na_if(FM, -999), FM=NULL,\n precipitation=na_if(RSK, -999), RSK=NULL,\n sunshine_hours=na_if(SDK, -999), SDK=NULL,\n mean_vapour_pressure=na_if(VPM, -999), VPM=NULL,\n mean_temperature=na_if(TMK, -999), TMK=NULL,\n max_temperature=na_if(TXK, -999), TXK=NULL,\n min_temperature=na_if(TNK, -999), TNK=NULL)\n\n## replace with the desired file name\nwrite.csv(weather, file=\"weather_jena.csv\", row.names=FALSE)","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Note: for calculating the reference evapotranspiration ET_0 (needed for the AquaCrop model), use the FAO Penman-Monteith equation.","category":"page"},{"location":"crops.html#Crop-submodel","page":"Crop submodel","title":"Crop submodel","text":"","category":"section"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"Eventually, the plan is to have Persefone include a reimplementation of the AquaCrop model, a well-established crop growth model developed by the FAO. Until then, we are using the crop growth submodel used in ALMaSS.","category":"page"},{"location":"crops.html#farmplot.jl","page":"Crop submodel","title":"farmplot.jl","text":"","category":"section"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"This file is responsible for the farm plots, i.e. the indidivual fields that farmers manage.","category":"page"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"Modules = [Persefone]\nPages = [\"crop/farmplot.jl\"]","category":"page"},{"location":"crops.html#Persefone.FarmPlot","page":"Crop submodel","title":"Persefone.FarmPlot","text":"FarmPlot\n\nThis represents one field, i.e. a collection of pixels with the same management. This is the spatial unit with which the crop growth model and the farm model work.\n\n\n\n\n\n","category":"type"},{"location":"crops.html#Persefone.averagefieldsize-Tuple{SimulationModel}","page":"Crop submodel","title":"Persefone.averagefieldsize","text":"averagefieldsize(model)\n\nCalculate the average field size in hectares for the model landscape.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.cropheight-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Crop submodel","title":"Persefone.cropheight","text":"cropheight(model, position)\n\nReturn the height of the crop at this position, or nothing if there is no crop here (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.cropname-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Crop submodel","title":"Persefone.cropname","text":"cropname(model, position)\n\nReturn the name of the crop at this position, or an empty string if there is no crop here (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.croptype-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Crop submodel","title":"Persefone.croptype","text":"croptype(model, position)\n\nReturn the crop at this position, or nothing if there is no crop here (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.growcrop!-Tuple{FarmPlot, SimulationModel}","page":"Crop submodel","title":"Persefone.growcrop!","text":"growcrop!(farmplot, model)\n\nApply the relevant crop growth model to update the plants on this farm plot. Currently only supports the ALMaSS crop growth model by Topping et al.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.harvest!-Tuple{FarmPlot, SimulationModel}","page":"Crop submodel","title":"Persefone.harvest!","text":"harvest!(farmplot, model)\n\nHarvest the crop on this farmplot.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.initfields!-Tuple{SimulationModel}","page":"Crop submodel","title":"Persefone.initfields!","text":"initfields!(model)\n\nInitialise the model with its farm plots.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.sow!-Tuple{String, FarmPlot, SimulationModel}","page":"Crop submodel","title":"Persefone.sow!","text":"sow!(cropname, farmplot, model)\n\nSow the specified crop on this farmplot.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.stepagent!-Tuple{FarmPlot, SimulationModel}","page":"Crop submodel","title":"Persefone.stepagent!","text":"stepagent!(farmplot, model)\n\nUpdate a farm plot by one day.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#crops.jl","page":"Crop submodel","title":"crops.jl","text":"","category":"section"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"This includes the types and functions needed for all crop growth model, which are also referenced by the other submodels.","category":"page"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"Modules = [Persefone]\nPages = [\"crop/crops.jl\"]","category":"page"},{"location":"crops.html#Persefone.CropCurveParams","page":"Crop submodel","title":"Persefone.CropCurveParams","text":"CropCurveParams\n\nThe values in this struct define one crop growth curve.\n\n\n\n\n\n","category":"type"},{"location":"crops.html#Persefone.CropType","page":"Crop submodel","title":"Persefone.CropType","text":"CropType\n\nThe type struct for all crops. Currently follows the crop growth model as implemented in ALMaSS.\n\n\n\n\n\n","category":"type"},{"location":"crops.html#Persefone.GrowthPhase","page":"Crop submodel","title":"Persefone.GrowthPhase","text":"GrowthPhase\n\nALMaSS crop growth curves are split into five phases, triggered by seasonal dates or agricultural events.\n\n\n\n\n\n","category":"type"},{"location":"crops.html#Base.tryparse-Tuple{Type{Persefone.GrowthPhase}, String}","page":"Crop submodel","title":"Base.tryparse","text":"Base.tryparse(type, str)\n\nExtend tryparse to allow parsing GrowthPhase values. (Needed to read in the CSV parameter file.)\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.buildgrowthcurve-Tuple{Vector{CSV.Row}}","page":"Crop submodel","title":"Persefone.buildgrowthcurve","text":"buildgrowthcurve(data)\n\nConvert a list of rows from the crop growth data into a CropCurveParams object.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.readcropparameters-Tuple{String, String}","page":"Crop submodel","title":"Persefone.readcropparameters","text":"readcropparameters(generalcropfile, cropgrowthfile)\n\nParse a CSV file containing the required parameter values for each crop (as produced from the original ALMaSS file by convert_almass_data.py).\n\n\n\n\n\n","category":"method"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"CurrentModule = Persefone","category":"page"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"(Image: Persefone.jl splash screen)","category":"page"},{"location":"index.html#Introduction","page":"Introduction","title":"Introduction","text":"","category":"section"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"Persefone.jl models agricultural practice and how it impacts animal species at a landscape scale. It includes a farm submodel, a crop growth submodel, and individual-based models of multiple indicator species. Its aim is to investigate how changes in farm operations (e.g. through policy changes in the CAP) influence biodiversity.","category":"page"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"The model is open-source software available on Gitlab.","category":"page"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"This documentation was last updated on 2024-07-16 for Persefone.jl v0.5.1 (commit 897e96c).","category":"page"}] +[{"location":"energy.html#Dynamic-Energy-Budgets","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"","category":"section"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"NOTE: currently not used.","category":"page"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"Persefone's nature module uses Kooijman's Dynamic Energy Budget theory to model energy flows within individuals.","category":"page"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"(Image: \"The standard model of the Dynamic Energy Budget theory\")","category":"page"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"The standard model of the Dynamic Energy Budget theory. (Fig. 1 from Sousa et al. (2010).)","category":"page"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"Sousa et al. (2010). Dynamic energy budget theory restores coherence in biology. Philosophical Transactions of the Royal Society B: Biological Sciences, 365(1557), 3413–3428.\nKooijman, S. A. L. M. (2009). Dynamic energy and mass budgets in biological systems (3rd ed). Cambridge University Press.\nSibly et al. (2013). Representing the acquisition and use of energy by individuals in agent-based models of animal populations. Methods in Ecology and Evolution, 4(2), 151–161.","category":"page"},{"location":"energy.html#energy.jl","page":"Dynamic Energy Budgets","title":"energy.jl","text":"","category":"section"},{"location":"energy.html","page":"Dynamic Energy Budgets","title":"Dynamic Energy Budgets","text":"Modules = [Persefone]\nPages = [\"nature/energy.jl\"]","category":"page"},{"location":"energy.html#Persefone.DEBparameters","page":"Dynamic Energy Budgets","title":"Persefone.DEBparameters","text":"DEBparameters\n\nAn immutable struct to save the parameter list for a species' Dynamic Energy Budget model. (See Sousa et al., 2010.)\n\n\n\n\n\n","category":"type"},{"location":"energy.html#Persefone.EnergyBudget","page":"Dynamic Energy Budgets","title":"Persefone.EnergyBudget","text":"EnergyBudget\n\nThis struct represents an individual's energy balance, as conceptualised by the Dynamic Energy Budget theory. Upon assimilation, energy is first stored as biomass in a reserve buffer, before being used for maintenance, growth, and reproduction. (Note that this is a simplified model form which ignores maturity as a separate buffer.)\n\nSources:\n\nMalishev & Kramer-Schadt (2021). Movement, models, and metabolism: Individual-based energy budget models as next-generation extensions for predicting animal movement outcomes across scales. Ecological Modelling, 441, 109413. https://doi.org/10.1016/j.ecolmodel.2020.109413\nMarques et al. (2018). The AmP project: Comparing species on the basis of dynamic energy budget parameters. PLOS Computational Biology,14(5), e1006100. https://doi.org/10.1371/journal.pcbi.1006100\nSibly et al. (2013). Representing the acquisition and use of energy by individuals in agent-based models of animal populations. Methods in Ecology and Evolution, 4(2), 151–161. https://doi.org/10.1111/2041-210x.12002\nSousa et al. (2010). Dynamic energy budget theory restores coherence in biology. Philosophical Transactions of the Royal Society B: Biological Sciences, 365(1557), 3413–3428. https://doi.org/10.1098/rstb.2010.0166\nKooijman, S. A. L. M. (2009). Dynamic energy and mass budgets in biological systems (3rd ed). Cambridge University Press. https://www.researchgate.net/profile/Edgar-Meza-3/post/Isthereatoxicokineticmodelfordaphniamagnaorotherzooplankton/attachment/59d62cf579197b807798b396/AS%3A348547653357569%401460111644286/download/Dynamic+Energy+Budget+theory+-+Kooijman.pdf\ncompare with: Brown et al. (2004). Toward a metabolic theory of ecology. Ecology, 85(7), 1771–1789. https://doi.org/10.1890/03-9000\n\n\n\n\n\n","category":"type"},{"location":"energy.html#Persefone.feed!-Tuple{Float64, Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.feed!","text":"feed!(quantity, energybudget)\n\nConsume a given quantity of food. Expands the energy reserve by an amount determined by the assimilation rate. Returns true if successful, false if the reserve is already full.\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.growthrate-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.growthrate","text":"growthrate(energybudget)\n\nCalculate the specific growth rate r. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.investmentratio-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.investmentratio","text":"investmentratio(energybudget)\n\nCalculate the investment ratio g. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.maturitymaintenance-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.maturitymaintenance","text":"maturitymaintenance(energybudget)\n\nCalculate the specific maturity maintenance k_J. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.mobilisation-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.mobilisation","text":"mobilisation(energybudget)\n\nCalculate the mobilisation rate J_EC. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.reproduce!-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.reproduce!","text":"reproduce!(energybudget)\n\nIf there is sufficient energy in the offspring buffer of an adult, produce an embryo/egg, reducing the parent energy in the process. Returns the embryo's energy budget, or nothing if the conditions are not met.\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.scaledreservedensity-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.scaledreservedensity","text":"scaledreservedensity(energybudget)\n\nCalculate the scaled reserve density e. (Internal function.)\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.update!-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.update!","text":"update!(energybudget)\n\nCarry out a daily update of the energy budget. Mobilises reserves and allocates these to maintenance (prioritised), growth, and reproduction.\n\nReturn true if the individual has enough energy to survive, or false if the reserve is empty and it starves.\n\n\n\n\n\n","category":"method"},{"location":"energy.html#Persefone.volumetriclength-Tuple{Persefone.EnergyBudget}","page":"Dynamic Energy Budgets","title":"Persefone.volumetriclength","text":"volumetriclength(energybudget)\n\nCalculate the structural length in cm based on an individual's weight (assuming a density of 1 g/cm³ to calculate volume, see Kooijman 2009).\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Nature-submodel","page":"Nature submodel","title":"Nature submodel","text":"","category":"section"},{"location":"nature.html#nature.jl","page":"Nature submodel","title":"nature.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"This file is responsible for managing the animal modules.","category":"page"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"Modules = [Persefone]\nPages = [\"nature/nature.jl\"]","category":"page"},{"location":"nature.html#Persefone.Animal","page":"Nature submodel","title":"Persefone.Animal","text":"Animal\n\nThis is the generic agent type for all animals. Individual species are created using the @species macro. In addition to user-defined, species-specific fields, all species contain the following fields:\n\nid An integer unique identifier for this individual.\nsex male, female, or hermaphrodite.\nparents The IDs of the individual's parents.\npos An (x, y) coordinate tuple.\nage The age of the individual in days.\nphase The update function to be called during the individual's current life phase.\nenergy A DEBparameters struct for calculating energy budgets.\noffspring A vector containing the IDs of an individual's children.\nterritory A vector of coordinates that comprise the individual's territory.\n\n\n\n\n\n","category":"type"},{"location":"nature.html#Persefone.animalid-Tuple{Animal}","page":"Nature submodel","title":"Persefone.animalid","text":"animalid(animal)\n\nA small utility function to return a string with the species name and ID of an animal.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.create!-Tuple{Animal, SimulationModel}","page":"Nature submodel","title":"Persefone.create!","text":"create!(animal, model)\n\nThe create! function is called for every individual at birth or at model initialisation. Species must use @create to define a species-specific method. This is the fall- back method, in case none is implemented for a species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.initnature!-Tuple{SimulationModel}","page":"Nature submodel","title":"Persefone.initnature!","text":"initnature!(model)\n\nInitialise the model with all simulated animal populations.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.killallanimals!-Tuple{Any}","page":"Nature submodel","title":"Persefone.killallanimals!","text":"killallanimals!(model)\n\nRemove all animal individuals from the simulation.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.speciesof-Tuple{Union{Animal, Type}}","page":"Nature submodel","title":"Persefone.speciesof","text":"speciesof(animal)\n\nReturn the species name of this animal as a string.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.speciestype-Tuple{String}","page":"Nature submodel","title":"Persefone.speciestype","text":"speciestype(name)\n\nReturn the Type of this species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.stepagent!-Tuple{Animal, SimulationModel}","page":"Nature submodel","title":"Persefone.stepagent!","text":"stepagent!(animal, model)\n\nUpdate an animal by one day, executing it's currently active phase function.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.updatenature!-Tuple{SimulationModel}","page":"Nature submodel","title":"Persefone.updatenature!","text":"updatenature!(model)\n\nRun processes that affect all animals.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#macros.jl","page":"Nature submodel","title":"macros.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"This file contains all the macros that can be used in the species DSL.","category":"page"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"Modules = [Persefone]\nPages = [\"nature/macros.jl\"]","category":"page"},{"location":"nature.html#Persefone.@animal-Tuple{Any}","page":"Nature submodel","title":"Persefone.@animal","text":"@animal(id)\n\nReturn the animal object associated with this ID number. This can only be used in a context where the model object is available (e.g. nested within @phase).\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@countanimals-Tuple","page":"Nature submodel","title":"Persefone.@countanimals","text":"@countanimals(radius=0, species=\"\")\n\nCount the number of animals at or near this location, optionally filtering by species. This can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@create-Tuple{Any, Any}","page":"Nature submodel","title":"Persefone.@create","text":"@create(species, body)\n\nDefine a special phase function (create!()) that will be called when an individual of this species is created, at the initialisation of the simulation or at birth.\n\nAs for @phase, the body of this macro has access to the variables self (the individual being created) and model (the simulation world), and can thus use all macros available in @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@cropcover-Tuple{}","page":"Nature submodel","title":"Persefone.@cropcover","text":"@cropcover\n\nReturn the percentage ground cover of the crop at this position, or nothing if there is no crop here. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@cropheight-Tuple{}","page":"Nature submodel","title":"Persefone.@cropheight","text":"@cropheight\n\nReturn the height of the crop at this position, or nothing if there is no crop here. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@cropname-Tuple{}","page":"Nature submodel","title":"Persefone.@cropname","text":"@cropname\n\nReturn the name of the local croptype, or an empty string if there is no crop here. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@directionto-Tuple{Any}","page":"Nature submodel","title":"Persefone.@directionto","text":"@directionto\n\nCalculate the direction to an animal or the closest habitat of the specified type or descriptor. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@distanceto-Tuple{Any}","page":"Nature submodel","title":"Persefone.@distanceto","text":"@distanceto\n\nCalculate the distance to an animal or the closest habitat of the specified type or descriptor. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@distancetoedge-Tuple{}","page":"Nature submodel","title":"Persefone.@distancetoedge","text":"@distancetoedge\n\nCalculate the distance to the closest neighbouring habitat. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@follow-Tuple{Any, Any}","page":"Nature submodel","title":"Persefone.@follow","text":"@follow(leader, distance)\n\nMove to a location within the given distance of the leading animal. This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@habitat-Tuple{Any}","page":"Nature submodel","title":"Persefone.@habitat","text":"@habitat\n\nSpecify habitat suitability for spatial ecological processes.\n\nThis macro works by creating an anonymous function that takes in a model object and a position, and returns true or false depending on the conditions specified in the macro body.\n\nSeveral utility macros can be used within the body of @habitat as a short-hand for common expressions: @landcover, @cropname, @cropheight, @distanceto, @distancetoedge, @countanimals. The variables model and pos can be used for checks that don't have a macro available.\n\nTwo example uses of @habitat might look like this:\n\nmovementhabitat = @habitat(@landcover() in (grass agriculture soil))\n\nnestinghabitat = @habitat((@landcover() == grass || \n (@landcover() == agriculture && @cropname() != \"maize\" &&\n @cropheight() < 10)) &&\n @distanceto(forest) > 20)\n\nFor more complex habitat suitability checks, the use of this macro can be circumvented by directly creating an equivalent function.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@here-Tuple{}","page":"Nature submodel","title":"Persefone.@here","text":"@here()\n\nReturn the landscape pixel of this animal's current location. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@isalive-Tuple{Any}","page":"Nature submodel","title":"Persefone.@isalive","text":"@isalive(id)\n\nTest whether the animal with the given ID is still alive. This can only be used in a context where the model object is available (e.g. nested within @phase).\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@isoccupied-Tuple{Any}","page":"Nature submodel","title":"Persefone.@isoccupied","text":"@isoccupied(position)\n\nTest whether this position is already occupied by an animal of this species. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@kill-Tuple","page":"Nature submodel","title":"Persefone.@kill","text":"@kill\n\nKill this animal (and immediately abort its current update if it dies). This is a thin wrapper around kill!, and passes on any arguments. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@killother-Tuple{Any, Vararg{Any}}","page":"Nature submodel","title":"Persefone.@killother","text":"@killother\n\nKill another animal. This is a thin wrapper around kill!, and passes on any arguments. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@landcover-Tuple{}","page":"Nature submodel","title":"Persefone.@landcover","text":"@landcover\n\nReturns the local landcover. This is a utility wrapper that can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@migrate-Tuple{Any}","page":"Nature submodel","title":"Persefone.@migrate","text":"@migrate(arrival)\n\nRemove this animal from the map and add it to the migrant species pool. It will be returned to its current location at the specified arrival date. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@move-Tuple{Any}","page":"Nature submodel","title":"Persefone.@move","text":"@move(position)\n\nMove the current individual to a new position. This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@nearby_animals-Tuple","page":"Nature submodel","title":"Persefone.@nearby_animals","text":"@nearby_animals(radius=0, species=\"\")\n\nReturn an iterator over all animals in the given radius around the current position. This can only be used nested within @phase or @habitat.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@neighbours-Tuple","page":"Nature submodel","title":"Persefone.@neighbours","text":"@neighbours(radius=0, conspecifics=true)\n\nReturn an iterator over all (by default conspecific) animals in the given radius around this animal, excluding itself. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@occupy-Tuple{Any}","page":"Nature submodel","title":"Persefone.@occupy","text":"@occupy(position)\n\nAdd the given position to this animal's territory. Use @vacate to remove positions from the territory again. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@phase-Tuple{Any, Any, Any}","page":"Nature submodel","title":"Persefone.@phase","text":"@phase(name, body)\n\nUse this macro to describe a species' behaviour during a given phase of its life. The idea behind this is that species show very different behaviour at different times of their lives. Therefore, @phase can be used define the behaviour for one such phase, and the conditions under which the animal transitions to another phase.\n\n@phase works by creating a function that will be called by the model if the animal is in the relevant phase. When it is called, it has access to the following variables:\n\nself a reference to the animal itself. This provides access to all the variables defined in the @species definition, as well as all standard Animal variables (e.g. self.age, self.sex, self.offspring).\npos gives the animal's current position as a coordinate tuple.\nmodel a reference to the model world (an object of type SimulationModel). This allows access, amongst others, to model.date (the current simulation date) and model.landscape (a two-dimensional array of pixels containing geographic information).\n\nMany macros are available to make the code within the body of @phase more succinct. Some of the most important of these are: @setphase, @respond, @kill, @reproduce, @neighbours, @migrate, @move, @occupy, @rand.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@populate-Tuple{Any, Any}","page":"Nature submodel","title":"Persefone.@populate","text":"@populate(species, params)\n\nSet the parameters that are used to initialise this species' population. For parameter options, see PopInitParams.\n\n@populate <species> begin\n <parameter> = <value>\n ...\nend \n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@randomdirection-Tuple","page":"Nature submodel","title":"Persefone.@randomdirection","text":"@randomdirection(range=1)\n\nReturn a random direction tuple that can be passed to @walk. This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@randompixel-Tuple","page":"Nature submodel","title":"Persefone.@randompixel","text":"@randompixel(range, habitatdescriptor)\n\nFind a random pixel within a given range of the animal's location that matches the habitatdescriptor (create this using @habitat). This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@reproduce-Tuple","page":"Nature submodel","title":"Persefone.@reproduce","text":"@reproduce\n\nLet this animal reproduce. This is a thin wrapper around reproduce!, and passes on any arguments. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@respond-Tuple{Any, Any}","page":"Nature submodel","title":"Persefone.@respond","text":"@respond(eventname, body)\n\nDefine how an animal responds to a landscape event that affects its current position. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@setphase-Tuple{Any}","page":"Nature submodel","title":"Persefone.@setphase","text":"@setphase(newphase)\n\nSwitch this animal over to a different phase. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@species-Tuple{Any, Any}","page":"Nature submodel","title":"Persefone.@species","text":"@species(name, body)\n\nA macro used to add new species types to the nature model. Use this to define species-specific variables and parameters.\n\nThe macro works by creating a keyword-defined mutable struct that contains the standard fields described for the Animal type, as well as any new fields that the user adds:\n\n@species <name> begin\n <var1> = <value>\n <var2> = <value>\n ...\nend\n\nTo complete the species definition, the @phase, @create, and @populate macros also need to be used.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@vacate-Tuple{Any}","page":"Nature submodel","title":"Persefone.@vacate","text":"@vacate(position)\n\nRemove the given position from this animal's territory. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@vacate-Tuple{}","page":"Nature submodel","title":"Persefone.@vacate","text":"@vacate()\n\nRemove this animal's complete territory. This can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#Persefone.@walk-Tuple","page":"Nature submodel","title":"Persefone.@walk","text":"@walk(direction, speed)\n\nWalk the animal in a given direction, which is specified by a tuple of coordinates relative to the animal's current position (i.e. (2, -3) increments the X coordinate by 2 and decrements the Y coordinate by 3.) This is a utility wrapper that can only be used nested within @phase.\n\n\n\n\n\n","category":"macro"},{"location":"nature.html#individuals.jl","page":"Nature submodel","title":"individuals.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"This file contains life-history and other ecological functions that apply to all animal individuals, such reproduction, death, and movement.","category":"page"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"Modules = [Persefone]\nPages = [\"nature/individuals.jl\"]","category":"page"},{"location":"nature.html#Persefone.followanimal!","page":"Nature submodel","title":"Persefone.followanimal!","text":"followanimal!(follower, leader, model, distance=0)\n\nMove the follower animal to a location near the leading animal.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.kill!","page":"Nature submodel","title":"Persefone.kill!","text":"kill!(animal, model, probability=1.0, cause=\"\")\n\nKill this animal, optionally with a given percentage probability. Returns true if the animal dies, false if not.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.migrate!-Tuple{Animal, SimulationModel, Dates.Date}","page":"Nature submodel","title":"Persefone.migrate!","text":"migrate!(animal, model, arrival)\n\nRemove this animal from the map and add it to the migrant species pool. It will be returned to its current location at the specified arrival date.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.move!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}","page":"Nature submodel","title":"Persefone.move!","text":"move!(animal, model, position)\n\nMove the animal to the given position, making sure that this is in-bounds. If the position is out of bounds, the animal stops at the map edge.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.occupy!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}","page":"Nature submodel","title":"Persefone.occupy!","text":"occupy!(animal, model, position)\n\nAdd the given location to the animal's territory.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.reproduce!","page":"Nature submodel","title":"Persefone.reproduce!","text":"reproduce!(animal, model, mate, n=1)\n\nProduce one or more offspring for the given animal at its current location. The mate argument gives the ID of the reproductive partner.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.vacate!-Tuple{Animal, SimulationModel, Tuple{Int64, Int64}}","page":"Nature submodel","title":"Persefone.vacate!","text":"vacate!(animal, model, position)\n\nRemove this position from the animal's territory.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.vacate!-Tuple{Animal, SimulationModel}","page":"Nature submodel","title":"Persefone.vacate!","text":"vacate!(animal, model)\n\nRemove the animal's complete territory.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.walk!","page":"Nature submodel","title":"Persefone.walk!","text":"walk!(animal, model, direction, distance=-1)\n\nLet the animal move in the given direction, where the direction is defined by an (x, y) tuple to specify the shift in coordinates. If maxdist >= 0, move no further than the specified distance.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.walk!-2","page":"Nature submodel","title":"Persefone.walk!","text":"walk!(animal, model, direction, distance=1pixel)\n\nLet the animal move a given number of steps in the given direction (\"north\", \"northeast\", \"east\", \"southeast\", \"south\", \"southwest\", \"west\", \"northwest\", \"random\").\n\n\n\n\n\n","category":"function"},{"location":"nature.html#populations.jl","page":"Nature submodel","title":"populations.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"This file contains functions that apply to all animal populations, such as for initialisation, or querying for neighbours.","category":"page"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"Modules = [Persefone]\nPages = [\"nature/populations.jl\"]","category":"page"},{"location":"nature.html#Persefone.PopInitParams","page":"Nature submodel","title":"Persefone.PopInitParams","text":"PopInitParams\n\nA set of parameters used by initpopulation! to initialise the population of a species at the start of a simulation. Define these parameters for each species using @populate.\n\ninitphase determines which life phase individuals will be assigned to at model initialisation (required).\nbirthphase determines which life phase individuals will be assigned to at birth (required).\nhabitat is a function that determines whether a given location is suitable or not (create this using @habitat). By default, every cell will be occupied.\npopsize determines the number of individuals that will be created, dispersed over the suitable locations in the landscape. If this is zero or negative, one individual will be created in every suitable location. If it is greater than the number of suitable locations, multiple individuals will be created per location. Alternately, use indarea.\nindarea: if this is greater than zero, it determines the habitat area allocated to each individual or pair. To be precise, the chance of creating an individual (or pair of individuals) at a suitable location is 1/indarea. Use this as an alternative to popsize.\nIf pairs is true, a male and a female individual will be created in each selected location, otherwise, only one individual will be created at a time. (default: false)\nIf asexual is true, all created individuals are assigned the sex hermaphrodite, otherwise, they are randomly assigned male or female. If pairs is true, asexual is ignored. (default: false)\n\n\n\n\n\n","category":"type"},{"location":"nature.html#Persefone.countanimals-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Nature submodel","title":"Persefone.countanimals","text":"countanimals(pos, model; radius=0, species=\"\")\n\nReturn the number of animals in the given radius around this position, optionally filtering by species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}","page":"Nature submodel","title":"Persefone.directionto","text":"directionto(pos, model, animal)\n\nCalculate the direction from the given position to the animal.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Animal}","page":"Nature submodel","title":"Persefone.distanceto","text":"distanceto(pos, model, animal)\n\nCalculate the distance from the given position to the animal.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.initindividuals!-Tuple{Type, Tuple{Int64, Int64}, Persefone.PopInitParams, SimulationModel}","page":"Nature submodel","title":"Persefone.initindividuals!","text":"initindividuals!(species, pos, popinitparams, model)\n\nInitialise one or two individuals (depending on the pairs parameter) in the given location. Returns the number of created individuals. (Internal helper function for initpopulation!().)\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.initpopulation!-Tuple{String, SimulationModel}","page":"Nature submodel","title":"Persefone.initpopulation!","text":"initpopulation!(speciesname, model)\n\nInitialise the population of the given species, based on the parameters stored in PopInitParams. Define these using @populate.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.initpopulation!-Tuple{Type, Persefone.PopInitParams, SimulationModel}","page":"Nature submodel","title":"Persefone.initpopulation!","text":"initpopulation!(speciestype, popinitparams, model)\n\nInitialise the population of the given species, based on the given initialisation parameters. This is an internal function called by initpopulation!(), and was split off from it to allow better testing.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.isalive-Tuple{Int64, SimulationModel}","page":"Nature submodel","title":"Persefone.isalive","text":"isalive(id, model)\n\nTest whether the animal with the given ID is still alive.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.isoccupied-Tuple{SimulationModel, String, Tuple{Int64, Int64}}","page":"Nature submodel","title":"Persefone.isoccupied","text":"isoccupied(model, position, species)\n\nTest whether this location is part of the territory of an animal of the given species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.nearby_animals-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Nature submodel","title":"Persefone.nearby_animals","text":"nearby_animals(pos, model; radius= 0, species=\"\")\n\nReturn a list of animals in the given radius around this position, optionally filtering by species.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.nearby_ids-Tuple{Tuple{Int64, Int64}, SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}","page":"Nature submodel","title":"Persefone.nearby_ids","text":"nearby_ids(pos, model, radius)\n\nReturn a list of IDs of the animals within a given radius of the position.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.neighbours","page":"Nature submodel","title":"Persefone.neighbours","text":"neighbours(animal, model, radius=0, conspecifics=true)\n\nReturn a list of animals in the given radius around this animal, excluding itself. By default, only return conspecific animals.\n\n\n\n\n\n","category":"function"},{"location":"nature.html#Persefone.populationparameters-Tuple{Type}","page":"Nature submodel","title":"Persefone.populationparameters","text":"populationparameters(type)\n\nA function that returns a PopInitParams object for the given species type. Parametric methods for each species are defined with @populate. This is the catch-all method, which throws an error if no species-specific function is defined.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#ecologicaldata.jl","page":"Nature submodel","title":"ecologicaldata.jl","text":"","category":"section"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"This file contains a set of life-history related utility functions needed by species.","category":"page"},{"location":"nature.html","page":"Nature submodel","title":"Nature submodel","text":"Modules = [Persefone]\nPages = [\"nature/ecologicaldata.jl\"]","category":"page"},{"location":"nature.html#Persefone.initecologicaldata-Tuple{SimulationModel}","page":"Nature submodel","title":"Persefone.initecologicaldata","text":"initecologicaldata()\n\nCreate output files for each data group collected by the nature model.\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.saveindividualdata-Tuple{SimulationModel}","page":"Nature submodel","title":"Persefone.saveindividualdata","text":"saveindividualdata(model)\n\nReturn a data table (to be printed to individuals.csv), listing all properties of all animal individuals in the model. May be called never, daily, monthly, yearly, or at the end of a simulation, depending on the parameter nature.indoutfreq. WARNING: Produces very big files!\n\n\n\n\n\n","category":"method"},{"location":"nature.html#Persefone.savepopulationdata-Tuple{SimulationModel}","page":"Nature submodel","title":"Persefone.savepopulationdata","text":"savepopulationdata(model)\n\nReturn a data table (to be printed to populations.csv), giving the current date and population size for each animal species. May be called never, daily, monthly, yearly, or at the end of a simulation, depending on the parameter nature.popoutfreq.\n\n\n\n\n\n","category":"method"},{"location":"gui.html#Graphical-User-Interface","page":"Graphical User Interface","title":"Graphical User Interface","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Due to the computational demands of simulating many individuals at high temporal and spatial resolution, Persefone.jl is primarily designed to be run non-interactively on an HPC. However, to allow interactive exploratory simulations to be conducted while learning or developing the model, a graphical user interface is available as an additional package: Persefone Desktop.","category":"page"},{"location":"gui.html#Install-and-run","page":"Graphical User Interface","title":"Install and run","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"For more detailed installation instructions, see here.","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"To install: Install Julia and download/clone the repository. Open a Julia REPL in the downloaded folder and execute the following to install all dependencies:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"using Pkg\nPkg.activate(\".\")\nPkg.instantiate()","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"To run: Run desktop.jl. Alternatively, open a Julia REPL in this folder and run:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"using Pkg\nPkg.activate(\".\")\nusing PersefoneDesktop\nlaunch()","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Note: Due to the necessary pre-compilation done by Julia, installing and launching the application can take quite a long time. (Start-up time with desktop.jl is currently about 2 minutes.) We will reduce this as much as possible in future releases.","category":"page"},{"location":"gui.html#User-interface","page":"Graphical User Interface","title":"User interface","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"(Image: Persefone.jl Desktop screenshot)","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"The main window component is the map view. This displays a land cover map of the simulated region: dark green are forests, light green grassland, yellow fields, red built-up areas and blue water. On it, little circles show the position of individual animals, with different species denoted by different colours.","category":"page"},{"location":"gui.html#Control-bar","page":"Graphical User Interface","title":"Control bar","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Back button: Rewind the simulation by one day.\nStep button: Advance the simulation by one day.\nRun button: Run the simulation until the button is pressed again or the end date is reached.\nProgress bar: Shows the percentage of time elapsed between the start and end dates of the simulation.\nSpeed slider: Set the time delay between each simulation step when running.\nDate: Shows the simulation date currently displayed on the map.","category":"page"},{"location":"gui.html#Menu-bar","page":"Graphical User Interface","title":"Menu bar","text":"","category":"section"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Simulation:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"New simulation: Reset the model and start over.\nConfigure simulation: Change the model settings (not yet implemented).\nLoad saved state: Load a model object file saved by a previous simulation run.\nSave current state: Save a model object file for later use.\nQuit: Close the application.","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Data:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Show population graph: Show a window with a graph of population sizes over time in the current model run.\nSave simulation output: Save the model output data to file (saves both raw CSV data and generated graphics).","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Help:","category":"page"},{"location":"gui.html","page":"Graphical User Interface","title":"Graphical User Interface","text":"Documentation: Open the Persefone.jl online documentation in a browser.\nWebsite: Open the main Persefone.jl website in a browser.\nAbout: Show a window with core information about the application.","category":"page"},{"location":"io.html#Input-and-Output","page":"Input and Output","title":"Input and Output","text":"","category":"section"},{"location":"io.html","page":"Input and Output","title":"Input and Output","text":"These functions are responsible for reading in all model configurations (passed by config file or commandline), administrating them during a run, and printing or plotting any output.","category":"page"},{"location":"io.html#input.jl","page":"Input and Output","title":"input.jl","text":"","category":"section"},{"location":"io.html","page":"Input and Output","title":"Input and Output","text":"Modules = [Persefone]\nPages = [\"core/input.jl\"]","category":"page"},{"location":"io.html#Persefone.PARAMFILE","page":"Input and Output","title":"Persefone.PARAMFILE","text":"The file that stores all default parameters: src/parameters.toml\n\n\n\n\n\n","category":"constant"},{"location":"io.html#Persefone.flattenTOML-Tuple{Any}","page":"Input and Output","title":"Persefone.flattenTOML","text":"flattenTOML(dict)\n\nAn internal utility function to convert the two-dimensional dict returned by TOML.parsefile() into a one-dimensional dict, so that instead of writing settings[\"domain\"][\"param\"] one can use settings[\"domain.param\"]. Can be reversed with prepareTOML.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.getsettings","page":"Input and Output","title":"Persefone.getsettings","text":"getsettings(configfile, seed=nothing)\n\nCombines all configuration options to produce a single settings dict. Precedence: commandline parameters - user config file - default values\n\n\n\n\n\n","category":"function"},{"location":"io.html#Persefone.loadmodelobject-Tuple{String}","page":"Input and Output","title":"Persefone.loadmodelobject","text":"loadmodelobject(fullfilename)\n\nDeserialise a model object that was previously saved with [savemodelobject](@ref).\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.parsecommandline-Tuple{}","page":"Input and Output","title":"Persefone.parsecommandline","text":"parsecommandline()\n\nCertain software parameters can be set via the commandline.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.preprocessparameters-Tuple{Dict{String, Any}, String}","page":"Input and Output","title":"Persefone.preprocessparameters","text":"preprocessparameters(settings)\n\nTake the raw input parameters and process them where necessary (e.g. convert types or perform checks). This is a helper function for getsettings.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.@chance-Tuple{Any}","page":"Input and Output","title":"Persefone.@chance","text":"@chance(odds)\n\nReturn true if a random number is less than the odds (0.0 <= odds <= 1.0), using the model RNG. This is a utility wrapper that can only be used a context where the model object is available.\n\n\n\n\n\n","category":"macro"},{"location":"io.html#Persefone.@param-Tuple{Any}","page":"Input and Output","title":"Persefone.@param","text":"@param(domainparam)\n\nReturn a configuration parameter from the global settings. The argument should be in the form <domain>.<parameter>, for example @param(core.outdir). Possible values for <domain> are core, nature, farm, or crop. For a full list of parameters, see src/parameters.toml.\n\nNote: this macro only works in a context where the model object is available!\n\n\n\n\n\n","category":"macro"},{"location":"io.html#Persefone.@rand-Tuple","page":"Input and Output","title":"Persefone.@rand","text":"@rand(args...)\n\nReturn a random number or element from the sample, using the model RNG. This is a utility wrapper that can only be used a context where the model object is available.\n\n\n\n\n\n","category":"macro"},{"location":"io.html#Persefone.@shuffle!-Tuple{Any}","page":"Input and Output","title":"Persefone.@shuffle!","text":"@shuffle!(collection)\n\nShuffle the given collection in place, using the model RNG. This is a utility wrapper that can only be used a context where the model object is available.\n\n\n\n\n\n","category":"macro"},{"location":"io.html#output.jl","page":"Input and Output","title":"output.jl","text":"","category":"section"},{"location":"io.html","page":"Input and Output","title":"Input and Output","text":"Modules = [Persefone]\nPages = [\"core/output.jl\"]","category":"page"},{"location":"io.html#Persefone.LOGFILE","page":"Input and Output","title":"Persefone.LOGFILE","text":"Log output is saved to simulation.log in the output directory\n\n\n\n\n\n","category":"constant"},{"location":"io.html#Persefone.RECORDDIR","page":"Input and Output","title":"Persefone.RECORDDIR","text":"All input data are copied to the inputs folder within the output directory\n\n\n\n\n\n","category":"constant"},{"location":"io.html#Persefone.DataOutput","page":"Input and Output","title":"Persefone.DataOutput","text":"DataOutput\n\nA struct for organising model output. This is used to collect model data in an in-memory dataframe or for CSV output. Submodels can register their own output functions using newdataoutput!.\n\nStruct fields: - name: a string identifier for the data collection (used as file name) - header: a list of column names - outputfunction: a function that takes a model object and returns data values to record (formatted as a vector of vectors) - frequency: how often to call the output function (daily/monthly/yearly/end/never) - plotfunction: a function that takes a model object and returns a Makie figure object (optional)\n\n\n\n\n\n","category":"type"},{"location":"io.html#Persefone.createdatadir-Tuple{String, Union{Bool, String}}","page":"Input and Output","title":"Persefone.createdatadir","text":"createdatadir(outdir, overwrite)\n\nCreates the output directory, dealing with possible conflicts.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.modellogger","page":"Input and Output","title":"Persefone.modellogger","text":"modellogger(loglevel, outdir, output=\"both\")\n\nCreate a logger object that writes output to screen and/or a logfile. This object is stored as model.logger and can then be used with with_logger(). Note: requires createdatadir to be run first.\n\n\n\n\n\n","category":"function"},{"location":"io.html#Persefone.newdataoutput!","page":"Input and Output","title":"Persefone.newdataoutput!","text":"newdataoutput!(model, name, header, outputfunction, frequency)\n\nCreate and register a new data output. This function must be called by all submodels that want to have their output functions called regularly.\n\n\n\n\n\n","category":"function"},{"location":"io.html#Persefone.outputdata","page":"Input and Output","title":"Persefone.outputdata","text":"outputdata(model, force=false)\n\nCycle through all registered data outputs and activate them according to their configured frequency. If force is true, activate all outputs regardless of their configuration.\n\n\n\n\n\n","category":"function"},{"location":"io.html#Persefone.prepareTOML-Tuple{Any}","page":"Input and Output","title":"Persefone.prepareTOML","text":"prepareTOML(dict)\n\nAn internal utility function to re-convert the one-dimensional dict created by flattenTOML into the two-dimensional dict needed by TOML.print, and convert any data types into TOML-compatible types where necessary.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.saveinputfiles-Tuple{SimulationModel}","page":"Input and Output","title":"Persefone.saveinputfiles","text":"saveinputfiles(model)\n\nCopy all input files into the output directory, including the actual parameter settings used. This allows replicating a run in future.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.savemodelobject-Tuple{SimulationModel, String}","page":"Input and Output","title":"Persefone.savemodelobject","text":"savemodelobject(model, filename)\n\nSerialise a model object and save it to file for later reference. Includes the current model and Julia versions for compatibility checking.\n\nWARNING: produces large files (>100 MB) and takes a while to execute.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.visualiseoutput-Tuple{SimulationModel}","page":"Input and Output","title":"Persefone.visualiseoutput","text":"visualiseoutput(model)\n\nCycle through all data outputs and call their respective plot functions, saving each figure to file.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.withtestlogger-Tuple{SimulationModel}","page":"Input and Output","title":"Persefone.withtestlogger","text":"withtestlogger(model)\n\nReplace the model logger with the currently active logger. This is intended to be used in the testsuite to circumvent a Julia issue, where @test_logs doesn't work with local loggers.\n\n\n\n\n\n","category":"method"},{"location":"io.html#makieplots.jl","page":"Input and Output","title":"makieplots.jl","text":"","category":"section"},{"location":"io.html","page":"Input and Output","title":"Input and Output","text":"Modules = [Persefone]\nPages = [\"analysis/makieplots.jl\"]","category":"page"},{"location":"io.html#Persefone.gettickmarks-Tuple{Any}","page":"Input and Output","title":"Persefone.gettickmarks","text":"gettickmarks(dates)\n\nGiven a vector of dates, construct a selection to use as tick mark locations. Helper function for [populationtrends](@ref)\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.populationtrends-Tuple{SimulationModel}","page":"Input and Output","title":"Persefone.populationtrends","text":"populationtrends(model)\n\nPlot a line graph of population sizes of each species over time. Returns a Makie figure object.\n\n\n\n\n\n","category":"method"},{"location":"io.html#Persefone.visualisemap","page":"Input and Output","title":"Persefone.visualisemap","text":"visualisemap(model, date, landcover)\n\nDraw the model's land cover map and plot all individuals as points on it at the specified date. If no date is passed, use the last date for which data are available. Optionally, you can pass a landcover map image (this is needed to reduce the frequency of disk I/O for Persefone Desktop). Returns a Makie figure object.\n\n\n\n\n\n","category":"function"},{"location":"config.html#Configuration","page":"Configuration","title":"Configuration","text":"","category":"section"},{"location":"config.html","page":"Configuration","title":"Configuration","text":"Persefone requires three input files: a configuration file and two map files. How to generate the map files is documented elsewhere. The configuration file defines parameter values and looks like this (see src/parameters.toml for the default):","category":"page"},{"location":"config.html","page":"Configuration","title":"Configuration","text":"### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe.\n###\n### This is the default configuration file for Persefone, containing all model parameters.\n### The syntax is described here: https://toml.io/en/\n\n[core]\nconfigfile = \"src/parameters.toml\" # location of the configuration file\noutdir = \"results\" # location and name of the output folder\noverwrite = \"ask\" # overwrite the output directory? (true/false/\"ask\")\nlogoutput = \"both\" # log output to screen/file/both\ncsvoutput = true # save collected data in CSV files\nvisualise = true # generate result graphs\nstoredata = true # keep collected data in memory\nloglevel = \"debug\" # verbosity level: \"debug\", \"info\", \"warn\"\nprocessors = 2 # number of processors to use on parallel runs\nseed = 2 # seed value for the RNG (0 -> random value)\nstartdate = 2022-01-01 # first day of the simulation\nenddate = 2022-12-31 # last day of the simulation\n\n[world]\nlandcovermap = \"data/regions/jena/landcover.tif\" # location of the landcover map\nfarmfieldsmap = \"data/regions/jena/fields.tif\" # location of the field geometry map\nweatherfile = \"data/regions/jena/weather.csv\" # location of the weather data file\n\t\n[farm]\nfarmmodel = \"FieldManager\" # which version of the farm model to use (not yet implemented)\n\n[nature]\ntargetspecies = [\"Wolpertinger\", \"Wyvern\"] # list of target species to simulate\npopoutfreq = \"daily\" # output frequency population-level data, daily/monthly/yearly/end/never\nindoutfreq = \"end\" # output frequency individual-level data, daily/monthly/yearly/end/never\ninsectmodel = [\"season\", \"habitat\", \"pesticides\", \"weather\"] # factors affecting insect growth\n\t\n[crop]\ncropmodel = \"almass\" # crop growth model to use, \"almass\" or \"aquacrop\"\ncropfile = \"data/crops/almass/crop_data_general.csv\" # file with general crop parameters\ngrowthfile = \"data/crops/almass/almass_crop_growth_curves.csv\" # file with crop growth parameters\t","category":"page"},{"location":"config.html","page":"Configuration","title":"Configuration","text":"info: Parameter scanning\nYou can set any parameter to a list of different values, e.g. seed = [1,2,3]. Persefone will then set up and run multiple simulations, one for every possible combination of parameters that you entered (i.e. do a full-factorial simulation experiment).","category":"page"},{"location":"using.html#The-Persefone.jl-Package","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"","category":"section"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"This page describes how to run Persefone.jl as a command line application or Julia package, which is the default mode. To use the model with a graphical user interface, see here.","category":"page"},{"location":"using.html#Installation","page":"The Persefone.jl Package","title":"Installation","text":"","category":"section"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"For more detailed installation instructions, see here.","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"Install the latest version of the Julia programming language (1.10+). The recommended editors are VSCode or Emacs. To install the package dependencies, open a Julia REPL in this folder and run:","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"using Pkg\nPkg.activate(\".\")\nPkg.instantiate()","category":"page"},{"location":"using.html#Running-from-the-command-line","page":"The Persefone.jl Package","title":"Running from the command line","text":"","category":"section"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"This is the normal mode of operation. Simply execute run.jl in a terminal, typically like so (in Linux):","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"> julia run.jl -c <config>","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"where <config> specifies the configuration file to use. The recommended workflow is to copy scr/parameters.toml to a location of your choice and edit the copy to suit your requirements. The adapted config file can then be passed to run.jl. (If no configuration file is specified, Persefone will run with its default settings.)","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"The full list of commandline arguments is:","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"usage: run.jl [-c CONFIGFILE] [-s SEED] [-o OUTDIR] [-l LOGLEVEL] \n [--version] [-h]\n\noptional arguments:\n -c, --configfile CONFIGFILE\n name of the configuration file\n -s, --seed SEED inital random seed (type: Int64)\n -o, --outdir OUTDIR location of the output directory\n -l, --loglevel LOGLEVEL\n verbosity: \"debug\", \"info\", or \"quiet\"\n --version show version information and exit\n -h, --help show this help message and exit","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"To run the test suite, switch to the test directory and execute runtests.jl.","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"If you are on Linux or MacOS, you can also use make:","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"> make run # run a simulation with default values\n> make test # run the test suite\n> make profile # run and profile a default simulation\n> make docs # build the documentation\n> make release # create a release","category":"page"},{"location":"using.html#Running-from-within-Julia","page":"The Persefone.jl Package","title":"Running from within Julia","text":"","category":"section"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"To use the model from within Julia (either inside an interactive REPL or if you want to import it from your own software), do the following:","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"using Pkg\nPkg.activate(\".\") # assuming you're in the Persefone root folder\nusing Persefone","category":"page"},{"location":"using.html","page":"The Persefone.jl Package","title":"The Persefone.jl Package","text":"You can then access all Persefone functions, such as simulate, initialise, stepsimulation!, simulate!, or visualiseoutput. (See src/Persefone.jl for a list of exported functions.)","category":"page"},{"location":"architecture.html#Source-code-architecture","page":"Source code architecture","title":"Source code architecture","text":"","category":"section"},{"location":"architecture.html#Model-components","page":"Source code architecture","title":"Model components","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"(Image: \"model architecture\")","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"Persefone is divided into four components, three of which are semi-independent submodels:","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"core and world: These two directories provide the foundation of the model software, which sets up and executes simulation runs. It also reads all input files (the configuration file, landscape maps, and weather data), and provides data output functionality.\nnature: This is an individual-based model of species in agricultural landscapes. It defines the Animal agent type, and a set of macros that can be used to rapidly create new species. It also includes ecological process functions that are useful for all species.\nfarm: This is an agent-based model of farmer decision making. It is not yet implemented, but will provide the Farmer agent type.\ncrop: This is a mathematical growth model for various crops. It is not yet implemented, but already provides the agent type FarmPlot, representing one field and its associated extent and crop type.","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"Conceptually, core provides functionality that is needed by all of the submodels. Decisions made by Farmers affect the FarmPlots they own, and (directly or indirectly) the Animals in the model landscape.","category":"page"},{"location":"architecture.html#Important-implementation-details","page":"Source code architecture","title":"Important implementation details","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"(Image: \"the model object\")","category":"page"},{"location":"architecture.html#The-model-object","page":"Source code architecture","title":"The model object","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"A cursory reading of the source code will quickly show that most functions take an SimulationModel object as one of their arguments. The concrete type for this is AgricultureModel, a struct that holds all state that is in any way relevant to a simulation run. (Persefone has a strict \"no global state\" policy to avoid state-dependent bugs and allow parallelisation.) The model object gives access to all agent instances. It also stores the configuration (model.settings), the landscape (model.landscape, a matrix of Pixel objects that store the local land cover, amongst other things), and the current simulation date (model.date). (See Persefone.initmodel for details.)","category":"page"},{"location":"architecture.html#Model-configuration/the-@param-macro","page":"Source code architecture","title":"Model configuration/the @param macro","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"The model is configured via a TOML file, the default version of which is at src/parameters.toml. An individual run can be configured using a user-defined configuration file, commandline arguments, or function calls (when Persefone is used as a package rather than an application). During a model run, the @param macro can be used to access parameter values. Note that parameter names are prepended with the name of the component they are associated with. For example, the outdir parameter belongs to the [core] section of the TOML file, and must therefore be referenced as @param(core.outdir). (See src/core/input.jl for details.)","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"info: @param and other macros\nAs @param(parameter) expands to model.settings[\"parameter\"], it can obviously only be used in a context where the model object is actually available. (This is the case for most functions in Persefone, but not for all.) Similarly, many of the nature macros depend on specific variables being available where they are called, and can therefore only be used in specific contexts (this is indicated in their documentation).","category":"page"},{"location":"architecture.html#Output-data","page":"Source code architecture","title":"Output data","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"Persefone can output model data into text files with a specified frequency (daily, monthly, yearly, or at the simulation end). Submodels can use Persefone.newdataoutput! to plug into this system. For an example of how to use this, see src/nature/ecologicaldata.jl. (See src/core/output.jl for details.)","category":"page"},{"location":"architecture.html#Farm-events","page":"Source code architecture","title":"Farm events","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"The FarmEvent struct is used to communicate farming-related events between submodels. An event can be triggered with createevent! and affects all pixels within a FarmPlot. (See src/core/landscape.jl for details.)","category":"page"},{"location":"architecture.html#Random-numbers-and-logging","page":"Source code architecture","title":"Random numbers and logging","text":"","category":"section"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"By default in Julia, the random number generator (RNG) and the system logger are two globally accessible variables. As Persefone needs to avoid all global data (since this would interfere with reproducibility in parallel runs), the model object stores a local logger and a local RNG. The local logger generally does not change the way the model uses log statements, it is only relevant for some functions in src/core/simulation.jl.","category":"page"},{"location":"architecture.html","page":"Source code architecture","title":"Source code architecture","text":"info: Using the model RNG\nWhenever you need to use a random number, you must use the model.rng. The easiest way to do this is with the @rand and @shuffle! macros. (Note that these, too, require access to the model object.)","category":"page"},{"location":"skylark.html#Skylark","page":"Skylark","title":"Skylark","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Alauda arvensis is a common and charismatic species of agricultural landscapes. This animal model is one component of the nature submodel of Persefone.jl.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The model description follows the ODD (Overview, Design concepts, Details) protocol (Grimm et al., 2006; 2010; 2020):","category":"page"},{"location":"skylark.html#.-Purpose","page":"Skylark","title":"1. Purpose","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The purpose of this animal model is to simulate the abundance and distribution of a population of Alauda arvensis in response to farm management in Central European agricultural landscapes.","category":"page"},{"location":"skylark.html#.-Entities,-state-variables,-and-scales","page":"Skylark","title":"2. Entities, state variables, and scales","text":"","category":"section"},{"location":"skylark.html#.1-Landscape","page":"Skylark","title":"2.1 Landscape","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The simulated landscape consists of a grid of pixels with a resolution of 10m and can have an extent of 20km²-200km² (approximately; depending on the chosen input map). Each pixel is assigned a land cover class. It may also be associated with a farm plot, in which case it will contain information about the type and growth stage of the crop planted here. Farm management determines which crops are grown when, and when disturbance (e.g. mowing, harvesting, tillage) takes place.","category":"page"},{"location":"skylark.html#.2-Animals","page":"Skylark","title":"2.2 Animals","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The simulated individuals (a.k.a. agents) are mature skylarks. Each skylark is characterised by the following variables:","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"ID A unique identifier for this individual, which can be used to link it to its parents and its offspring.\nsex Male or female.\nphase The individual's current stage in the annual/life cycle. May be one of: migration, nonbreeding, territorysearch, occupation, matesearch, nesting, breeding.\nposition The individual's position in the simulated landscape.\nmate The ID of the individual with which this individual has mated this year, if any.\nterritory A list of coordinates of the positions in the landscape that this individual claims as its nesting and feeding territory.\nnest A coordinate giving the location of the currently active nest.\nclutch The number of juvenile (i.e. not yet independent) skylarks that this individual is currently raising.","category":"page"},{"location":"skylark.html#.-Process-overview-and-scheduling","page":"Skylark","title":"3. Process overview and scheduling","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The simulation proceeds in time steps of one day. Every day, each individual executes the function associated with their current life phase:","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"migration: The individual is held in a separate data structure (apart from the model landscape) and does nothing until its return date is reached. Then, it is re-introduced to the landscape and assigned the phase territorysearch (for males) or matesearch (for females).\nterritorysearch: Males return first from migration. If they already have a territory from a previous year, they return to this. Otherwise, they move randomly through the landscape until they find a contiguous territory that satisfies their habitat requirements. Once a male has a territory, it changes its phase to occupation.\nmatesearch: Females return later than males from their winter migration. If they already had a partner the previous year, they have a given probability of remaining with this partner. Otherwise, they move randomly through the landscape, looking for a male with a territory and without a partner. Once the female has a partner, it changes its phase to nesting.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"If an individual fails to find a territory or a mate, it changes its phase to nonbreeding once the breeding season is over.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"occupation: The male moves at random about its territory until the breeding season is over. Then it changes its phase to nonbreeding. (Note: Skylark males actively help with feeding their chicks. However, feeding is only modelled indirectly here, through the process of habitat selection when the male forms its territory - see section 4.1.)\nnesting: The female selects a suitable location within the male's territory for the nest. Building the nest and laying eggs takes a number of days, during which she does nothing else. Then, she changes her phase to breeding.\nbreeding: The female checks for mortality. The probability of brood loss varies with the age of the clutch and the nesting habitat. If and when the chicks reach independence (30 days after hatching), they are instantiated as new individuals in the nonbreeding phase.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"If a nest fails due to predation or disturbance, or a brood leaves the nest successfully, the female resets her phase to nesting and begins again if the breeding season is not yet over. If it is, she changes her phase to nonbreeding.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"nonbreeding: Non-breeding mature birds move randomly around the landscape, keeping close to other individuals (flocking behaviour). Once their individual migration date is reached, they are removed from the landscape until the following year (see above). Mature birds have a mortality probability for their first summer, and others thereafter for each winter.","category":"page"},{"location":"skylark.html#.-Design-concepts","page":"Skylark","title":"4. Design concepts","text":"","category":"section"},{"location":"skylark.html#.1-Basic-principles","page":"Skylark","title":"4.1 Basic principles","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"This model assumes that the two most important drivers of skylark distribution and abundance are habitat availability and juvenile mortality (see literature below). The factors and processes affecting these are therefore given the most attention in the model, while other factors and processes are only included superficially, indirectly, or not at all. Specifically, this means that the phases territorysearch, nesting, and breeding are the most relevant and detailed parts of the model, as these determine the selection of habitat and the survival of offspring.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Furthermore, the model concentrates on predation and anthropogenic disturbance (through management actions such as mowing) as the main causes of juvenile mortality. Other causes, such as hunger or bad weather, are currently ignored as they are usually not significant.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The focus on habitat availability and juvenile mortality opens up two avenues by which agricultural management influences skylark populations. First, the farmers' choice of crops and date of sowing determines the quality of the habitat when skylarks select a territory. (For example, unlike summer grain, winter grain is already so high and dense in spring that it is generally avoided for nesting.) Secondly, the frequency and timing of management actions (especially mowing) is a major cause of brood loss. This means that there are direct causal links between agriculture and population trends.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Concentrating on these two drivers allows the rest of the model to be kept simple, reducing both the scientific complexity and computational costs. Thus, foraging movement (both during and after the breeding season) can be ignored or represented as random movement, as it does not directly impact either of the drivers. Likewise, chick growth and winter migration are represented very simply.","category":"page"},{"location":"skylark.html#.2-Emergence","page":"Skylark","title":"4.2 Emergence","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Multiple patterns emerge from the basic principles outlined above. The most important are listed here:","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Territory size and population density: The model assumes that skylarks occupy only as much area as they need to satisfy their nesting and foraging requirements, and that population size is limited by the amount of available habitat. This means that territories in high-quality habitat are smaller than in low-quality habitat. Scaling up, this leads to a pattern whereby population densities are highest in open landscapes with a diversity of crops, grassland, semi-natural habitat, and lower in landscapes with low habitat diversity or many woody features.\nEcological traps: Jenny (1990) describes a strong ecological trap effect whereby skylarks avoid winter grain crops, preferentially nesting in more open grassland sites. However, the mowing frequency associated with modern agriculture means that nest loss in grassland is almost assured, since there is insufficient time between two mowing dates to raise a brood. This means that landscape composition leads skylarks to breed in habitats that have a high mortality, resulting in population declines.","category":"page"},{"location":"skylark.html#.3-Adaptation","page":"Skylark","title":"4.3 Adaptation","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"In the model, skylarks primarily adapt to their surroundings by choosing suitable territories. These are chosen by evaluating the quality of surrounding habitats for breeding and foraging, and occupying as much area as needed to satisfy requirements (see section 7.1).","category":"page"},{"location":"skylark.html#.4-Objectives","page":"Skylark","title":"4.4 Objectives","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Skylarks' main objective in the model is to have sufficient habitat available to raise a brood. Habitat quality is calculated as a function of habitat type, vegetation height, vegetation cover, and distance to vertical structures (see section 7.1).","category":"page"},{"location":"skylark.html#.5-Learning","page":"Skylark","title":"4.5 Learning","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The model includes no learning by individuals.","category":"page"},{"location":"skylark.html#.6-Prediction","page":"Skylark","title":"4.6 Prediction","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The model includes no predictions by individuals.","category":"page"},{"location":"skylark.html#.7-Sensing","page":"Skylark","title":"4.7 Sensing","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Skylarks can perceive the landscape structure in a given radius around them (habitat type, vegetation height and cover). They can also see nearby conspecifics and are aware of the territories claimed by other individuals. When mating, they recognise whether another individual already has a mate, and mated individuals share information about their territory and brood status.","category":"page"},{"location":"skylark.html#.8-Interaction","page":"Skylark","title":"4.8 Interaction","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The model includes two direct forms of interaction. First, during mating, females move around the landscape looking for males who have a territory but no mate yet. Once they have found one, the two individuals set each other as their mate. Secondly, after the breeding seasons, individuals move around the landscape, keeping close to other individuals in their vicinity (flocking behaviour).","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"There are also indirect interactions, in that there is a competition for habitat (territory that has been claimed by one male cannot be occupied by another) and males (males that have mated with one female will not mate with another in the same season).","category":"page"},{"location":"skylark.html#.9-Stochasticity","page":"Skylark","title":"4.9 Stochasticity","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Stochasticity is used when modelling mortality and movement. Predation mortality is modelled as an age- and habitat-dependent probability, while migration mortality is a simple probability. Dispersal movement (when searching for a territory or a mate) is modelled as a random walk, as it is assumed that skylarks are not significantly impeded in their long-range movement by habitats that are unsuitable for foraging or nesting. Foraging movement by the male and by non-breeding individuals is also random, as it is desirable to show movement (to help model analysis) but unimportant to model this exactly.","category":"page"},{"location":"skylark.html#.10-Collectives","page":"Skylark","title":"4.10 Collectives","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"After the breeding season, skylarks move around in loose agglomerations (flocking behaviour). However, this has no relevant ecological effect.","category":"page"},{"location":"skylark.html#.11-Observation","page":"Skylark","title":"4.11 Observation","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"TODO","category":"page"},{"location":"skylark.html#.-Initialisation","page":"Skylark","title":"5. Initialisation","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"At the beginning of a model run, pairs of skylarks are created on grassland and agricultural land, keeping a distance of 60m to vertical structures and allowing each pair approximately 3ha of suitable habitat (an average territory size in agricultural landscapes).","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"For details, see the source code and the associated documentation.","category":"page"},{"location":"skylark.html#.-Input-data","page":"Skylark","title":"6. Input data","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The general input to Persefone (i.e. land use maps and weather data) is described here.","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"The following extract from the source code lists the species parameters and values used by the Skylark model, based on the literature cited below:","category":"page"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"@species Skylark begin\n const movementrange::Length = 500m #XXX arbitrary\n const visionrange::Length = 200m #XXX arbitrary\n \n const eggtime::Int64 = 11 # days from laying to hatching\n const nestlingtime::Int64 = 9 # days from hatching to leaving nest\n const fledglingtime::Int64 = 21 # days from leaving the nest to independence\n\n #XXX predation mortality should be habitat-dependent\n const eggpredationmortality::Float64 = 0.03 # per-day egg mortality from predation\n const nestlingpredationmortality::Float64 = 0.03 # per-day nestling mortality from predation\n const fledglingpredationmortality::Float64 = 0.01 # per-day fledgling mortality from predation\n const firstyearmortality::Float64 = 0.38 # total mortality in the first year after independence\n const migrationmortality::Float64 = 0.33 # chance of dying during the winter\n\n const minimumterritory = 5000m² # size of territory under ideal conditions\n const mindistancetoedge = 60m # minimum distance of habitat to vertical structures\n const maxforageheight = 50cm # maximum preferred vegetation height for foraging\n const maxforagecover = 0.7 # maximum preferred vegetation cover for foraging\n const nestingheight = (15cm, 25cm) # min and max preferred vegetation height for nesting\n const nestingcover = (0.2, 0.5) # min and max preferred vegetation cover for nesting\n\n const matefaithfulness = 0.5 # chance of a female retaining her previous partner\n const nestingbegin::Tuple{Int64,Int64} = (April, 10) # begin nesting in the middle of April\n const nestbuildingtime::UnitRange{Int64} = 4:5 # 4-5 days needed to build a nest (doubled for first nest)\n const eggsperclutch::UnitRange{Int64} = 2:5 # eggs laid per clutch\n const nestingend::Int64 = July # last month of nesting\nend","category":"page"},{"location":"skylark.html#.-Submodels","page":"Skylark","title":"7. Submodels","text":"","category":"section"},{"location":"skylark.html#.1-Territory-formation","page":"Skylark","title":"7.1 Territory formation","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"TODO","category":"page"},{"location":"skylark.html#.2-Juvenile-mortality","page":"Skylark","title":"7.2 Juvenile mortality","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"TODO","category":"page"},{"location":"skylark.html#.-References","page":"Skylark","title":"8. References","text":"","category":"section"},{"location":"skylark.html","page":"Skylark","title":"Skylark","text":"Bauer, H.-G., Bezzel, E., & Fiedler, W. (Eds.). (2012). Das Kompendium der Vögel Mitteleuropas: Ein umfassendes Handbuch zu Biologie, Gefährdung und Schutz (Einbändige Sonderausg. der 2., vollständig überarb. und erw. Aufl. 2005). AULA-Verlag\nDelius, J. D. (1965). A Population Study of Skylarks Alauda Arvensis. Ibis, 107(4), 466–492.\nDonald et al. (2002). Survival rates, causes of failure and productivity of Skylark Alauda arvensis nests on lowland farmland. Ibis, 144(4), 652–664.\nGlutz von Blotzheim, Urs N. (Ed.). (1985). Handbuch der Vögel Mitteleuropas. Bd. 10. Passeriformes (Teil 1) 1. Alaudidae - Hirundidae. AULA-Verlag, Wiesbaden. ISBN 3-89104-019-9\nJenny, M. (1990). Territorialität und Brutbiologie der Feldlerche Alauda arvensis in einer intensiv genutzten Agrarlandschaft. Journal für Ornithologie, 131(3), 241–265.\nJeromin, K. (2002). Zur Ernährungsökologie der Feldlerche (Alauda arvensis L. 1758) in der Reproduktionsphase [Doctoral thesis]. Christian-Albrechts-Universität zu Kiel.\nPüttmanns et al. (2022). Habitat use and foraging parameters of breeding Skylarks indicate no seasonal decrease in food availability in heterogeneous farmland. Ecology and Evolution, 12(1), e8461.","category":"page"},{"location":"species.html#Species-models","page":"Species models","title":"Species models","text":"","category":"section"},{"location":"species.html","page":"Species models","title":"Species models","text":"The ecological submodel in Persefone simulates a range of species in agricultural landscapes.","category":"page"},{"location":"species.html#Skylark","page":"Species models","title":"Skylark","text":"","category":"section"},{"location":"species.html","page":"Species models","title":"Species models","text":"Modules = [Persefone]\nPages = [\"nature/species/skylark.jl\"]","category":"page"},{"location":"species.html#Persefone.Skylark","page":"Species models","title":"Persefone.Skylark","text":"Skylark\n\nAlauda arvensis is a common and charismatic species of agricultural landscapes.\n\nSources: - Bauer, H.-G., Bezzel, E., & Fiedler, W. (Eds.). (2012). Das Kompendium der Vögel Mitteleuropas: Ein umfassendes Handbuch zu Biologie, Gefährdung und Schutz (Einbändige Sonderausg. der 2., vollständig überarb. und erw. Aufl. 2005). AULA-Verlag - Delius, J. D. (1965). A Population Study of Skylarks Alauda Arvensis. Ibis, 107(4), 466–492. https://doi.org/10.1111/j.1474-919X.1965.tb07332.x - Donald et al. (2002). Survival rates, causes of failure and productivity of Skylark Alauda arvensis nests on lowland farmland. Ibis, 144(4), 652–664. https://doi.org/10.1046/j.1474-919X.2002.00101.x - Glutz von Blotzheim, Urs N. (Ed.). (1985). Handbuch der Vögel Mitteleuropas. Bd. 10. Passeriformes (Teil 1) 1. Alaudidae - Hirundidae. AULA-Verlag, Wiesbaden. ISBN 3-89104-019-9 - Jenny, M. (1990). Territorialität und Brutbiologie der Feldlerche Alauda arvensis in einer intensiv genutzten Agrarlandschaft. Journal für Ornithologie, 131(3), 241–265. https://doi.org/10.1007/BF01640998 - Püttmanns et al. (2022). Habitat use and foraging parameters of breeding Skylarks indicate no seasonal decrease in food availability in heterogeneous farmland. Ecology and Evolution, 12(1), e8461. https://doi.org/10.1002/ece3.8461\n\n\n\n\n\n","category":"type"},{"location":"species.html#Persefone.#898#fun","page":"Species models","title":"Persefone.#898#fun","text":"Initialise the skylark population. Creates pairs of skylarks on grassland and agricultural land, keeping a distance of 60m to vertical structures and giving each pair an area of 3ha.\n\n\n\n\n\n","category":"function"},{"location":"species.html#Persefone.allowsnesting-Tuple{Persefone.Skylark, SimulationModel, Tuple{Int64, Int64}}","page":"Species models","title":"Persefone.allowsnesting","text":"allowsnesting(skylark, model, pos)\n\nCheck whether the given position is suitable for nesting.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.breeding-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.breeding","text":"Females that have laid eggs take care of their chicks, restarting the nesting process once the chicks are independent or in case of brood loss.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.create!-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.create!","text":"Initialise a skylark individual. Selects migration dates and checks if the bird should currently be on migration. Also sets other individual-specific variables.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.destroynest!-Tuple{Persefone.Skylark, String}","page":"Species models","title":"Persefone.destroynest!","text":"destroynest!(skylark, reason)\n\nRemove the skylark's nest and offspring due to disturbance or predation.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.findterritory-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.findterritory","text":"findterritory(skylark, model)\n\nCheck whether the habitat surrounding the skylark is suitable for establishing a territory. If it is, return the list of coordinates that make up the new territory, else return an empty list.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.foragequality-Tuple{Persefone.Skylark, SimulationModel, Tuple{Int64, Int64}}","page":"Species models","title":"Persefone.foragequality","text":"foragequality(skylark, model, pos)\n\nCalculate the relative quality of the habitat at this position for foraging. This assumes that open habitat is best (quality = 1.0), and steadily decreases as vegetation height and/or cover increase. (Linear regressions based on Püttmanns et al., 2021; Jeromin, 2002; Jenny, 1990b.)\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.matesearch-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.matesearch","text":"Females returning from migration move around to look for a suitable partner with a territory.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.migrationdates-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.migrationdates","text":"migrationdates(skylark, model)\n\nSelect the dates on which this skylark will leave for / return from its migration, based on observed migration patterns.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.nesting-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.nesting","text":"Females that have found a partner build a nest and lay eggs in a suitable location.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.nonbreeding-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.nonbreeding","text":"Non-breeding adults move around with other individuals and check for migration.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.occupation-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.occupation","text":"Once a male has found a territory, he remains in it until the breeding season is over, adjusting it to new conditions when and as necessary.\n\n\n\n\n\n","category":"method"},{"location":"species.html#Persefone.territorysearch-Tuple{Persefone.Skylark, SimulationModel}","page":"Species models","title":"Persefone.territorysearch","text":"Males returning from migration move around to look for suitable habitats to establish a territory.\n\n\n\n\n\n","category":"method"},{"location":"species-dsl.html#Defining-new-species","page":"Defining new species","title":"Defining new species","text":"","category":"section"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"In order to make implementing new species as easy as possible, Persefone includes a domain-specific language (DSL) built from a collection of macros and functions.","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"Here is an example of what this looks like, using a hypothetical mermaid species:","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"@species Mermaid begin\n ageofmaturity = 2\n pesticidemortality = 1.0\nend\n\n@create Mermaid begin\n @debug \"Created $(animalid(self)).\"\nend\n\n@phase Mermaid life begin\n @debug \"$(animalid(self)) is swimming happily in its pond.\"\n @respond pesticide @kill(self.pesticidemortality, \"poisoning\")\n @respond harvesting @setphase(drought)\n if self.sex == female && length(@neighbours()) < 3 &&\n self.age >= self.ageofmaturity && @landcover() == water\n @reproduce()\n end\nend\n\n@phase Mermaid drought begin\n n = sum(1 for a in @neighbours())\n @debug \"$(animalid(self)) is experiencing drought with $n neighbour(s).\"\n @respond sowing @setphase(life)\nend\n\n@populate Mermaid begin\n birthphase = life\n initphase = life\n habitat = @habitat(@landcover() == water)\n pairs=true\nend","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"A complete species definition consists of one call each to @species, @create, @populate, and one or more calls to @phase. Another important macro is @habitat. Further macros are available to provide convenience wrappers for common functions. (See src/nature/nature.jl for details.)","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"The first macro to call is @species. This takes two arguments: a species name and a definition block (enclosed in begin and end tags). Within the block, species-specific parameters and variables can be defined (and optionally given values) that should be available throughout a species' lifetime. ","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"Next, each species must define one or more @phase blocks. The concept behind this is that species show different behaviours at different phases of their lifecycle. Each @phase block defines the behaviour in one of these phases. (Technically, it defines a function that will be called daily, so long as the species' phase variable is set to this phase.) Code in this section has access to the model object as well as a self object, which is the currently active Animal agent. Within a phase block, @respond can be used to define the species' response to a FarmEvent that affects the species' current location, while a variety of other macros provide wrappers to life history and movement functions from src/nature/populations.jl.","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"The third macro to call is @create. Like @phase, this defines a function with access to the world and self objects. This function is called whenever a new individual of this species is created (either at birth, or when the model is initialised).","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"The last macro that must be called is [@populate]. Whereas @create regulates the creation of individual animals, @populate determines how the population of a species is initialised at the start of a simulation. It does this by defining values for the parameters used by initpopulation!. The full list of parameters that can be used is documented under PopInitParams.","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"The final important macro is @habitat. This defines a \"habitat descriptor\", i.e. a predicate function that tests whether or not a given landscape pixel is suitable for a specified purpose. Such habitat descriptors are used as arguments to various functions, for example for population initialisation or movement. The argument to @habitat consists of a logical expression, which has access to the animal's current position (the pos tuple variable) and the model. Various macros are available to easily reference information about the current location, such as @landcover or @distancetoedge.","category":"page"},{"location":"species-dsl.html","page":"Defining new species","title":"Defining new species","text":"All of these macros are defined in src/nature/macros.jl.","category":"page"},{"location":"CHANGELOG.html#Changelog","page":"Changelog","title":"Changelog","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"All notable changes to this project will be documented in this file.","category":"page"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.","category":"page"},{"location":"CHANGELOG.html#[1.0.0]-in-planning","page":"Changelog","title":"[1.0.0] - in planning","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Aim: 3 species, 2 crop growth models, farm model, GAEC scenarios, experimental analysis","category":"page"},{"location":"CHANGELOG.html#[0.6.0]-in-planning","page":"Changelog","title":"[0.6.0] - in planning","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Plan: integrate AquaCrop (#79), set up first experiments","category":"page"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"","category":"page"},{"location":"CHANGELOG.html#[0.5.4]-in-planning","page":"Changelog","title":"[0.5.4] - in planning","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Plan: basic farm model (#16), decouple CairoMakie (#81), test Skylark model (#96, #97)","category":"page"},{"location":"CHANGELOG.html#[0.5.3]-unreleased","page":"Changelog","title":"[0.5.3] - unreleased","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Plan: code restructuring to allow multiple crop models (#70)","category":"page"},{"location":"CHANGELOG.html#Added","page":"Changelog","title":"Added","text":"","category":"section"},{"location":"CHANGELOG.html#Changed","page":"Changelog","title":"Changed","text":"","category":"section"},{"location":"CHANGELOG.html#Deprecated","page":"Changelog","title":"Deprecated","text":"","category":"section"},{"location":"CHANGELOG.html#Removed","page":"Changelog","title":"Removed","text":"","category":"section"},{"location":"CHANGELOG.html#Fixed","page":"Changelog","title":"Fixed","text":"","category":"section"},{"location":"CHANGELOG.html#[0.5.2]-30-07-2024","page":"Changelog","title":"[0.5.2] - 30-07-2024","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Rewrote the skylark model","category":"page"},{"location":"CHANGELOG.html#Added-2","page":"Changelog","title":"Added","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Skylark model is largely rewritten to follow a new phase structure (#9)\nanimals can occupy territories (see @occupy, @isoccupied, @vacate macros/functions) (#94)\n@cropcover macro and function\nODD documentation for Skylark","category":"page"},{"location":"CHANGELOG.html#Changed-2","page":"Changelog","title":"Changed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"input files that are now copied to a separate inputs directory within the output directory\nEventType renamed to Management for clarity\ndocumentation website now has a \"Scientific Documentation\" section","category":"page"},{"location":"CHANGELOG.html#Removed-2","page":"Changelog","title":"Removed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"old skylark model (has been rewritten, see above)","category":"page"},{"location":"CHANGELOG.html#Fixed-2","page":"Changelog","title":"Fixed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"all skylarks now migrate (#90)\ninsectbiomass() uses units","category":"page"},{"location":"CHANGELOG.html#[0.5.1]-13-06-2024","page":"Changelog","title":"[0.5.1] - 13-06-2024","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Added Unitful.jl","category":"page"},{"location":"CHANGELOG.html#Added-3","page":"Changelog","title":"Added","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Unitful.jl now used to add units to quantities\nworld.mapdirectory parameter specifies the path to the directory in which","category":"page"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"landcovermap, farmfieldsmap, and weatherfile are located","category":"page"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"world.mapresolution parameter specifies the input maps' spatial resolution in meters","category":"page"},{"location":"CHANGELOG.html#Changed-3","page":"Changelog","title":"Changed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"spatial functions now work with explicit distances (using Unitful.jl) rather than using the number of pixels\nall species definitions and tests updated to use units","category":"page"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"","category":"page"},{"location":"CHANGELOG.html#[0.5.0]-07-06-2024","page":"Changelog","title":"[0.5.0] - 07-06-2024","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"This release doesn't add much new functionality, but represents a major restructuring of the code base. Specifically, it removes the Agents.jl dependency and changes the way the species definition macros work and are used.","category":"page"},{"location":"CHANGELOG.html#Added-4","page":"Changelog","title":"Added","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"SimulationModel type, extended by AgricultureModel struct\n@create macro defines a special phase function that is called when an individual animal is created (at birth or on model initialisation)\nfunctions (and associated macros) to replace Agents.jl functionality:\nmove!() and walk!() \nnearby_ids(), nearby_animals(), countanimals(), neighbours()\ndirectionto(), distanceto(), randomdirection()\nnagents(), killallanimals!()\n@here macro to return the pixel currently occupied by the active animal\ncore.logoutput parameter to define whether logs are printed to screen, file, none, or both\nlarge logo and model structure diagram\nChangelog","category":"page"},{"location":"CHANGELOG.html#Changed-4","page":"Changelog","title":"Changed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"SimulationModel replaces AgentBasedModel\nSpecies definition macros revamped:\n@species now only defines parameters and variables and creates a mutable struct\n@phase must now be defined in the top-level code and creates a global function\n@initialise renamed to @populate, must also be called in the top-level code\ninitindividual() renamed to create!()\nSkylark, Wolpertinger, and Wyvern updated to match the new macros\nrequires Julia 1.10","category":"page"},{"location":"CHANGELOG.html#Removed-3","page":"Changelog","title":"Removed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Agents.jl dependency (including AgentBasedModel and functions for adding/moving/removing agents)","category":"page"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"","category":"page"},{"location":"CHANGELOG.html#[0.4.1]-2023-11-14","page":"Changelog","title":"[0.4.1] - 2023-11-14","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Initial version of the skylark model","category":"page"},{"location":"CHANGELOG.html#Added-5","page":"Changelog","title":"Added","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"initial version of the Skylark species\nsmall Jena map\nanimal individuals keep track of their parents' IDs\nseveral new functions and macros for animals\ninstallation instructions for Windows","category":"page"},{"location":"CHANGELOG.html#Changed-5","page":"Changelog","title":"Changed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"graphics output is more configurable","category":"page"},{"location":"CHANGELOG.html#[0.4.0]-2023-10-28","page":"Changelog","title":"[0.4.0] - 2023-10-28","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Functions for animal populations","category":"page"},{"location":"CHANGELOG.html#Added-6","page":"Changelog","title":"Added","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"initialisation functions for individuals (not just species)\nmigration function / migrant pool for animals that disappear from the landscape during winter\nskylark migration","category":"page"},{"location":"CHANGELOG.html#Changed-6","page":"Changelog","title":"Changed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"online documentation was expanded and restructured\nnature macros moved to a separate file","category":"page"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"Started changelog at this point, earlier versions are not included.","category":"page"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"<!– Template","category":"page"},{"location":"CHANGELOG.html#[version]-unreleased","page":"Changelog","title":"[version] - unreleased","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"<comments>","category":"page"},{"location":"CHANGELOG.html#*PLANNED*","page":"Changelog","title":"PLANNED","text":"","category":"section"},{"location":"CHANGELOG.html#Added-7","page":"Changelog","title":"Added","text":"","category":"section"},{"location":"CHANGELOG.html#Changed-7","page":"Changelog","title":"Changed","text":"","category":"section"},{"location":"CHANGELOG.html#Deprecated-2","page":"Changelog","title":"Deprecated","text":"","category":"section"},{"location":"CHANGELOG.html#Removed-4","page":"Changelog","title":"Removed","text":"","category":"section"},{"location":"CHANGELOG.html#Fixed-3","page":"Changelog","title":"Fixed","text":"","category":"section"},{"location":"CHANGELOG.html","page":"Changelog","title":"Changelog","text":"–>","category":"page"},{"location":"developing.html#Developing-Persefone","page":"Developing Persefone","title":"Developing Persefone","text":"","category":"section"},{"location":"developing.html#Setting-up","page":"Developing Persefone","title":"Setting up","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"If you haven't worked with Julia before, here are detailed instructions for how to set up your development environment. The main development is currently done on Linux (and as the primary execution platform will be an HPC, Linux compatibility is important), but developing on Windows works too.","category":"page"},{"location":"developing.html#Visual-Studio-Code-on-Windows","page":"Developing Persefone","title":"Visual Studio Code on Windows","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Download and install Julia, git and Visual Studio Code.\nInstall the Julia extension for VS Code: In VS Code, open the extensions pane (Ctrl+Shift+X). Search for and install Julia Language Support.\nClone the Gitlab repository: In VS Code, open the source control pane (Ctrl+Shift+G). Click on Clone and enter the repo URL. Then select a folder on your computer to download the files into, and let VS Code open the project once it has been cloned.\nStart a Julia REPL: In VS Code, bring up the command palette (Ctrl+Shift+P). Execute the command Julia: Start REPL. Then install all dependencies of Persefone by running using Pkg; Pkg.activate(\".\"); Pkg.instantiate(). (This will take some time.)\nOpen the file run.jl and click Execute (triangular button in the top right). The source code will compile (this can take a lot of time the first time you do it) and run a default simulation.\nFurther steps: You may want to familiarise yourself with how to use git with VS Code. You may also want to clone the Persefone Desktop repository (repeat steps 3 to 5).","category":"page"},{"location":"developing.html#Emacs-on-Linux","page":"Developing Persefone","title":"Emacs on Linux","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"You can of course also use VS Code on Linux. In that case, follow the instructions above.","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Make sure you have git and Julia installed. Git should be in your distro's repos (e.g. sudo apt install git). To install Julia, download the binary and unpack it. For greater ease of use, copy the unpacked files to /usr/local/lib/julia (or similar) and create a symlink to the executable: sudo ln -s /usr/local/lib/julia/bin/julia /usr/local/bin/julia. Then go the to folder that you want to use for development and run git clone https://git.idiv.de/persefone/persefone-model.git . in your terminal.","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"There are a couple of addons that make working with Julia much nicer in Emacs:","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"julia-mode gives syntax highlighting. Install with M-x package-install julia-mode.\njulia-snail provides IDE-like features, especially a fully-functional REPL and the ability to evaluate code straight from inside a buffer. Note that the installation can be somewhat tricky. You first need to manually install all the dependencies of its dependency vterm, then install vterm itself with M-x package-install vterm, before you can do M-x package-install julia-snail. Then add it to your init.el with (require 'julia-snail) and (add-hook 'julia-mode-hook #'julia-snail-mode).\ncompany-mode integrates with Snail to give code completion. Install with M-x package-install company, then add (add-hook 'julia-mode-hook #'company-mode) and (global-set-key (kbd \"C-<tab>\") 'company-complete) to your init.el.\nmagit is a great git interface for Emacs. Install with M-x package-install magit and add (global-set-key (kbd \"C-x g\") 'magit-status) to your init.el.","category":"page"},{"location":"developing.html#Development-workflow","page":"Developing Persefone","title":"Development workflow","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Pull the current version from the master branch on Gitlab: https://git.idiv.de/persefone/persefone-model.\nIf you are working on a new feature, create a new branch to avoid breaking the master branch. (The master branch on Github should always be in a runnable and error-free state.)\nImplement your changes.\nRun an example simulation and the test suite to make sure everything works without crashing (make run and make test on Linux, or execute run.jl and test/runtests.jl manually.)\nCommit your work frequently, and try to keep each commit small. Don't forget to add relevant tests to the test suite.\nOnce your satisfied with your work, do another pull/merge from the master branch in case somebody else changed the branch in the meantime. Then merge your work into master and push to the Gitlab server.\nRepeat :-)","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"The Gitlab issue tracker can be used to create, discuss, and assign tasks, as well as to monitor progress towards milestones/releases. Once we have a first release, we will start using semantic versioning and a changelog.","category":"page"},{"location":"developing.html#Important-libraries","page":"Developing Persefone","title":"Important libraries","text":"","category":"section"},{"location":"developing.html#Revise.jl","page":"Developing Persefone","title":"Revise.jl","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Revise.jl allows one to reload code without restarting the Julia interpreter. Get it with Pkg.add(\"Revise\"), then add using Revise to .julia/config/startup.jl to have it automatically available.","category":"page"},{"location":"developing.html#Test","page":"Developing Persefone","title":"Test","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Persefone uses the inbuilt Julia testing framework. All new functions should have appropriate tests written for them in the appropriate file in the test directory. (See test/runtests.jl for details.) There are three ways to run the test suite: in the terminal, executing make test or cd test; julia runtests.jl; or in the Julia REPL, Pkg.activate(\".\"); Pkg.test().","category":"page"},{"location":"developing.html#Documenter.jl","page":"Developing Persefone","title":"Documenter.jl","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"The HTML documentation is generated using Documenter.jl. Therefore, all new functions should have docstrings attached. New files need to be integrated into the relevant documentation source files in docs/src, and if necessary into docs/builddocs.jl. To build the documentation, run make docs, or cd docs; julia builddocs.jl (if using the latter, don't forget to update the date and commit in docs/src/index.md).","category":"page"},{"location":"developing.html#Graphics-and-user-interface","page":"Developing Persefone","title":"Graphics and user interface","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Persefone uses Makie as a plotting library to generate its output graphics. Additionally, Persefone Desktop uses QML.jl to create its graphical user interface.","category":"page"},{"location":"developing.html#Unitful.jl","page":"Developing Persefone","title":"Unitful.jl","text":"","category":"section"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Throughout the source code, variables can be tagged with their appropriate units using the Unitful.jl library. This makes the code easier to understand, and also allows automatic unit conversion:","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"julia> 1ha == 10000m²\ntrue\n\njulia> 2km |> m\n2000 m\n\njulia> 2km / 10m\n200.0","category":"page"},{"location":"developing.html","page":"Developing Persefone","title":"Developing Persefone","text":"Within Persefone, the following units and dimensions have been imported for direct usage: cm, m, km, m², ha, km², mg, g, kg, Length, Area, Mass.","category":"page"},{"location":"simulation.html#Simulation","page":"Simulation","title":"Simulation","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"The core and world directories hold source files that are important for all submodels, including scheduling, landscape, weather, and input/output functions.","category":"page"},{"location":"simulation.html#Persefone.jl","page":"Simulation","title":"Persefone.jl","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"This file defines the module, including all exported symbols and two high-level types.","category":"page"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"Modules = [Persefone]\nPages = [\"Persefone.jl\"]","category":"page"},{"location":"simulation.html#Persefone.ModelAgent","page":"Simulation","title":"Persefone.ModelAgent","text":"ModelAgent\n\nThe supertype of all agents in the model (animal species, farmer types, farmplots).\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.SimulationModel","page":"Simulation","title":"Persefone.SimulationModel","text":"SimulationModel\n\nThe supertype of AgricultureModel. This is needed to avoid circular dependencies (most types and functions depend on SimulationModel, but the definition of the model struct depends on these types).\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#simulation.jl","page":"Simulation","title":"simulation.jl","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"This file includes the basal functions for initialising and running simulations.","category":"page"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"Modules = [Persefone]\nPages = [\"core/simulation.jl\"]","category":"page"},{"location":"simulation.html#Persefone.AgricultureModel","page":"Simulation","title":"Persefone.AgricultureModel","text":"AgricultureModel\n\nThis is the heart of the model - a struct that holds all data and state for one simulation run. It is created by initialise and passed as input to most model functions.\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.finalise!-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.finalise!","text":"finalise!(model)\n\nWrap up the simulation. Finalises and visualises output, then terminates.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.initialise","page":"Simulation","title":"Persefone.initialise","text":"initialise(config=PARAMFILE, seed=nothing)\n\nInitialise the model: read in parameters, create the output data directory, and instantiate the SimulationModel object(s). Optionally allows specifying the configuration file and overriding the seed parameter. This returns a single model object, unless the config file contains multiple values for one or more parameters, in which case it creates a full-factorial simulation experiment and returns a vector of model objects.\n\n\n\n\n\n","category":"function"},{"location":"simulation.html#Persefone.initmodel-Tuple{Dict{String, Any}}","page":"Simulation","title":"Persefone.initmodel","text":"initmodel(settings)\n\nInitialise a model object using a ready-made settings dict. This is a helper function for initialise().\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.nagents-Tuple{AgricultureModel}","page":"Simulation","title":"Persefone.nagents","text":"nagents(model)\n\nReturn the total number of agents in a model object.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.paramscan-Tuple{Dict{String, Any}, Vector{String}}","page":"Simulation","title":"Persefone.paramscan","text":"paramscan(settings)\n\nCreate a list of settings dicts, covering all possible parameter combinations given by the input settings (i.e. a full-factorial experiment). This is a helper function for initialise().\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.simulate","page":"Simulation","title":"Persefone.simulate","text":"simulate(config=PARAMFILE, seed=nothing)\n\nInitialise one or more model objects and carry out a full simulation experiment, optionally specifying a configuration file and a seed for the RNG.\n\nThis is the default way to run a Persefone simulation.\n\n\n\n\n\n","category":"function"},{"location":"simulation.html#Persefone.simulate!-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.simulate!","text":"simulate!(model)\n\nCarry out a complete simulation run using a pre-initialised model object.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.stepagent!-Tuple{ModelAgent, SimulationModel}","page":"Simulation","title":"Persefone.stepagent!","text":"stepagent!(agent, model)\n\nAll agent types must define a stepagent!() method that will be called daily.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.stepsimulation!-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.stepsimulation!","text":"stepsimulation!(model)\n\nExecute one update of the model.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#landscape.jl","page":"Simulation","title":"landscape.jl","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"This file manages the landscape maps that underlie the model.","category":"page"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"Modules = [Persefone]\nPages = [\"world/landscape.jl\"]","category":"page"},{"location":"simulation.html#Persefone.FarmEvent","page":"Simulation","title":"Persefone.FarmEvent","text":"FarmEvent\n\nA data structure to define a landscape event, giving its type, spatial extent, and duration.\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.LandCover","page":"Simulation","title":"Persefone.LandCover","text":"The land cover classes encoded in the Mundialis Sentinel data.\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.Management","page":"Simulation","title":"Persefone.Management","text":"The types of management event that can be simulated\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.Pixel","page":"Simulation","title":"Persefone.Pixel","text":"Pixel\n\nA pixel is a simple data structure to combine land use and ownership information in a single object. The model landscape consists of a matrix of pixels. (Note: further landscape information may be added here in future.)\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.bounds-Tuple{Number}","page":"Simulation","title":"Persefone.bounds","text":"bounds(x; max=Inf, min=0)\n\nA utility function to make sure that a number is within a given set of bounds. Returns max/min if x is greater/less than this.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.createevent!","page":"Simulation","title":"Persefone.createevent!","text":"createevent!(model, pixels, name, duration=1)\n\nAdd a farm event to the specified pixels (a vector of position tuples) for a given duration.\n\n\n\n\n\n","category":"function"},{"location":"simulation.html#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}","page":"Simulation","title":"Persefone.directionto","text":"directionto(pos, model, habitatdescriptor)\n\nCalculate the direction from the given location to the closest location matching the habitat descriptor function. Returns a coordinate tuple (target - position), or nothing if no matching habitat is found. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}","page":"Simulation","title":"Persefone.directionto","text":"directionto(pos, model, habitattype)\n\nCalculate the direction from the given location to the closest habitat of the specified type. Returns a coordinate tuple (target - position), or nothing if no matching habitat is found. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}","page":"Simulation","title":"Persefone.distanceto","text":"distanceto(pos, model, habitatdescriptor)\n\nCalculate the distance from the given location to the closest location matching the habitat descriptor function. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}","page":"Simulation","title":"Persefone.distanceto","text":"distanceto(pos, model, habitattype)\n\nCalculate the distance from the given location to the closest habitat of the specified type. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.distancetoedge-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Simulation","title":"Persefone.distancetoedge","text":"distancetoedge(pos, model)\n\nCalculate the distance from the given location to the closest neighbouring habitat. Caution: can be computationally expensive!\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.farmplot-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Simulation","title":"Persefone.farmplot","text":"farmplot(position, model)\n\nReturn the farm plot at this position, or nothing if there is none (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.inbounds-Tuple{Any, Any}","page":"Simulation","title":"Persefone.inbounds","text":"inbounds(pos, model)\n\nIs the given position within the bounds of the model landscape?\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.initlandscape-Tuple{String, String, String}","page":"Simulation","title":"Persefone.initlandscape","text":"initlandscape(directory, landcovermap, farmfieldsmap)\n\nInitialise the model landscape based on the map files specified in the configuration. Returns a matrix of pixels.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.landcover-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Simulation","title":"Persefone.landcover","text":"landcover(position, model)\n\nReturn the land cover class at this position (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.randomdirection-Tuple{SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}","page":"Simulation","title":"Persefone.randomdirection","text":"randomdirection(model, distance)\n\nGet a random direction coordinate tuple within the specified distance.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.randompixel","page":"Simulation","title":"Persefone.randompixel","text":"randompixel(position, model, range, habitatdescriptor)\n\nFind a random pixel within a given range of the position that matches the habitatdescriptor (create this using @habitat).\n\n\n\n\n\n","category":"function"},{"location":"simulation.html#Persefone.safebounds-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Simulation","title":"Persefone.safebounds","text":"safebounds(pos, model)\n\nMake sure that a given position is within the bounds of the model landscape.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.updateevents!-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.updateevents!","text":"updateevents!(model)\n\nCycle through the list of events, removing those that have expired.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#weather.jl","page":"Simulation","title":"weather.jl","text":"","category":"section"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"This file reads in weather data and makes it available to the model.","category":"page"},{"location":"simulation.html","page":"Simulation","title":"Simulation","text":"Modules = [Persefone]\nPages = [\"world/weather.jl\"]","category":"page"},{"location":"simulation.html#Persefone.Weather","page":"Simulation","title":"Persefone.Weather","text":"Weather\n\nA single weather datum, combining the observations from one day.\n\n\n\n\n\n","category":"type"},{"location":"simulation.html#Persefone.initweather-Tuple{String, Dates.Date, Dates.Date}","page":"Simulation","title":"Persefone.initweather","text":"initweather(weatherfile, startdate, enddate)\n\nLoad a weather file, extract the values that are relevant to this model run (specified by start and end dates), and return a dictionary of Weather objects mapped to dates.\n\nNote: This requires a weather file in the format produced by data/extract_weather_data.R.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.maxtemp-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.maxtemp","text":"maxtemp(model)\n\nReturn today's maximum temperature in °C.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.meantemp-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.meantemp","text":"meantemp(model)\n\nReturn today's mean temperature in °C.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.mintemp-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.mintemp","text":"mintemp(model)\n\nReturn today's minimum temperature in °C.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.precipitation-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.precipitation","text":"precipitation(model)\n\nReturn today's total precipitation in mm.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.sunshine-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.sunshine","text":"sunshine(model)\n\nReturn today's sunshine duration in hours.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.vapourpressure-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.vapourpressure","text":"vapourpressure(model)\n\nReturn today's average vapour pressure in hPa.\n\n\n\n\n\n","category":"method"},{"location":"simulation.html#Persefone.windspeed-Tuple{SimulationModel}","page":"Simulation","title":"Persefone.windspeed","text":"windspeed(model)\n\nReturn today's average windspeed in m/s.\n\n\n\n\n\n","category":"method"},{"location":"farm.html#Farm-submodel","page":"Farm submodel","title":"Farm submodel","text":"","category":"section"},{"location":"farm.html","page":"Farm submodel","title":"Farm submodel","text":"Eventually, the aim is to create a full socio-economic farm decision model for Persefone. However, for the time being, we will restrict ourselves to a simple model that executes typical farm operations and crop rotations.","category":"page"},{"location":"farm.html#farm.jl","page":"Farm submodel","title":"farm.jl","text":"","category":"section"},{"location":"farm.html","page":"Farm submodel","title":"Farm submodel","text":"This file is responsible for managing the farm module(s).","category":"page"},{"location":"farm.html","page":"Farm submodel","title":"Farm submodel","text":"Modules = [Persefone]\nPages = [\"farm/farm.jl\"]","category":"page"},{"location":"farm.html#Persefone.Farmer","page":"Farm submodel","title":"Persefone.Farmer","text":"Farmer\n\nThis is the agent type for the farm ABM. (Not yet implemented.)\n\n\n\n\n\n","category":"type"},{"location":"farm.html#Persefone.initfarms!-Tuple{SimulationModel}","page":"Farm submodel","title":"Persefone.initfarms!","text":"initfarms!(model)\n\nInitialise the model with a set of farm agents.\n\n\n\n\n\n","category":"method"},{"location":"farm.html#Persefone.stepagent!-Tuple{Farmer, SimulationModel}","page":"Farm submodel","title":"Persefone.stepagent!","text":"stepagent!(farmer, model)\n\nUpdate a farmer by one day.\n\n\n\n\n\n","category":"method"},{"location":"adapting.html#Adapting-Persefone","page":"Adapting Persefone","title":"Adapting Persefone","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"A key development goal of Persefone is to be FAIR: findable, accessible, interoperable, and reusable. We aim to build a model that is both easy to use and easy to adapt to new situations.","category":"page"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"There are multiple ways to adapt Persefone for a new modelling study:","category":"page"},{"location":"adapting.html#Changing-the-parameters","page":"Adapting Persefone","title":"Changing the parameters","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"The simplest way to adapt Persefone is simply by changing the parameters. Copy src/parameters.toml to a new location, adjust it to your needs, and run the model using julia run.jl -c <configfile>.","category":"page"},{"location":"adapting.html#Changing-the-region","page":"Adapting Persefone","title":"Changing the region","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"To apply Persefone to a new region, you need to create new input maps of land cover and farmplots. How to do so is described here.","category":"page"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"You may also need to change aspects of the farm submodel. This is not yet implemented.","category":"page"},{"location":"adapting.html#Adding-new-animal-species","page":"Adapting Persefone","title":"Adding new animal species","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"To implement a new species to the nature submodel, add a new file to the src/nature/species directory and include it in src/Persefone.jl, as well as adding the name of the species to the nature.targetspecies parameter. In the new file, implement the species using the @species syntax as described here.","category":"page"},{"location":"adapting.html#Adding-new-crop-species","page":"Adapting Persefone","title":"Adding new crop species","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"Crop growth is not yet implemented.","category":"page"},{"location":"adapting.html#Adding-new-farmer-behaviour","page":"Adapting Persefone","title":"Adding new farmer behaviour","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"Farmer behaviour is not yet implemented.","category":"page"},{"location":"adapting.html#Adding-a-new-submodel","page":"Adapting Persefone","title":"Adding a new submodel","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"To add a new submodel in addition to the existing ones (nature, crop, and farm), you need to familiarise yourself with the software architecture. In particular, you need to understand how initialisation and scheduling works in src/core/simulation.jl, and what information is stored in the model object.","category":"page"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"If you want to add a new agent type, create a subtype of ModelAgent, implement a stepagent! function for it and add it to Persefone.initmodel.","category":"page"},{"location":"adapting.html#Linking-to-another-model","page":"Adapting Persefone","title":"Linking to another model","text":"","category":"section"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"Persefone can also be used as a software library and be called from another application. For this purpose, it is set up as a Julia package, with a module exporting various model functions, types, and macros (see src/Persefone.jl). Of particular interest are the functions simulate (set up and run a complete simulation based on a config file), initialise (create one or more model objects from a config file), simulate! (do a simulation run with an existing model object), and stepsimulation! (update a model object by one time step).","category":"page"},{"location":"adapting.html","page":"Adapting Persefone","title":"Adapting Persefone","text":"To interface with Julia from another language, see the Julia docs here and here.","category":"page"},{"location":"crop-models.html#Crop-models","page":"Crop models","title":"Crop models","text":"","category":"section"},{"location":"crop-models.html","page":"Crop models","title":"Crop models","text":"TODO","category":"page"},{"location":"crop-models.html#ALMaSS","page":"Crop models","title":"ALMaSS","text":"","category":"section"},{"location":"crop-models.html#AquaCrop","page":"Crop models","title":"AquaCrop","text":"","category":"section"},{"location":"odd.html#Overview,-Design,-Details-(ODD)","page":"Overview, Design, Details (ODD)","title":"Overview, Design, Details (ODD)","text":"","category":"section"},{"location":"odd.html","page":"Overview, Design, Details (ODD)","title":"Overview, Design, Details (ODD)","text":"The model description follows the ODD (Overview, Design concepts, Details) protocol (Grimm et al., 2006; 2010; 2020):","category":"page"},{"location":"odd.html#.-Purpose","page":"Overview, Design, Details (ODD)","title":"1. Purpose","text":"","category":"section"},{"location":"odd.html#.-Entities,-state-variables,-and-scales","page":"Overview, Design, Details (ODD)","title":"2. Entities, state variables, and scales","text":"","category":"section"},{"location":"odd.html#.-Process-overview-and-scheduling","page":"Overview, Design, Details (ODD)","title":"3. Process overview and scheduling","text":"","category":"section"},{"location":"odd.html#.-Design-concepts","page":"Overview, Design, Details (ODD)","title":"4. Design concepts","text":"","category":"section"},{"location":"odd.html#.1-Basic-principles","page":"Overview, Design, Details (ODD)","title":"4.1 Basic principles","text":"","category":"section"},{"location":"odd.html#.2-Emergence","page":"Overview, Design, Details (ODD)","title":"4.2 Emergence","text":"","category":"section"},{"location":"odd.html#.3-Adaptation","page":"Overview, Design, Details (ODD)","title":"4.3 Adaptation","text":"","category":"section"},{"location":"odd.html#.4-Objectives","page":"Overview, Design, Details (ODD)","title":"4.4 Objectives","text":"","category":"section"},{"location":"odd.html#.5-Learning","page":"Overview, Design, Details (ODD)","title":"4.5 Learning","text":"","category":"section"},{"location":"odd.html#.6-Prediction","page":"Overview, Design, Details (ODD)","title":"4.6 Prediction","text":"","category":"section"},{"location":"odd.html#.7-Sensing","page":"Overview, Design, Details (ODD)","title":"4.7 Sensing","text":"","category":"section"},{"location":"odd.html#.8-Interaction","page":"Overview, Design, Details (ODD)","title":"4.8 Interaction","text":"","category":"section"},{"location":"odd.html#.9-Stochasticity","page":"Overview, Design, Details (ODD)","title":"4.9 Stochasticity","text":"","category":"section"},{"location":"odd.html#.10-Collectives","page":"Overview, Design, Details (ODD)","title":"4.10 Collectives","text":"","category":"section"},{"location":"odd.html#.11-Observation","page":"Overview, Design, Details (ODD)","title":"4.11 Observation","text":"","category":"section"},{"location":"odd.html#.-Initialisation","page":"Overview, Design, Details (ODD)","title":"5. Initialisation","text":"","category":"section"},{"location":"odd.html#.-Input-data","page":"Overview, Design, Details (ODD)","title":"6. Input data","text":"","category":"section"},{"location":"odd.html#.-Submodels","page":"Overview, Design, Details (ODD)","title":"7. Submodels","text":"","category":"section"},{"location":"odd.html#.-References","page":"Overview, Design, Details (ODD)","title":"8. References","text":"","category":"section"},{"location":"gis.html#Maps-and-weather-data","page":"Maps and weather data","title":"Maps and weather data","text":"","category":"section"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Persefone currently requires two separate map input files: one for land cover, the other for field geometry. Additionally, a weather input file is needed. This documents describe how to obtain and process the data needed for each of these.","category":"page"},{"location":"gis.html#Land-cover-maps","page":"Maps and weather data","title":"Land cover maps","text":"","category":"section"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Land cover maps for Germany at 10m resolution can be obtained from Mundialis. These are generated annually from Sentinel data and comprise the following land cover classes:","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"10: forest\n20: low vegetation\n30: water\n40: built-up\n50: bare soil\n60: agriculture","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"To create a Persefone map input file, you need to crop the national Mundialis map to the extent that you want to simulate (suggestion: approx. 10x10km is a reasonable size).","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"To do so, download the Mundialis map and import it into QGIS. Then create a new vector layer and create a rectangle feature to delimit the extent of your region. Then go to Raster -> Extraction -> Clip Raster by Extent. Select the Mundialis map as the input layer, set the clipping extent by choosing your region vector layer under Calculate from Layer and specify the output file name before clicking Run. This will generate a TIF file that you can pass to Persefone as the landcovermap parameter.","category":"page"},{"location":"gis.html#Field-ID-maps","page":"Maps and weather data","title":"Field ID maps","text":"","category":"section"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"In addition to the land cover data explained above, Persefone also needs information about agricultural field boundaries in order to assign these to the farming agents. Unfortunately, getting this is rather more complicated.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"In the EU, every country runs a Land Parcel Information System (LPIS) to administer CAP payments. In Germany, this is called InVeKoS and is run by the Länder. For example, you can view and download the InVeKoS data for Thüringen here. This gives you a vector layer which can be loaded into QGIS. However, it needs to be converted to a raster layer and cropped to your region extent before it can be used in Persefone.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"The first thing to do is to make sure that the vector layer has a numeric (!) field with a unique identifier for each field block (check the attribute table). The Thüringen data has the FBI (\"Feldblockident\") field, but this is a string value and therefore not usable by the rasteriser. So, we set the vector layer to edit mode, open the field calculator, enter the information for a new field (call it \"FID\" and set it to a 32-bit integer), and enter @row_number in the expression field. Then save the layer and close the calculator.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Secondly, you need to filter out all non-field/non-grassland plot types. (LPIS also has data on forests and various landscape elements that are not relevant to our use case.) Assuming you're working with the Thüringen InVeKoS data (other data sets may have a different structure), right-click on the layer name in QGIS' layer overview and click on \"Filter...\". Then, enter this expression in the query builder: \"BNK\" = 'AL' OR \"BNK\" = 'GL' and click \"OK\". This will select only field and grassland plots.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Next, open the rasteriser (Raster -> Conversion -> Rasterize). Select your FID field as the \"Field to use for a burn-in value\", and your land cover map (as created above - this ensures the two layers match) as the output extent. Make sure the \"fixed value to burn\" is \"Not set\". Then choose \"Georeferenced units\" as the \"Out raster size units\" and set horizontal and vertical resolution to 10.0. In the advanced parameters, set the output data type to UInt32. Finally, enter an output file name and run. The resulting TIF file can be passed to Persefone as the farmfieldmap parameter.","category":"page"},{"location":"gis.html#Weather-data","page":"Maps and weather data","title":"Weather data","text":"","category":"section"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Currently, Persefone uses historical weather data from the closes weather station as its weather input. (In future, this may be changed to a more detailed raster input, which could then also provide future weather predictions under climate change.) Weather data can be downloaded from the German weather service (DWD). The relevant data are in the folder daily/kl/historical.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"The description of this data set and the list of weather stations can be found in the Persefone repository, in the docs folder (or downloaded from the link above). Using the list of weather stations, select the one closest to the area of study. Note that not all stations were continuously in operation; make sure that the selected station covers the years of interest.","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Region Jena: station number 02444 (\"Jena (Sternwarte)\")\nRegion Eichsfeld:\nRegion Thüringer Becken:\nRegion Hohenlohe:\nRegion Bodensee:\nRegion Nördlicher Oberrhein:","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"From the link above, download the ZIP file associated with the station number. Check the included meta-data if there is any important missing data, or other relevant information (e.g. the station moved position).","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Then use data/extract_weather_data.R to process the data into the format needed by Persefone:","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"library(tidyverse)\n\n## replace this with the correct file name\nweatherfile = \"produkt_klima_tag_18210101_20221231_02444.txt\"\n\ndata = read.table(weatherfile, sep=\";\", header=T)\n\nweather = data %>%\n ## drop values before 2000 to save space\n filter(MESS_DATUM>=20000101) %>%\n ## select relevant variables and convert place-holder values to NA\n select(MESS_DATUM, FM, RSK, SDK, VPM, TMK, TXK, TNK) %>%\n mutate(date=MESS_DATUM, MESS_DATUM=NULL,\n mean_windspeed=na_if(FM, -999), FM=NULL,\n precipitation=na_if(RSK, -999), RSK=NULL,\n sunshine_hours=na_if(SDK, -999), SDK=NULL,\n mean_vapour_pressure=na_if(VPM, -999), VPM=NULL,\n mean_temperature=na_if(TMK, -999), TMK=NULL,\n max_temperature=na_if(TXK, -999), TXK=NULL,\n min_temperature=na_if(TNK, -999), TNK=NULL)\n\n## replace with the desired file name\nwrite.csv(weather, file=\"weather_jena.csv\", row.names=FALSE)","category":"page"},{"location":"gis.html","page":"Maps and weather data","title":"Maps and weather data","text":"Note: for calculating the reference evapotranspiration ET_0 (needed for the AquaCrop model), use the FAO Penman-Monteith equation.","category":"page"},{"location":"crops.html#Crop-submodel","page":"Crop submodel","title":"Crop submodel","text":"","category":"section"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"Eventually, the plan is to have Persefone include a reimplementation of the AquaCrop model, a well-established crop growth model developed by the FAO. Until then, we are using the crop growth submodel used in ALMaSS.","category":"page"},{"location":"crops.html#farmplot.jl","page":"Crop submodel","title":"farmplot.jl","text":"","category":"section"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"This file is responsible for the farm plots, i.e. the indidivual fields that farmers manage.","category":"page"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"Modules = [Persefone]\nPages = [\"crop/farmplot.jl\"]","category":"page"},{"location":"crops.html#Persefone.FarmPlot","page":"Crop submodel","title":"Persefone.FarmPlot","text":"FarmPlot\n\nThis represents one field, i.e. a collection of pixels with the same management. This is the spatial unit with which the crop growth model and the farm model work.\n\n\n\n\n\n","category":"type"},{"location":"crops.html#Persefone.averagefieldsize-Tuple{SimulationModel}","page":"Crop submodel","title":"Persefone.averagefieldsize","text":"averagefieldsize(model)\n\nCalculate the average field size in hectares for the model landscape.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.cropcover-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Crop submodel","title":"Persefone.cropcover","text":"cropcover(model, position)\n\nReturn the percentage ground cover of the crop at this position, or 0 if there is no crop here (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.cropheight-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Crop submodel","title":"Persefone.cropheight","text":"cropheight(model, position)\n\nReturn the height of the crop at this position, or 0 if there is no crop here (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.cropname-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Crop submodel","title":"Persefone.cropname","text":"cropname(model, position)\n\nReturn the name of the crop at this position, or an empty string if there is no crop here (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.croptype-Tuple{Tuple{Int64, Int64}, SimulationModel}","page":"Crop submodel","title":"Persefone.croptype","text":"croptype(model, position)\n\nReturn the crop at this position, or nothing if there is no crop here (utility wrapper).\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.growcrop!-Tuple{FarmPlot, SimulationModel}","page":"Crop submodel","title":"Persefone.growcrop!","text":"growcrop!(farmplot, model)\n\nApply the relevant crop growth model to update the plants on this farm plot. Currently only supports the ALMaSS crop growth model by Topping et al.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.harvest!-Tuple{FarmPlot, SimulationModel}","page":"Crop submodel","title":"Persefone.harvest!","text":"harvest!(farmplot, model)\n\nHarvest the crop on this farmplot.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.initfields!-Tuple{SimulationModel}","page":"Crop submodel","title":"Persefone.initfields!","text":"initfields!(model)\n\nInitialise the model with its farm plots.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.sow!-Tuple{String, FarmPlot, SimulationModel}","page":"Crop submodel","title":"Persefone.sow!","text":"sow!(cropname, farmplot, model)\n\nSow the specified crop on this farmplot.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.stepagent!-Tuple{FarmPlot, SimulationModel}","page":"Crop submodel","title":"Persefone.stepagent!","text":"stepagent!(farmplot, model)\n\nUpdate a farm plot by one day.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#crops.jl","page":"Crop submodel","title":"crops.jl","text":"","category":"section"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"This includes the types and functions needed for all crop growth model, which are also referenced by the other submodels.","category":"page"},{"location":"crops.html","page":"Crop submodel","title":"Crop submodel","text":"Modules = [Persefone]\nPages = [\"crop/crops.jl\"]","category":"page"},{"location":"crops.html#Persefone.CropCurveParams","page":"Crop submodel","title":"Persefone.CropCurveParams","text":"CropCurveParams\n\nThe values in this struct define one crop growth curve.\n\n\n\n\n\n","category":"type"},{"location":"crops.html#Persefone.CropType","page":"Crop submodel","title":"Persefone.CropType","text":"CropType\n\nThe type struct for all crops. Currently follows the crop growth model as implemented in ALMaSS.\n\n\n\n\n\n","category":"type"},{"location":"crops.html#Persefone.GrowthPhase","page":"Crop submodel","title":"Persefone.GrowthPhase","text":"GrowthPhase\n\nALMaSS crop growth curves are split into five phases, triggered by seasonal dates or agricultural events.\n\n\n\n\n\n","category":"type"},{"location":"crops.html#Base.tryparse-Tuple{Type{Persefone.GrowthPhase}, String}","page":"Crop submodel","title":"Base.tryparse","text":"Base.tryparse(type, str)\n\nExtend tryparse to allow parsing GrowthPhase values. (Needed to read in the CSV parameter file.)\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.buildgrowthcurve-Tuple{Vector{CSV.Row}}","page":"Crop submodel","title":"Persefone.buildgrowthcurve","text":"buildgrowthcurve(data)\n\nConvert a list of rows from the crop growth data into a CropCurveParams object.\n\n\n\n\n\n","category":"method"},{"location":"crops.html#Persefone.readcropparameters-Tuple{String, String}","page":"Crop submodel","title":"Persefone.readcropparameters","text":"readcropparameters(generalcropfile, cropgrowthfile)\n\nParse a CSV file containing the required parameter values for each crop (as produced from the original ALMaSS file by convert_almass_data.py).\n\n\n\n\n\n","category":"method"},{"location":"management.html#Farm-management","page":"Farm management","title":"Farm management","text":"","category":"section"},{"location":"management.html","page":"Farm management","title":"Farm management","text":"TODO","category":"page"},{"location":"management.html#Crop-rotations-and-management","page":"Farm management","title":"Crop rotations and management","text":"","category":"section"},{"location":"management.html#Environmental-regulations","page":"Farm management","title":"Environmental regulations","text":"","category":"section"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"CurrentModule = Persefone","category":"page"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"(Image: Persefone.jl splash screen)","category":"page"},{"location":"index.html#Introduction","page":"Introduction","title":"Introduction","text":"","category":"section"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"Persefone.jl models agricultural practice and how it impacts animal species at a landscape scale. It includes a farm submodel, a crop growth submodel, and individual-based models of multiple indicator species. Its aim is to investigate how changes in farm operations (e.g. through policy changes in the CAP) influence biodiversity.","category":"page"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"The model is open-source software available on Gitlab.","category":"page"},{"location":"index.html","page":"Introduction","title":"Introduction","text":"This documentation was last updated on 2024-07-30 for Persefone.jl v0.5.2 (commit 5deb973).","category":"page"}] } diff --git a/docs/build/simulation.html b/docs/build/simulation.html index b8999971a34ff78bf61a9779d1846c78cce53d75..7336b7152ed657fe9acfe663eddcde22e49ea188 100644 --- a/docs/build/simulation.html +++ b/docs/build/simulation.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Simulation · Persefone.jl</title><meta name="title" content="Simulation · Persefone.jl"/><meta property="og:title" content="Simulation · Persefone.jl"/><meta property="twitter:title" content="Simulation · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li class="is-active"><a class="tocitem" href="simulation.html">Simulation</a><ul class="internal"><li><a class="tocitem" href="#Persefone.jl"><span>Persefone.jl</span></a></li><li><a class="tocitem" href="#simulation.jl"><span>simulation.jl</span></a></li><li><a class="tocitem" href="#landscape.jl"><span>landscape.jl</span></a></li><li><a class="tocitem" href="#weather.jl"><span>weather.jl</span></a></li></ul></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Core</a></li><li class="is-active"><a href="simulation.html">Simulation</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="simulation.html">Simulation</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/simulation.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Simulation"><a class="docs-heading-anchor" href="#Simulation">Simulation</a><a id="Simulation-1"></a><a class="docs-heading-anchor-permalink" href="#Simulation" title="Permalink"></a></h1><p>The <code>core</code> and <code>world</code> directories hold source files that are important for all submodels, including scheduling, landscape, weather, and input/output functions.</p><h2 id="Persefone.jl"><a class="docs-heading-anchor" href="#Persefone.jl">Persefone.jl</a><a id="Persefone.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Persefone.jl" title="Permalink"></a></h2><p>This file defines the module, including all exported symbols and two high-level types.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.ModelAgent" href="#Persefone.ModelAgent"><code>Persefone.ModelAgent</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">ModelAgent</code></pre><p>The supertype of all agents in the model (animal species, farmer types, farmplots).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/Persefone.jl#L119-L123">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.SimulationModel" href="#Persefone.SimulationModel"><code>Persefone.SimulationModel</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">SimulationModel</code></pre><p>The supertype of <a href="@ref">AgricultureModel</a>. This is needed to avoid circular dependencies (most types and functions depend on <code>SimulationModel</code>, but the definition of the model struct depends on these types).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/Persefone.jl#L110-L116">source</a></section></article><h2 id="simulation.jl"><a class="docs-heading-anchor" href="#simulation.jl">simulation.jl</a><a id="simulation.jl-1"></a><a class="docs-heading-anchor-permalink" href="#simulation.jl" title="Permalink"></a></h2><p>This file includes the basal functions for initialising and running simulations.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.AgricultureModel" href="#Persefone.AgricultureModel"><code>Persefone.AgricultureModel</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">AgricultureModel</code></pre><p>This is the heart of the model - a struct that holds all data and state for one simulation run. It is created by <a href="simulation.html#Persefone.initialise"><code>initialise</code></a> and passed as input to most model functions.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L8-L14">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.finalise!-Tuple{SimulationModel}" href="#Persefone.finalise!-Tuple{SimulationModel}"><code>Persefone.finalise!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">finalise!(model)</code></pre><p>Wrap up the simulation. Finalises and visualises output, then terminates.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L196-L200">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initialise" href="#Persefone.initialise"><code>Persefone.initialise</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">initialise(config=PARAMFILE, seed=nothing)</code></pre><p>Initialise the model: read in parameters, create the output data directory, and instantiate the SimulationModel object(s). Optionally allows specifying the configuration file and overriding the <code>seed</code> parameter. This returns a single model object, unless the config file contains multiple values for one or more parameters, in which case it creates a full-factorial simulation experiment and returns a vector of model objects.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L79-L88">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initmodel-Tuple{Dict{String, Any}}" href="#Persefone.initmodel-Tuple{Dict{String, Any}}"><code>Persefone.initmodel</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initmodel(settings)</code></pre><p>Initialise a model object using a ready-made settings dict. This is a helper function for <code>initialise()</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L98-L103">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nagents-Tuple{AgricultureModel}" href="#Persefone.nagents-Tuple{AgricultureModel}"><code>Persefone.nagents</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">nagents(model)</code></pre><p>Return the total number of agents in a model object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L32-L36">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.paramscan-Tuple{Dict{String, Any}, Vector{String}}" href="#Persefone.paramscan-Tuple{Dict{String, Any}, Vector{String}}"><code>Persefone.paramscan</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">paramscan(settings)</code></pre><p>Create a list of settings dicts, covering all possible parameter combinations given by the input settings (i.e. a full-factorial experiment). This is a helper function for <code>initialise()</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L144-L150">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.simulate" href="#Persefone.simulate"><code>Persefone.simulate</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">simulate(config=PARAMFILE, seed=nothing)</code></pre><p>Initialise one or more model objects and carry out a full simulation experiment, optionally specifying a configuration file and a seed for the RNG.</p><p>This is the default way to run a Persefone simulation.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L50-L57">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.simulate!-Tuple{SimulationModel}" href="#Persefone.simulate!-Tuple{SimulationModel}"><code>Persefone.simulate!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">simulate!(model)</code></pre><p>Carry out a complete simulation run using a pre-initialised model object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L65-L69">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepagent!-Tuple{ModelAgent, SimulationModel}" href="#Persefone.stepagent!-Tuple{ModelAgent, SimulationModel}"><code>Persefone.stepagent!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(agent, model)</code></pre><p>All agent types must define a stepagent!() method that will be called daily.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L41-L45">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepsimulation!-Tuple{SimulationModel}" href="#Persefone.stepsimulation!-Tuple{SimulationModel}"><code>Persefone.stepsimulation!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepsimulation!(model)</code></pre><p>Execute one update of the model.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/core/simulation.jl#L172-L176">source</a></section></article><h2 id="landscape.jl"><a class="docs-heading-anchor" href="#landscape.jl">landscape.jl</a><a id="landscape.jl-1"></a><a class="docs-heading-anchor-permalink" href="#landscape.jl" title="Permalink"></a></h2><p>This file manages the landscape maps that underlie the model.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.FarmEvent" href="#Persefone.FarmEvent"><code>Persefone.FarmEvent</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">FarmEvent</code></pre><p>A data structure to define a landscape event, giving its type, spatial extent, and duration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L28-L33">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.LandCover" href="#Persefone.LandCover"><code>Persefone.LandCover</code></a> — <span class="docstring-category">Type</span></header><section><div><p>The land cover classes encoded in the Mundialis Sentinel data.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L7">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Management" href="#Persefone.Management"><code>Persefone.Management</code></a> — <span class="docstring-category">Type</span></header><section><div><p>The types of management event that can be simulated</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L10">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Pixel" href="#Persefone.Pixel"><code>Persefone.Pixel</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Pixel</code></pre><p>A pixel is a simple data structure to combine land use and ownership information in a single object. The model landscape consists of a matrix of pixels. (Note: further landscape information may be added here in future.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L14-L20">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.createevent!" href="#Persefone.createevent!"><code>Persefone.createevent!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">createevent!(model, pixels, name, duration=1)</code></pre><p>Add a farm event to the specified pixels (a vector of position tuples) for a given duration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L93-L97">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}" href="#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}"><code>Persefone.directionto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">directionto(pos, model, habitatdescriptor)</code></pre><p>Calculate the direction from the given location to the closest location matching the habitat descriptor function. Returns a coordinate tuple (target - position), or nothing if no matching habitat is found. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L125-L131">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}" href="#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}"><code>Persefone.directionto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">directionto(pos, model, habitattype)</code></pre><p>Calculate the direction from the given location to the closest habitat of the specified type. Returns a coordinate tuple (target - position), or nothing if no matching habitat is found. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L164-L170">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}" href="#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}"><code>Persefone.distanceto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distanceto(pos, model, habitatdescriptor)</code></pre><p>Calculate the distance from the given location to the closest location matching the habitat descriptor function. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L176-L181">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}" href="#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}"><code>Persefone.distanceto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distanceto(pos, model, habitattype)</code></pre><p>Calculate the distance from the given location to the closest habitat of the specified type. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L189-L194">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.distancetoedge-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.distancetoedge-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.distancetoedge</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distancetoedge(pos, model)</code></pre><p>Calculate the distance from the given location to the closest neighbouring habitat. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L200-L205">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.farmplot-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.farmplot-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.farmplot</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">farmplot(position, model)</code></pre><p>Return the farm plot at this position, or nothing if there is none (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L115-L119">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.inbounds-Tuple{Any, Any}" href="#Persefone.inbounds-Tuple{Any, Any}"><code>Persefone.inbounds</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">inbounds(pos, model)</code></pre><p>Is the given position within the bounds of the model landscape?</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L239-L243">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initlandscape-Tuple{String, String, String}" href="#Persefone.initlandscape-Tuple{String, String, String}"><code>Persefone.initlandscape</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initlandscape(directory, landcovermap, farmfieldsmap)</code></pre><p>Initialise the model landscape based on the map files specified in the configuration. Returns a matrix of pixels.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L40-L45">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.landcover-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.landcover-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.landcover</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">landcover(position, model)</code></pre><p>Return the land cover class at this position (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L106-L110">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.randomdirection-Tuple{SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}" href="#Persefone.randomdirection-Tuple{SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}"><code>Persefone.randomdirection</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">randomdirection(model, distance)</code></pre><p>Get a random direction coordinate tuple within the specified distance.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L229-L233">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.randompixel" href="#Persefone.randompixel"><code>Persefone.randompixel</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">randompixel(position, model, range, habitatdescriptor)</code></pre><p>Find a random pixel within a given <code>range</code> of the <code>position</code> that matches the habitatdescriptor (create this using <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L211-L216">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.safebounds-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.safebounds-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.safebounds</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">safebounds(pos, model)</code></pre><p>Make sure that a given position is within the bounds of the model landscape.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L249-L253">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.updateevents!-Tuple{SimulationModel}" href="#Persefone.updateevents!-Tuple{SimulationModel}"><code>Persefone.updateevents!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">updateevents!(model)</code></pre><p>Cycle through the list of events, removing those that have expired.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/landscape.jl#L72-L76">source</a></section></article><h2 id="weather.jl"><a class="docs-heading-anchor" href="#weather.jl">weather.jl</a><a id="weather.jl-1"></a><a class="docs-heading-anchor-permalink" href="#weather.jl" title="Permalink"></a></h2><p>This file reads in weather data and makes it available to the model.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Weather" href="#Persefone.Weather"><code>Persefone.Weather</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Weather</code></pre><p>A single weather datum, combining the observations from one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L7-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initweather-Tuple{String, Dates.Date, Dates.Date}" href="#Persefone.initweather-Tuple{String, Dates.Date, Dates.Date}"><code>Persefone.initweather</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initweather(weatherfile, startdate, enddate)</code></pre><p>Load a weather file, extract the values that are relevant to this model run (specified by start and end dates), and return a dictionary of Weather objects mapped to dates.</p><p><strong>Note:</strong> This requires a weather file in the format produced by <code>data/extract_weather_data.R</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L22-L30">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.maxtemp-Tuple{SimulationModel}" href="#Persefone.maxtemp-Tuple{SimulationModel}"><code>Persefone.maxtemp</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">maxtemp(model)</code></pre><p>Return today's maximum temperature in °C.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L96-L100">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.meantemp-Tuple{SimulationModel}" href="#Persefone.meantemp-Tuple{SimulationModel}"><code>Persefone.meantemp</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">meantemp(model)</code></pre><p>Return today's mean temperature in °C.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L87-L91">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.mintemp-Tuple{SimulationModel}" href="#Persefone.mintemp-Tuple{SimulationModel}"><code>Persefone.mintemp</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">mintemp(model)</code></pre><p>Return today's minimum temperature in °C.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L105-L109">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.precipitation-Tuple{SimulationModel}" href="#Persefone.precipitation-Tuple{SimulationModel}"><code>Persefone.precipitation</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">precipitation(model)</code></pre><p>Return today's total precipitation in mm.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L60-L64">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.sunshine-Tuple{SimulationModel}" href="#Persefone.sunshine-Tuple{SimulationModel}"><code>Persefone.sunshine</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">sunshine(model)</code></pre><p>Return today's sunshine duration in hours.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L69-L73">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.vapourpressure-Tuple{SimulationModel}" href="#Persefone.vapourpressure-Tuple{SimulationModel}"><code>Persefone.vapourpressure</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">vapourpressure(model)</code></pre><p>Return today's average vapour pressure in hPa.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L78-L82">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.windspeed-Tuple{SimulationModel}" href="#Persefone.windspeed-Tuple{SimulationModel}"><code>Persefone.windspeed</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">windspeed(model)</code></pre><p>Return today's average windspeed in m/s.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/world/weather.jl#L51-L55">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="species-dsl.html">« Defining new species</a><a class="docs-footer-nextpage" href="io.html">Input and Output »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Simulation · Persefone.jl</title><meta name="title" content="Simulation · Persefone.jl"/><meta property="og:title" content="Simulation · Persefone.jl"/><meta property="twitter:title" content="Simulation · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li class="is-active"><a class="tocitem" href="simulation.html">Simulation</a><ul class="internal"><li><a class="tocitem" href="#Persefone.jl"><span>Persefone.jl</span></a></li><li><a class="tocitem" href="#simulation.jl"><span>simulation.jl</span></a></li><li><a class="tocitem" href="#landscape.jl"><span>landscape.jl</span></a></li><li><a class="tocitem" href="#weather.jl"><span>weather.jl</span></a></li></ul></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Software API</a></li><li class="is-active"><a href="simulation.html">Simulation</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="simulation.html">Simulation</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/simulation.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Simulation"><a class="docs-heading-anchor" href="#Simulation">Simulation</a><a id="Simulation-1"></a><a class="docs-heading-anchor-permalink" href="#Simulation" title="Permalink"></a></h1><p>The <code>core</code> and <code>world</code> directories hold source files that are important for all submodels, including scheduling, landscape, weather, and input/output functions.</p><h2 id="Persefone.jl"><a class="docs-heading-anchor" href="#Persefone.jl">Persefone.jl</a><a id="Persefone.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Persefone.jl" title="Permalink"></a></h2><p>This file defines the module, including all exported symbols and two high-level types.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.ModelAgent" href="#Persefone.ModelAgent"><code>Persefone.ModelAgent</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">ModelAgent</code></pre><p>The supertype of all agents in the model (animal species, farmer types, farmplots).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/Persefone.jl#L123-L127">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.SimulationModel" href="#Persefone.SimulationModel"><code>Persefone.SimulationModel</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">SimulationModel</code></pre><p>The supertype of <a href="@ref">AgricultureModel</a>. This is needed to avoid circular dependencies (most types and functions depend on <code>SimulationModel</code>, but the definition of the model struct depends on these types).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/Persefone.jl#L114-L120">source</a></section></article><h2 id="simulation.jl"><a class="docs-heading-anchor" href="#simulation.jl">simulation.jl</a><a id="simulation.jl-1"></a><a class="docs-heading-anchor-permalink" href="#simulation.jl" title="Permalink"></a></h2><p>This file includes the basal functions for initialising and running simulations.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.AgricultureModel" href="#Persefone.AgricultureModel"><code>Persefone.AgricultureModel</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">AgricultureModel</code></pre><p>This is the heart of the model - a struct that holds all data and state for one simulation run. It is created by <a href="simulation.html#Persefone.initialise"><code>initialise</code></a> and passed as input to most model functions.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L8-L14">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.finalise!-Tuple{SimulationModel}" href="#Persefone.finalise!-Tuple{SimulationModel}"><code>Persefone.finalise!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">finalise!(model)</code></pre><p>Wrap up the simulation. Finalises and visualises output, then terminates.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L196-L200">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initialise" href="#Persefone.initialise"><code>Persefone.initialise</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">initialise(config=PARAMFILE, seed=nothing)</code></pre><p>Initialise the model: read in parameters, create the output data directory, and instantiate the SimulationModel object(s). Optionally allows specifying the configuration file and overriding the <code>seed</code> parameter. This returns a single model object, unless the config file contains multiple values for one or more parameters, in which case it creates a full-factorial simulation experiment and returns a vector of model objects.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L79-L88">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initmodel-Tuple{Dict{String, Any}}" href="#Persefone.initmodel-Tuple{Dict{String, Any}}"><code>Persefone.initmodel</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initmodel(settings)</code></pre><p>Initialise a model object using a ready-made settings dict. This is a helper function for <code>initialise()</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L98-L103">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nagents-Tuple{AgricultureModel}" href="#Persefone.nagents-Tuple{AgricultureModel}"><code>Persefone.nagents</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">nagents(model)</code></pre><p>Return the total number of agents in a model object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L32-L36">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.paramscan-Tuple{Dict{String, Any}, Vector{String}}" href="#Persefone.paramscan-Tuple{Dict{String, Any}, Vector{String}}"><code>Persefone.paramscan</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">paramscan(settings)</code></pre><p>Create a list of settings dicts, covering all possible parameter combinations given by the input settings (i.e. a full-factorial experiment). This is a helper function for <code>initialise()</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L144-L150">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.simulate" href="#Persefone.simulate"><code>Persefone.simulate</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">simulate(config=PARAMFILE, seed=nothing)</code></pre><p>Initialise one or more model objects and carry out a full simulation experiment, optionally specifying a configuration file and a seed for the RNG.</p><p>This is the default way to run a Persefone simulation.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L50-L57">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.simulate!-Tuple{SimulationModel}" href="#Persefone.simulate!-Tuple{SimulationModel}"><code>Persefone.simulate!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">simulate!(model)</code></pre><p>Carry out a complete simulation run using a pre-initialised model object.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L65-L69">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepagent!-Tuple{ModelAgent, SimulationModel}" href="#Persefone.stepagent!-Tuple{ModelAgent, SimulationModel}"><code>Persefone.stepagent!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepagent!(agent, model)</code></pre><p>All agent types must define a stepagent!() method that will be called daily.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L41-L45">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.stepsimulation!-Tuple{SimulationModel}" href="#Persefone.stepsimulation!-Tuple{SimulationModel}"><code>Persefone.stepsimulation!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">stepsimulation!(model)</code></pre><p>Execute one update of the model.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/core/simulation.jl#L172-L176">source</a></section></article><h2 id="landscape.jl"><a class="docs-heading-anchor" href="#landscape.jl">landscape.jl</a><a id="landscape.jl-1"></a><a class="docs-heading-anchor-permalink" href="#landscape.jl" title="Permalink"></a></h2><p>This file manages the landscape maps that underlie the model.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.FarmEvent" href="#Persefone.FarmEvent"><code>Persefone.FarmEvent</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">FarmEvent</code></pre><p>A data structure to define a landscape event, giving its type, spatial extent, and duration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L32-L37">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.LandCover" href="#Persefone.LandCover"><code>Persefone.LandCover</code></a> — <span class="docstring-category">Type</span></header><section><div><p>The land cover classes encoded in the Mundialis Sentinel data.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L7">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Management" href="#Persefone.Management"><code>Persefone.Management</code></a> — <span class="docstring-category">Type</span></header><section><div><p>The types of management event that can be simulated</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L10">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Pixel" href="#Persefone.Pixel"><code>Persefone.Pixel</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Pixel</code></pre><p>A pixel is a simple data structure to combine land use and ownership information in a single object. The model landscape consists of a matrix of pixels. (Note: further landscape information may be added here in future.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L13-L19">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.bounds-Tuple{Number}" href="#Persefone.bounds-Tuple{Number}"><code>Persefone.bounds</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">bounds(x; max=Inf, min=0)</code></pre><p>A utility function to make sure that a number is within a given set of bounds. Returns <code>max</code>/<code>min</code> if <code>x</code> is greater/less than this.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L243-L248">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.createevent!" href="#Persefone.createevent!"><code>Persefone.createevent!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">createevent!(model, pixels, name, duration=1)</code></pre><p>Add a farm event to the specified pixels (a vector of position tuples) for a given duration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L97-L101">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}" href="#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}"><code>Persefone.directionto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">directionto(pos, model, habitatdescriptor)</code></pre><p>Calculate the direction from the given location to the closest location matching the habitat descriptor function. Returns a coordinate tuple (target - position), or nothing if no matching habitat is found. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L129-L135">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}" href="#Persefone.directionto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}"><code>Persefone.directionto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">directionto(pos, model, habitattype)</code></pre><p>Calculate the direction from the given location to the closest habitat of the specified type. Returns a coordinate tuple (target - position), or nothing if no matching habitat is found. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L168-L174">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}" href="#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Function}"><code>Persefone.distanceto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distanceto(pos, model, habitatdescriptor)</code></pre><p>Calculate the distance from the given location to the closest location matching the habitat descriptor function. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L180-L185">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}" href="#Persefone.distanceto-Tuple{Tuple{Int64, Int64}, SimulationModel, Persefone.LandCover}"><code>Persefone.distanceto</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distanceto(pos, model, habitattype)</code></pre><p>Calculate the distance from the given location to the closest habitat of the specified type. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L193-L198">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.distancetoedge-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.distancetoedge-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.distancetoedge</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">distancetoedge(pos, model)</code></pre><p>Calculate the distance from the given location to the closest neighbouring habitat. Caution: can be computationally expensive!</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L204-L209">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.farmplot-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.farmplot-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.farmplot</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">farmplot(position, model)</code></pre><p>Return the farm plot at this position, or nothing if there is none (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L119-L123">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.inbounds-Tuple{Any, Any}" href="#Persefone.inbounds-Tuple{Any, Any}"><code>Persefone.inbounds</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">inbounds(pos, model)</code></pre><p>Is the given position within the bounds of the model landscape?</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L255-L259">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initlandscape-Tuple{String, String, String}" href="#Persefone.initlandscape-Tuple{String, String, String}"><code>Persefone.initlandscape</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initlandscape(directory, landcovermap, farmfieldsmap)</code></pre><p>Initialise the model landscape based on the map files specified in the configuration. Returns a matrix of pixels.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L44-L49">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.landcover-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.landcover-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.landcover</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">landcover(position, model)</code></pre><p>Return the land cover class at this position (utility wrapper).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L110-L114">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.randomdirection-Tuple{SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}" href="#Persefone.randomdirection-Tuple{SimulationModel, Union{Unitful.Quantity{T, 𝐋, U}, Unitful.Level{L, S, Unitful.Quantity{T, 𝐋, U}} where {L, S}} where {T, U}}"><code>Persefone.randomdirection</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">randomdirection(model, distance)</code></pre><p>Get a random direction coordinate tuple within the specified distance.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L233-L237">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.randompixel" href="#Persefone.randompixel"><code>Persefone.randompixel</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">randompixel(position, model, range, habitatdescriptor)</code></pre><p>Find a random pixel within a given <code>range</code> of the <code>position</code> that matches the habitatdescriptor (create this using <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L215-L220">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.safebounds-Tuple{Tuple{Int64, Int64}, SimulationModel}" href="#Persefone.safebounds-Tuple{Tuple{Int64, Int64}, SimulationModel}"><code>Persefone.safebounds</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">safebounds(pos, model)</code></pre><p>Make sure that a given position is within the bounds of the model landscape.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L265-L269">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.updateevents!-Tuple{SimulationModel}" href="#Persefone.updateevents!-Tuple{SimulationModel}"><code>Persefone.updateevents!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">updateevents!(model)</code></pre><p>Cycle through the list of events, removing those that have expired.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/landscape.jl#L76-L80">source</a></section></article><h2 id="weather.jl"><a class="docs-heading-anchor" href="#weather.jl">weather.jl</a><a id="weather.jl-1"></a><a class="docs-heading-anchor-permalink" href="#weather.jl" title="Permalink"></a></h2><p>This file reads in weather data and makes it available to the model.</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Weather" href="#Persefone.Weather"><code>Persefone.Weather</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Weather</code></pre><p>A single weather datum, combining the observations from one day.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L7-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.initweather-Tuple{String, Dates.Date, Dates.Date}" href="#Persefone.initweather-Tuple{String, Dates.Date, Dates.Date}"><code>Persefone.initweather</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">initweather(weatherfile, startdate, enddate)</code></pre><p>Load a weather file, extract the values that are relevant to this model run (specified by start and end dates), and return a dictionary of Weather objects mapped to dates.</p><p><strong>Note:</strong> This requires a weather file in the format produced by <code>data/extract_weather_data.R</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L22-L30">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.maxtemp-Tuple{SimulationModel}" href="#Persefone.maxtemp-Tuple{SimulationModel}"><code>Persefone.maxtemp</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">maxtemp(model)</code></pre><p>Return today's maximum temperature in °C.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L96-L100">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.meantemp-Tuple{SimulationModel}" href="#Persefone.meantemp-Tuple{SimulationModel}"><code>Persefone.meantemp</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">meantemp(model)</code></pre><p>Return today's mean temperature in °C.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L87-L91">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.mintemp-Tuple{SimulationModel}" href="#Persefone.mintemp-Tuple{SimulationModel}"><code>Persefone.mintemp</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">mintemp(model)</code></pre><p>Return today's minimum temperature in °C.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L105-L109">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.precipitation-Tuple{SimulationModel}" href="#Persefone.precipitation-Tuple{SimulationModel}"><code>Persefone.precipitation</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">precipitation(model)</code></pre><p>Return today's total precipitation in mm.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L60-L64">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.sunshine-Tuple{SimulationModel}" href="#Persefone.sunshine-Tuple{SimulationModel}"><code>Persefone.sunshine</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">sunshine(model)</code></pre><p>Return today's sunshine duration in hours.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L69-L73">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.vapourpressure-Tuple{SimulationModel}" href="#Persefone.vapourpressure-Tuple{SimulationModel}"><code>Persefone.vapourpressure</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">vapourpressure(model)</code></pre><p>Return today's average vapour pressure in hPa.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L78-L82">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.windspeed-Tuple{SimulationModel}" href="#Persefone.windspeed-Tuple{SimulationModel}"><code>Persefone.windspeed</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">windspeed(model)</code></pre><p>Return today's average windspeed in m/s.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/world/weather.jl#L51-L55">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="CHANGELOG.html">« Changelog</a><a class="docs-footer-nextpage" href="io.html">Input and Output »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/skylark.html b/docs/build/skylark.html new file mode 100644 index 0000000000000000000000000000000000000000..064fa88b71fc0c2446842d97878aed9181cd741c --- /dev/null +++ b/docs/build/skylark.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Skylark · Persefone.jl</title><meta name="title" content="Skylark · Persefone.jl"/><meta property="og:title" content="Skylark · Persefone.jl"/><meta property="twitter:title" content="Skylark · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li class="is-active"><a class="tocitem" href="skylark.html">Skylark</a><ul class="internal"><li><a class="tocitem" href="#.-Purpose"><span>1. Purpose</span></a></li><li><a class="tocitem" href="#.-Entities,-state-variables,-and-scales"><span>2. Entities, state variables, and scales</span></a></li><li><a class="tocitem" href="#.-Process-overview-and-scheduling"><span>3. Process overview and scheduling</span></a></li><li><a class="tocitem" href="#.-Design-concepts"><span>4. Design concepts</span></a></li><li><a class="tocitem" href="#.-Initialisation"><span>5. Initialisation</span></a></li><li><a class="tocitem" href="#.-Input-data"><span>6. Input data</span></a></li><li><a class="tocitem" href="#.-Submodels"><span>7. Submodels</span></a></li><li><a class="tocitem" href="#.-References"><span>8. References</span></a></li></ul></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Scientific documentation</a></li><li class="is-active"><a href="skylark.html">Skylark</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="skylark.html">Skylark</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/skylark.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Skylark"><a class="docs-heading-anchor" href="#Skylark">Skylark</a><a id="Skylark-1"></a><a class="docs-heading-anchor-permalink" href="#Skylark" title="Permalink"></a></h1><p><em>Alauda arvensis</em> is a common and charismatic species of agricultural landscapes. This animal model is one component of the <a href="architecture.html"><code>nature</code></a> submodel of Persefone.jl.</p><p>The model description follows the ODD (Overview, Design concepts, Details) protocol (Grimm et al., <a href="https://doi.org/10.1016/j.ecolmodel.2006.04.023">2006</a>; <a href="https://doi.org/10.1016/j.ecolmodel.2010.08.019">2010</a>; <a href="https://doi.org/10.18564/jasss.4259">2020</a>):</p><h2 id=".-Purpose"><a class="docs-heading-anchor" href="#.-Purpose">1. Purpose</a><a id=".-Purpose-1"></a><a class="docs-heading-anchor-permalink" href="#.-Purpose" title="Permalink"></a></h2><p>The purpose of this animal model is to simulate the abundance and distribution of a population of <em>Alauda arvensis</em> in response to farm management in Central European agricultural landscapes.</p><h2 id=".-Entities,-state-variables,-and-scales"><a class="docs-heading-anchor" href="#.-Entities,-state-variables,-and-scales">2. Entities, state variables, and scales</a><a id=".-Entities,-state-variables,-and-scales-1"></a><a class="docs-heading-anchor-permalink" href="#.-Entities,-state-variables,-and-scales" title="Permalink"></a></h2><h3 id=".1-Landscape"><a class="docs-heading-anchor" href="#.1-Landscape">2.1 Landscape</a><a id=".1-Landscape-1"></a><a class="docs-heading-anchor-permalink" href="#.1-Landscape" title="Permalink"></a></h3><p>The <a href="gis.html">simulated landscape</a> consists of a grid of pixels with a resolution of 10m and can have an extent of 20km²-200km² (approximately; depending on the chosen input map). Each pixel is assigned a land cover class. It may also be associated with a farm plot, in which case it will contain information about the type and growth stage of the crop planted here. <a href="management.html">Farm management</a> determines which crops are grown when, and when disturbance (e.g. mowing, harvesting, tillage) takes place.</p><h3 id=".2-Animals"><a class="docs-heading-anchor" href="#.2-Animals">2.2 Animals</a><a id=".2-Animals-1"></a><a class="docs-heading-anchor-permalink" href="#.2-Animals" title="Permalink"></a></h3><p>The simulated individuals (a.k.a. agents) are mature <a href="species.html#Skylark">skylarks</a>. Each skylark is characterised by the following variables:</p><ul><li><p><code>ID</code> A unique identifier for this individual, which can be used to link it to its parents and its offspring.</p></li><li><p><code>sex</code> Male or female.</p></li><li><p><code>phase</code> The individual's current stage in the annual/life cycle. May be one of: <code>migration</code>, <code>nonbreeding</code>, <code>territorysearch</code>, <code>occupation</code>, <code>matesearch</code>, <code>nesting</code>, <code>breeding</code>.</p></li><li><p><code>position</code> The individual's position in the simulated landscape.</p></li><li><p><code>mate</code> The ID of the individual with which this individual has mated this year, if any.</p></li><li><p><code>territory</code> A list of coordinates of the positions in the landscape that this individual claims as its nesting and feeding territory.</p></li><li><p><code>nest</code> A coordinate giving the location of the currently active nest.</p></li><li><p><code>clutch</code> The number of juvenile (i.e. not yet independent) skylarks that this individual is currently raising.</p></li></ul><h2 id=".-Process-overview-and-scheduling"><a class="docs-heading-anchor" href="#.-Process-overview-and-scheduling">3. Process overview and scheduling</a><a id=".-Process-overview-and-scheduling-1"></a><a class="docs-heading-anchor-permalink" href="#.-Process-overview-and-scheduling" title="Permalink"></a></h2><p>The simulation proceeds in time steps of one day. Every day, each individual executes the function associated with their current life phase:</p><ul><li><code>migration</code>: The individual is held in a separate data structure (apart from the model landscape) and does nothing until its return date is reached. Then, it is re-introduced to the landscape and assigned the phase <code>territorysearch</code> (for males) or <code>matesearch</code> (for females).</li><li><code>territorysearch</code>: Males return first from migration. If they already have a territory from a previous year, they return to this. Otherwise, they move randomly through the landscape until they find a contiguous territory that satisfies their habitat requirements. Once a male has a territory, it changes its phase to <code>occupation</code>.</li><li><code>matesearch</code>: Females return later than males from their winter migration. If they already had a partner the previous year, they have a given probability of remaining with this partner. Otherwise, they move randomly through the landscape, looking for a male with a territory and without a partner. Once the female has a partner, it changes its phase to <code>nesting</code>.</li></ul><p>If an individual fails to find a territory or a mate, it changes its phase to <code>nonbreeding</code> once the breeding season is over.</p><ul><li><code>occupation</code>: The male moves at random about its territory until the breeding season is over. Then it changes its phase to <code>nonbreeding</code>. (<em>Note:</em> Skylark males actively help with feeding their chicks. However, feeding is only modelled indirectly here, through the process of habitat selection when the male forms its territory - see section 4.1.)</li><li><code>nesting</code>: The female selects a suitable location within the male's territory for the nest. Building the nest and laying eggs takes a number of days, during which she does nothing else. Then, she changes her phase to <code>breeding</code>.</li><li><code>breeding</code>: The female checks for mortality. The probability of brood loss varies with the age of the clutch and the nesting habitat. If and when the chicks reach independence (30 days after hatching), they are instantiated as new individuals in the <code>nonbreeding</code> phase.</li></ul><p>If a nest fails due to predation or disturbance, or a brood leaves the nest successfully, the female resets her phase to <code>nesting</code> and begins again if the breeding season is not yet over. If it is, she changes her phase to <code>nonbreeding</code>.</p><ul><li><code>nonbreeding</code>: Non-breeding mature birds move randomly around the landscape, keeping close to other individuals (flocking behaviour). Once their individual migration date is reached, they are removed from the landscape until the following year (see above). Mature birds have a mortality probability for their first summer, and others thereafter for each winter.</li></ul><h2 id=".-Design-concepts"><a class="docs-heading-anchor" href="#.-Design-concepts">4. Design concepts</a><a id=".-Design-concepts-1"></a><a class="docs-heading-anchor-permalink" href="#.-Design-concepts" title="Permalink"></a></h2><h3 id=".1-Basic-principles"><a class="docs-heading-anchor" href="#.1-Basic-principles">4.1 Basic principles</a><a id=".1-Basic-principles-1"></a><a class="docs-heading-anchor-permalink" href="#.1-Basic-principles" title="Permalink"></a></h3><p>This model assumes that the two most important drivers of skylark distribution and abundance are <strong>habitat availability</strong> and <strong>juvenile mortality</strong> (see literature below). The factors and processes affecting these are therefore given the most attention in the model, while other factors and processes are only included superficially, indirectly, or not at all. Specifically, this means that the phases <code>territorysearch</code>, <code>nesting</code>, and <code>breeding</code> are the most relevant and detailed parts of the model, as these determine the selection of habitat and the survival of offspring.</p><p>Furthermore, the model concentrates on predation and anthropogenic disturbance (through management actions such as mowing) as the main causes of juvenile mortality. Other causes, such as hunger or bad weather, are currently ignored as they are usually not significant.</p><p>The focus on habitat availability and juvenile mortality opens up two avenues by which agricultural management influences skylark populations. First, the farmers' choice of crops and date of sowing determines the quality of the habitat when skylarks select a territory. (For example, unlike summer grain, winter grain is already so high and dense in spring that it is generally avoided for nesting.) Secondly, the frequency and timing of management actions (especially mowing) is a major cause of brood loss. This means that there are direct causal links between agriculture and population trends.</p><p>Concentrating on these two drivers allows the rest of the model to be kept simple, reducing both the scientific complexity and computational costs. Thus, foraging movement (both during and after the breeding season) can be ignored or represented as random movement, as it does not directly impact either of the drivers. Likewise, chick growth and winter migration are represented very simply.</p><h3 id=".2-Emergence"><a class="docs-heading-anchor" href="#.2-Emergence">4.2 Emergence</a><a id=".2-Emergence-1"></a><a class="docs-heading-anchor-permalink" href="#.2-Emergence" title="Permalink"></a></h3><p>Multiple patterns emerge from the basic principles outlined above. The most important are listed here:</p><ul><li><strong>Territory size and population density:</strong> The model assumes that skylarks occupy only as much area as they need to satisfy their nesting and foraging requirements, and that population size is limited by the amount of available habitat. This means that territories in high-quality habitat are smaller than in low-quality habitat. Scaling up, this leads to a pattern whereby population densities are highest in open landscapes with a diversity of crops, grassland, semi-natural habitat, and lower in landscapes with low habitat diversity or many woody features.</li><li><strong>Ecological traps:</strong> Jenny (1990) describes a strong ecological trap effect whereby skylarks avoid winter grain crops, preferentially nesting in more open grassland sites. However, the mowing frequency associated with modern agriculture means that nest loss in grassland is almost assured, since there is insufficient time between two mowing dates to raise a brood. This means that landscape composition leads skylarks to breed in habitats that have a high mortality, resulting in population declines.</li></ul><h3 id=".3-Adaptation"><a class="docs-heading-anchor" href="#.3-Adaptation">4.3 Adaptation</a><a id=".3-Adaptation-1"></a><a class="docs-heading-anchor-permalink" href="#.3-Adaptation" title="Permalink"></a></h3><p>In the model, skylarks primarily adapt to their surroundings by choosing suitable territories. These are chosen by evaluating the quality of surrounding habitats for breeding and foraging, and occupying as much area as needed to satisfy requirements (see section 7.1).</p><h3 id=".4-Objectives"><a class="docs-heading-anchor" href="#.4-Objectives">4.4 Objectives</a><a id=".4-Objectives-1"></a><a class="docs-heading-anchor-permalink" href="#.4-Objectives" title="Permalink"></a></h3><p>Skylarks' main objective in the model is to have sufficient habitat available to raise a brood. Habitat quality is calculated as a function of habitat type, vegetation height, vegetation cover, and distance to vertical structures (see section 7.1).</p><h3 id=".5-Learning"><a class="docs-heading-anchor" href="#.5-Learning">4.5 Learning</a><a id=".5-Learning-1"></a><a class="docs-heading-anchor-permalink" href="#.5-Learning" title="Permalink"></a></h3><p>The model includes no learning by individuals.</p><h3 id=".6-Prediction"><a class="docs-heading-anchor" href="#.6-Prediction">4.6 Prediction</a><a id=".6-Prediction-1"></a><a class="docs-heading-anchor-permalink" href="#.6-Prediction" title="Permalink"></a></h3><p>The model includes no predictions by individuals.</p><h3 id=".7-Sensing"><a class="docs-heading-anchor" href="#.7-Sensing">4.7 Sensing</a><a id=".7-Sensing-1"></a><a class="docs-heading-anchor-permalink" href="#.7-Sensing" title="Permalink"></a></h3><p>Skylarks can perceive the landscape structure in a given radius around them (habitat type, vegetation height and cover). They can also see nearby conspecifics and are aware of the territories claimed by other individuals. When mating, they recognise whether another individual already has a mate, and mated individuals share information about their territory and brood status.</p><h3 id=".8-Interaction"><a class="docs-heading-anchor" href="#.8-Interaction">4.8 Interaction</a><a id=".8-Interaction-1"></a><a class="docs-heading-anchor-permalink" href="#.8-Interaction" title="Permalink"></a></h3><p>The model includes two direct forms of interaction. First, during mating, females move around the landscape looking for males who have a territory but no mate yet. Once they have found one, the two individuals set each other as their mate. Secondly, after the breeding seasons, individuals move around the landscape, keeping close to other individuals in their vicinity (flocking behaviour).</p><p>There are also indirect interactions, in that there is a competition for habitat (territory that has been claimed by one male cannot be occupied by another) and males (males that have mated with one female will not mate with another in the same season).</p><h3 id=".9-Stochasticity"><a class="docs-heading-anchor" href="#.9-Stochasticity">4.9 Stochasticity</a><a id=".9-Stochasticity-1"></a><a class="docs-heading-anchor-permalink" href="#.9-Stochasticity" title="Permalink"></a></h3><p>Stochasticity is used when modelling mortality and movement. Predation mortality is modelled as an age- and habitat-dependent probability, while migration mortality is a simple probability. Dispersal movement (when searching for a territory or a mate) is modelled as a random walk, as it is assumed that skylarks are not significantly impeded in their long-range movement by habitats that are unsuitable for foraging or nesting. Foraging movement by the male and by non-breeding individuals is also random, as it is desirable to show movement (to help model analysis) but unimportant to model this exactly.</p><h3 id=".10-Collectives"><a class="docs-heading-anchor" href="#.10-Collectives">4.10 Collectives</a><a id=".10-Collectives-1"></a><a class="docs-heading-anchor-permalink" href="#.10-Collectives" title="Permalink"></a></h3><p>After the breeding season, skylarks move around in loose agglomerations (flocking behaviour). However, this has no relevant ecological effect.</p><h3 id=".11-Observation"><a class="docs-heading-anchor" href="#.11-Observation">4.11 Observation</a><a id=".11-Observation-1"></a><a class="docs-heading-anchor-permalink" href="#.11-Observation" title="Permalink"></a></h3><p><em>TODO</em></p><h2 id=".-Initialisation"><a class="docs-heading-anchor" href="#.-Initialisation">5. Initialisation</a><a id=".-Initialisation-1"></a><a class="docs-heading-anchor-permalink" href="#.-Initialisation" title="Permalink"></a></h2><p>At the beginning of a model run, pairs of skylarks are created on grassland and agricultural land, keeping a distance of 60m to vertical structures and allowing each pair approximately 3ha of suitable habitat (an average territory size in agricultural landscapes).</p><p>For details, see the <a href="https://git.idiv.de/persefone/persefone-model/-/blob/master/src/nature/species/skylark.jl?ref_type=heads">source code</a> and the associated <a href="nature.html#populations.jl">documentation</a>.</p><h2 id=".-Input-data"><a class="docs-heading-anchor" href="#.-Input-data">6. Input data</a><a id=".-Input-data-1"></a><a class="docs-heading-anchor-permalink" href="#.-Input-data" title="Permalink"></a></h2><p>The general input to Persefone (i.e. land use maps and weather data) is described <a href="gis.html">here</a>.</p><p>The following extract from the <a href="https://git.idiv.de/persefone/persefone-model/-/blob/master/src/nature/species/skylark.jl?ref_type=heads">source code</a> lists the species parameters and values used by the Skylark model, based on the literature cited below:</p><pre><code class="language-julia hljs">@species Skylark begin + const movementrange::Length = 500m #XXX arbitrary + const visionrange::Length = 200m #XXX arbitrary + + const eggtime::Int64 = 11 # days from laying to hatching + const nestlingtime::Int64 = 9 # days from hatching to leaving nest + const fledglingtime::Int64 = 21 # days from leaving the nest to independence + + #XXX predation mortality should be habitat-dependent + const eggpredationmortality::Float64 = 0.03 # per-day egg mortality from predation + const nestlingpredationmortality::Float64 = 0.03 # per-day nestling mortality from predation + const fledglingpredationmortality::Float64 = 0.01 # per-day fledgling mortality from predation + const firstyearmortality::Float64 = 0.38 # total mortality in the first year after independence + const migrationmortality::Float64 = 0.33 # chance of dying during the winter + + const minimumterritory = 5000m² # size of territory under ideal conditions + const mindistancetoedge = 60m # minimum distance of habitat to vertical structures + const maxforageheight = 50cm # maximum preferred vegetation height for foraging + const maxforagecover = 0.7 # maximum preferred vegetation cover for foraging + const nestingheight = (15cm, 25cm) # min and max preferred vegetation height for nesting + const nestingcover = (0.2, 0.5) # min and max preferred vegetation cover for nesting + + const matefaithfulness = 0.5 # chance of a female retaining her previous partner + const nestingbegin::Tuple{Int64,Int64} = (April, 10) # begin nesting in the middle of April + const nestbuildingtime::UnitRange{Int64} = 4:5 # 4-5 days needed to build a nest (doubled for first nest) + const eggsperclutch::UnitRange{Int64} = 2:5 # eggs laid per clutch + const nestingend::Int64 = July # last month of nesting +end</code></pre><h2 id=".-Submodels"><a class="docs-heading-anchor" href="#.-Submodels">7. Submodels</a><a id=".-Submodels-1"></a><a class="docs-heading-anchor-permalink" href="#.-Submodels" title="Permalink"></a></h2><h3 id=".1-Territory-formation"><a class="docs-heading-anchor" href="#.1-Territory-formation">7.1 Territory formation</a><a id=".1-Territory-formation-1"></a><a class="docs-heading-anchor-permalink" href="#.1-Territory-formation" title="Permalink"></a></h3><p><em>TODO</em></p><h3 id=".2-Juvenile-mortality"><a class="docs-heading-anchor" href="#.2-Juvenile-mortality">7.2 Juvenile mortality</a><a id=".2-Juvenile-mortality-1"></a><a class="docs-heading-anchor-permalink" href="#.2-Juvenile-mortality" title="Permalink"></a></h3><p><em>TODO</em></p><h2 id=".-References"><a class="docs-heading-anchor" href="#.-References">8. References</a><a id=".-References-1"></a><a class="docs-heading-anchor-permalink" href="#.-References" title="Permalink"></a></h2><ul><li><p>Bauer, H.-G., Bezzel, E., & Fiedler, W. (Eds.). (2012). Das Kompendium der Vögel Mitteleuropas: Ein umfassendes Handbuch zu Biologie, Gefährdung und Schutz (Einbändige Sonderausg. der 2., vollständig überarb. und erw. Aufl. 2005). AULA-Verlag</p></li><li><p>Delius, J. D. (1965). A Population Study of Skylarks Alauda Arvensis. <a href="https://doi.org/10.1111/j.1474-919X.1965.tb07332.x">Ibis, 107(4), 466–492.</a></p></li><li><p>Donald et al. (2002). Survival rates, causes of failure and productivity of Skylark Alauda arvensis nests on lowland farmland. <a href="https://doi.org/10.1046/j.1474-919X.2002.00101.x">Ibis, 144(4), 652–664.</a></p></li><li><p>Glutz von Blotzheim, Urs N. (Ed.). (1985). Handbuch der Vögel Mitteleuropas. Bd. 10. Passeriformes (Teil 1) 1. Alaudidae - Hirundidae. AULA-Verlag, Wiesbaden. ISBN 3-89104-019-9</p></li><li><p>Jenny, M. (1990). Territorialität und Brutbiologie der Feldlerche Alauda arvensis in einer intensiv genutzten Agrarlandschaft. <a href="https://doi.org/10.1007/BF01640998">Journal für Ornithologie, 131(3), 241–265.</a></p></li><li><p>Jeromin, K. (2002). Zur Ernährungsökologie der Feldlerche (Alauda arvensis L. 1758) in der Reproduktionsphase [Doctoral thesis]. <a href="https://macau.uni-kiel.de/receive/diss_mods_00000968">Christian-Albrechts-Universität zu Kiel.</a></p></li><li><p>Püttmanns et al. (2022). Habitat use and foraging parameters of breeding Skylarks indicate no seasonal decrease in food availability in heterogeneous farmland. <a href="https://doi.org/10.1002/ece3.8461">Ecology and Evolution, 12(1), e8461.</a></p></li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="crop-models.html">« Crop models</a><a class="docs-footer-nextpage" href="developing.html">Developing Persefone »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/species-dsl.html b/docs/build/species-dsl.html index a397a529b303cedb45930bd655af0db79be2653d..152247abaff34f90c97bf7f9af93c0827630f150 100644 --- a/docs/build/species-dsl.html +++ b/docs/build/species-dsl.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Defining new species · Persefone.jl</title><meta name="title" content="Defining new species · Persefone.jl"/><meta property="og:title" content="Defining new species · Persefone.jl"/><meta property="twitter:title" content="Defining new species · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li class="is-active"><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="species-dsl.html">Defining new species</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="species-dsl.html">Defining new species</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/species-dsl.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Defining-new-species"><a class="docs-heading-anchor" href="#Defining-new-species">Defining new species</a><a id="Defining-new-species-1"></a><a class="docs-heading-anchor-permalink" href="#Defining-new-species" title="Permalink"></a></h1><p>In order to make implementing new species as easy as possible, Persefone includes a <a href="https://doi.org/10.1016/j.ecoinf.2015.02.005">domain-specific language</a> (DSL) built from a collection of macros and functions.</p><p>Here is an example of what this looks like, using a hypothetical mermaid species:</p><pre><code class="language-julia hljs">@species Mermaid begin +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Defining new species · Persefone.jl</title><meta name="title" content="Defining new species · Persefone.jl"/><meta property="og:title" content="Defining new species · Persefone.jl"/><meta property="twitter:title" content="Defining new species · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li class="is-active"><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Developer guide</a></li><li class="is-active"><a href="species-dsl.html">Defining new species</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="species-dsl.html">Defining new species</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/species-dsl.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Defining-new-species"><a class="docs-heading-anchor" href="#Defining-new-species">Defining new species</a><a id="Defining-new-species-1"></a><a class="docs-heading-anchor-permalink" href="#Defining-new-species" title="Permalink"></a></h1><p>In order to make implementing new species as easy as possible, Persefone includes a <a href="https://doi.org/10.1016/j.ecoinf.2015.02.005">domain-specific language</a> (DSL) built from a collection of macros and functions.</p><p>Here is an example of what this looks like, using a hypothetical mermaid species:</p><pre><code class="language-julia hljs">@species Mermaid begin ageofmaturity = 2 pesticidemortality = 1.0 end @@ -29,4 +29,4 @@ end initphase = life habitat = @habitat(@landcover() == water) pairs=true -end</code></pre><p>A complete species definition consists of one call each to <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a>, <a href="nature.html#Persefone.@create-Tuple{Any, Any}"><code>@create</code></a>, <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a>, and one or more calls to <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>. Another important macro is <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>. Further macros are available to provide convenience wrappers for common functions. (See <a href="nature.html"><code>src/nature/nature.jl</code></a> for details.)</p><p>The first macro to call is <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a>. This takes two arguments: a species name and a definition block (enclosed in <code>begin</code> and <code>end</code> tags). Within the block, species-specific parameters and variables can be defined (and optionally given values) that should be available throughout a species' lifetime. </p><p>Next, each species must define one or more <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> blocks. The concept behind this is that species show different behaviours at different phases of their lifecycle. Each <code>@phase</code> block defines the behaviour in one of these phases. (Technically, it defines a function that will be called daily, so long as the species' <code>phase</code> variable is set to this phase.) Code in this section has access to the <code>model</code> object as well as a <code>self</code> object, which is the currently active <a href="nature.html#Persefone.Animal"><code>Animal</code></a> agent. Within a phase block, <a href="nature.html#Persefone.@respond-Tuple{Any, Any}"><code>@respond</code></a> can be used to define the species' response to a <a href="simulation.html#Persefone.FarmEvent"><code>FarmEvent</code></a> that affects the species' current location, while a variety of other macros provide wrappers to life history and movement functions from <a href="nature.html"><code>src/nature/populations.jl</code></a>.</p><p>The third macro to call is <a href="nature.html#Persefone.@create-Tuple{Any, Any}"><code>@create</code></a>. Like <code>@phase</code>, this defines a function with access to the <code>world</code> and <code>self</code> objects. This function is called whenever a new individual of this species is created (either at birth, or when the model is initialised).</p><p>The last macro that must be called is [<code>@populate</code>]. Whereas <code>@create</code> regulates the creation of individual animals, <code>@populate</code> determines how the population of a species is initialised at the start of a simulation. It does this by defining values for the parameters used by <a href="@ref"><code>initpopulation!</code></a>. The full list of parameters that can be used is documented under <a href="@ref"><code>PopInitParams</code></a>.</p><p>The final important macro is <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>. This defines a "habitat descriptor", i.e. a predicate function that tests whether or not a given landscape pixel is suitable for a specified purpose. Such habitat descriptors are used as arguments to various functions, for example for population initialisation or movement. The argument to <code>@habitat</code> consists of a logical expression, which has access to the animal's current position (the <code>pos</code> tuple variable) and the <code>model</code>. Various macros are available to easily reference information about the current location, such as <a href="nature.html#Persefone.@landcover-Tuple{}"><code>@landcover</code></a> or <a href="nature.html#Persefone.@distancetoedge-Tuple{}"><code>@distancetoedge</code></a>.</p><p>All of these macros are defined in <a href="https://git.idiv.de/persefone/persefone-model/-/blob/master/src/nature/macros.jl"><code>src/nature/macros.jl</code></a>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="gis.html">« Maps and weather data</a><a class="docs-footer-nextpage" href="simulation.html">Simulation »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +end</code></pre><p>A complete species definition consists of one call each to <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a>, <a href="nature.html#Persefone.@create-Tuple{Any, Any}"><code>@create</code></a>, <a href="nature.html#Persefone.@populate-Tuple{Any, Any}"><code>@populate</code></a>, and one or more calls to <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a>. Another important macro is <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>. Further macros are available to provide convenience wrappers for common functions. (See <a href="nature.html"><code>src/nature/nature.jl</code></a> for details.)</p><p>The first macro to call is <a href="nature.html#Persefone.@species-Tuple{Any, Any}"><code>@species</code></a>. This takes two arguments: a species name and a definition block (enclosed in <code>begin</code> and <code>end</code> tags). Within the block, species-specific parameters and variables can be defined (and optionally given values) that should be available throughout a species' lifetime. </p><p>Next, each species must define one or more <a href="nature.html#Persefone.@phase-Tuple{Any, Any, Any}"><code>@phase</code></a> blocks. The concept behind this is that species show different behaviours at different phases of their lifecycle. Each <code>@phase</code> block defines the behaviour in one of these phases. (Technically, it defines a function that will be called daily, so long as the species' <code>phase</code> variable is set to this phase.) Code in this section has access to the <code>model</code> object as well as a <code>self</code> object, which is the currently active <a href="nature.html#Persefone.Animal"><code>Animal</code></a> agent. Within a phase block, <a href="nature.html#Persefone.@respond-Tuple{Any, Any}"><code>@respond</code></a> can be used to define the species' response to a <a href="simulation.html#Persefone.FarmEvent"><code>FarmEvent</code></a> that affects the species' current location, while a variety of other macros provide wrappers to life history and movement functions from <a href="nature.html"><code>src/nature/populations.jl</code></a>.</p><p>The third macro to call is <a href="nature.html#Persefone.@create-Tuple{Any, Any}"><code>@create</code></a>. Like <code>@phase</code>, this defines a function with access to the <code>world</code> and <code>self</code> objects. This function is called whenever a new individual of this species is created (either at birth, or when the model is initialised).</p><p>The last macro that must be called is [<code>@populate</code>]. Whereas <code>@create</code> regulates the creation of individual animals, <code>@populate</code> determines how the population of a species is initialised at the start of a simulation. It does this by defining values for the parameters used by <a href="@ref"><code>initpopulation!</code></a>. The full list of parameters that can be used is documented under <a href="@ref"><code>PopInitParams</code></a>.</p><p>The final important macro is <a href="nature.html#Persefone.@habitat-Tuple{Any}"><code>@habitat</code></a>. This defines a "habitat descriptor", i.e. a predicate function that tests whether or not a given landscape pixel is suitable for a specified purpose. Such habitat descriptors are used as arguments to various functions, for example for population initialisation or movement. The argument to <code>@habitat</code> consists of a logical expression, which has access to the animal's current position (the <code>pos</code> tuple variable) and the <code>model</code>. Various macros are available to easily reference information about the current location, such as <a href="nature.html#Persefone.@landcover-Tuple{}"><code>@landcover</code></a> or <a href="nature.html#Persefone.@distancetoedge-Tuple{}"><code>@distancetoedge</code></a>.</p><p>All of these macros are defined in <a href="https://git.idiv.de/persefone/persefone-model/-/blob/master/src/nature/macros.jl"><code>src/nature/macros.jl</code></a>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="gis.html">« Maps and weather data</a><a class="docs-footer-nextpage" href="CHANGELOG.html">Changelog »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/species.html b/docs/build/species.html index 503979754711dcbf6704f13c43ab096a36e3ec2f..4b9c3f8174532821e482d5824d9713b862f1f7ac 100644 --- a/docs/build/species.html +++ b/docs/build/species.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Species · Persefone.jl</title><meta name="title" content="Species · Persefone.jl"/><meta property="og:title" content="Species · Persefone.jl"/><meta property="twitter:title" content="Species · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li class="is-active"><a class="tocitem" href="species.html">Species</a><ul class="internal"><li><a class="tocitem" href="#Skylark"><span>Skylark</span></a></li></ul></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Nature</a></li><li class="is-active"><a href="species.html">Species</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="species.html">Species</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/species.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Species"><a class="docs-heading-anchor" href="#Species">Species</a><a id="Species-1"></a><a class="docs-heading-anchor-permalink" href="#Species" title="Permalink"></a></h1><p>The ecological submodel in Persefone simulates a range of species in agricultural landscapes.</p><h2 id="Skylark"><a class="docs-heading-anchor" href="#Skylark">Skylark</a><a id="Skylark-1"></a><a class="docs-heading-anchor-permalink" href="#Skylark" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Skylark" href="#Persefone.Skylark"><code>Persefone.Skylark</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Skylark</code></pre><p><em>Alauda arvensis</em> is a common and charismatic species of agricultural landscapes. At the moment, this implementation is still in development.</p><p><strong>Sources:</strong> - Bauer, H.-G., Bezzel, E., & Fiedler, W. (Eds.). (2012). Das Kompendium der Vögel Mitteleuropas: Ein umfassendes Handbuch zu Biologie, Gefährdung und Schutz (Einbändige Sonderausg. der 2., vollständig überarb. und erw. Aufl. 2005). AULA-Verlag - Glutz von Blotzheim, Urs N. (Ed.). (1985). Handbuch der Vögel Mitteleuropas. Bd. 10. Passeriformes (Teil 1) 1. Alaudidae - Hirundidae. AULA-Verlag, Wiesbaden. ISBN 3-89104-019-9</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L15-L31">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.breeding-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.breeding-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.breeding</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Do lots of foraging (not yet implemented).</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L214-L216">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.create!-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.create!-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.create!</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Initialise a skylark individual. Selects migration dates and checks if the bird should currently be on migration. Also sets other individual-specific variables.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L254-L257">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.egg-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.egg-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.egg</code></a> — <span class="docstring-category">Method</span></header><section><div><p>As an egg, simply check for mortality and hatching.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L64-L66">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.fledgling-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.fledgling-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.fledgling</code></a> — <span class="docstring-category">Method</span></header><section><div><p>As a fledgling, move around a little, but mainly wait for maturity and check mortality.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L94-L97">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.mating-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.mating-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.mating</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Move around until a mate is found.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L137-L139">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.migrationdates-Tuple{Animal, SimulationModel}" href="#Persefone.migrationdates-Tuple{Animal, SimulationModel}"><code>Persefone.migrationdates</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">migrationdates(skylark, model)</code></pre><p>Select the dates on which this skylark will leave for / return from its migration, based on observed migration patterns.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L237-L242">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nestbuilding-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.nestbuilding-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.nestbuilding</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Females select a location and build a nest. Males do nothing. (Sound familiar?)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L172-L174">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nestling-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.nestling-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.nestling</code></a> — <span class="docstring-category">Method</span></header><section><div><p>As a nestling, simply check for mortality and fledging.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L76-L78">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nonbreeding-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.nonbreeding-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.nonbreeding</code></a> — <span class="docstring-category">Method</span></header><section><div><p>As a non-breeding adult, move around with other individuals and check for migration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/897e96cdbc5ff1da5b1f1061fc362f5236441128/src/nature/species/skylark.jl#L114-L116">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="energy.html">« Dynamic Energy Budgets</a><a class="docs-footer-nextpage" href="crops.html">Crop submodel »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Species models · Persefone.jl</title><meta name="title" content="Species models · Persefone.jl"/><meta property="og:title" content="Species models · Persefone.jl"/><meta property="twitter:title" content="Species models · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="using.html">The Persefone.jl Package</a></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li class="is-active"><a class="tocitem" href="species.html">Species models</a><ul class="internal"><li><a class="tocitem" href="#Skylark"><span>Skylark</span></a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Software API</a></li><li class="is-active"><a href="species.html">Species models</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="species.html">Species models</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/species.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Species-models"><a class="docs-heading-anchor" href="#Species-models">Species models</a><a id="Species-models-1"></a><a class="docs-heading-anchor-permalink" href="#Species-models" title="Permalink"></a></h1><p>The ecological submodel in Persefone simulates a range of species in agricultural landscapes.</p><h2 id="Skylark"><a class="docs-heading-anchor" href="#Skylark">Skylark</a><a id="Skylark-1"></a><a class="docs-heading-anchor-permalink" href="#Skylark" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.Skylark" href="#Persefone.Skylark"><code>Persefone.Skylark</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Skylark</code></pre><p><em>Alauda arvensis</em> is a common and charismatic species of agricultural landscapes.</p><p><strong>Sources:</strong> - Bauer, H.-G., Bezzel, E., & Fiedler, W. (Eds.). (2012). Das Kompendium der Vögel Mitteleuropas: Ein umfassendes Handbuch zu Biologie, Gefährdung und Schutz (Einbändige Sonderausg. der 2., vollständig überarb. und erw. Aufl. 2005). AULA-Verlag - Delius, J. D. (1965). A Population Study of Skylarks Alauda Arvensis. Ibis, 107(4), 466–492. https://doi.org/10.1111/j.1474-919X.1965.tb07332.x - Donald et al. (2002). Survival rates, causes of failure and productivity of Skylark Alauda arvensis nests on lowland farmland. Ibis, 144(4), 652–664. https://doi.org/10.1046/j.1474-919X.2002.00101.x - Glutz von Blotzheim, Urs N. (Ed.). (1985). Handbuch der Vögel Mitteleuropas. Bd. 10. Passeriformes (Teil 1) 1. Alaudidae - Hirundidae. AULA-Verlag, Wiesbaden. ISBN 3-89104-019-9 - Jenny, M. (1990). Territorialität und Brutbiologie der Feldlerche Alauda arvensis in einer intensiv genutzten Agrarlandschaft. Journal für Ornithologie, 131(3), 241–265. https://doi.org/10.1007/BF01640998 - Püttmanns et al. (2022). Habitat use and foraging parameters of breeding Skylarks indicate no seasonal decrease in food availability in heterogeneous farmland. Ecology and Evolution, 12(1), e8461. https://doi.org/10.1002/ece3.8461</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L14-L38">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.#898#fun" href="#Persefone.#898#fun"><code>Persefone.#898#fun</code></a> — <span class="docstring-category">Function</span></header><section><div><p>Initialise the skylark population. Creates pairs of skylarks on grassland and agricultural land, keeping a distance of 60m to vertical structures and giving each pair an area of 3ha.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L384-L387">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.allowsnesting-Tuple{Persefone.Skylark, SimulationModel, Tuple{Int64, Int64}}" href="#Persefone.allowsnesting-Tuple{Persefone.Skylark, SimulationModel, Tuple{Int64, Int64}}"><code>Persefone.allowsnesting</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">allowsnesting(skylark, model, pos)</code></pre><p>Check whether the given position is suitable for nesting.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L338-L342">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.breeding-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.breeding-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.breeding</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Females that have laid eggs take care of their chicks, restarting the nesting process once the chicks are independent or in case of brood loss.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L216-L219">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.create!-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.create!-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.create!</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Initialise a skylark individual. Selects migration dates and checks if the bird should currently be on migration. Also sets other individual-specific variables.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L367-L370">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.destroynest!-Tuple{Persefone.Skylark, String}" href="#Persefone.destroynest!-Tuple{Persefone.Skylark, String}"><code>Persefone.destroynest!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">destroynest!(skylark, reason)</code></pre><p>Remove the skylark's nest and offspring due to disturbance or predation.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L354-L358">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.findterritory-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.findterritory-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.findterritory</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">findterritory(skylark, model)</code></pre><p>Check whether the habitat surrounding the skylark is suitable for establishing a territory. If it is, return the list of coordinates that make up the new territory, else return an empty list.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L271-L276">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.foragequality-Tuple{Persefone.Skylark, SimulationModel, Tuple{Int64, Int64}}" href="#Persefone.foragequality-Tuple{Persefone.Skylark, SimulationModel, Tuple{Int64, Int64}}"><code>Persefone.foragequality</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">foragequality(skylark, model, pos)</code></pre><p>Calculate the relative quality of the habitat at this position for foraging. This assumes that open habitat is best (quality = 1.0), and steadily decreases as vegetation height and/or cover increase. (Linear regressions based on Püttmanns et al., 2021; Jeromin, 2002; Jenny, 1990b.)</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L318-L325">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.matesearch-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.matesearch-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.matesearch</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Females returning from migration move around to look for a suitable partner with a territory.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L139-L141">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.migrationdates-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.migrationdates-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.migrationdates</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">migrationdates(skylark, model)</code></pre><p>Select the dates on which this skylark will leave for / return from its migration, based on observed migration patterns.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L254-L259">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nesting-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.nesting-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.nesting</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Females that have found a partner build a nest and lay eggs in a suitable location.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L178-L180">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.nonbreeding-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.nonbreeding-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.nonbreeding</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Non-breeding adults move around with other individuals and check for migration.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L81-L83">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.occupation-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.occupation-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.occupation</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Once a male has found a territory, he remains in it until the breeding season is over, adjusting it to new conditions when and as necessary.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L123-L126">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Persefone.territorysearch-Tuple{Persefone.Skylark, SimulationModel}" href="#Persefone.territorysearch-Tuple{Persefone.Skylark, SimulationModel}"><code>Persefone.territorysearch</code></a> — <span class="docstring-category">Method</span></header><section><div><p>Males returning from migration move around to look for suitable habitats to establish a territory.</p></div><a class="docs-sourcelink" target="_blank" href="https://git.idiv.de/persefone/persefone-model/-/tree/5deb9734033c9525fc3f44ee230c91c4801a0b5c/src/nature/species/skylark.jl#L102-L104">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="nature.html">« Nature submodel</a><a class="docs-footer-nextpage" href="crops.html">Crop submodel »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/build/using.html b/docs/build/using.html index 4634379fecd805b97eed46ff5036ed9199d4291e..2d94efb3aab40d67691805ef6064f65d0af822a7 100644 --- a/docs/build/using.html +++ b/docs/build/using.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>The Persefone.jl Package · Persefone.jl</title><meta name="title" content="The Persefone.jl Package · Persefone.jl"/><meta property="og:title" content="The Persefone.jl Package · Persefone.jl"/><meta property="twitter:title" content="The Persefone.jl Package · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li class="is-active"><a class="tocitem" href="using.html">The Persefone.jl Package</a><ul class="internal"><li><a class="tocitem" href="#Installation"><span>Installation</span></a></li><li><a class="tocitem" href="#Running-from-the-command-line"><span>Running from the command line</span></a></li><li><a class="tocitem" href="#Running-from-within-Julia"><span>Running from within Julia</span></a></li></ul></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li></ul></li><li><span class="tocitem">Core</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li></ul></li><li><span class="tocitem">Nature</span><ul><li><a class="tocitem" href="nature.html">Nature</a></li><li><a class="tocitem" href="energy.html">Dynamic Energy Budgets</a></li><li><a class="tocitem" href="species.html">Species</a></li></ul></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">User guide</a></li><li class="is-active"><a href="using.html">The Persefone.jl Package</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="using.html">The Persefone.jl Package</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/using.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="The-Persefone.jl-Package"><a class="docs-heading-anchor" href="#The-Persefone.jl-Package">The Persefone.jl Package</a><a id="The-Persefone.jl-Package-1"></a><a class="docs-heading-anchor-permalink" href="#The-Persefone.jl-Package" title="Permalink"></a></h1><p><em>This page describes how to run Persefone.jl as a command line application or Julia package, which is the default mode. To use the model with a graphical user interface, see <a href="gui.html">here</a>.</em></p><h2 id="Installation"><a class="docs-heading-anchor" href="#Installation">Installation</a><a id="Installation-1"></a><a class="docs-heading-anchor-permalink" href="#Installation" title="Permalink"></a></h2><p><em>For more detailed installation instructions, see <a href="developing.html">here</a>.</em></p><p>Install the latest version of the <a href="https://julialang.org/downloads/">Julia</a> programming language (1.10+). The recommended editors are <a href="https://www.julia-vscode.org/">VSCode</a> or <a href="https://www.emacswiki.org/emacs/JuliaProgrammingLanguage">Emacs</a>. To install the package dependencies, open a Julia REPL in this folder and run:</p><pre><code class="language-julia hljs">using Pkg +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>The Persefone.jl Package · Persefone.jl</title><meta name="title" content="The Persefone.jl Package · Persefone.jl"/><meta property="og:title" content="The Persefone.jl Package · Persefone.jl"/><meta property="twitter:title" content="The Persefone.jl Package · Persefone.jl"/><meta name="description" content="Documentation for Persefone.jl."/><meta property="og:description" content="Documentation for Persefone.jl."/><meta property="twitter:description" content="Documentation for Persefone.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="index.html"><img src="assets/logo.png" alt="Persefone.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Introduction</a></li><li><span class="tocitem">User guide</span><ul><li class="is-active"><a class="tocitem" href="using.html">The Persefone.jl Package</a><ul class="internal"><li><a class="tocitem" href="#Installation"><span>Installation</span></a></li><li><a class="tocitem" href="#Running-from-the-command-line"><span>Running from the command line</span></a></li><li><a class="tocitem" href="#Running-from-within-Julia"><span>Running from within Julia</span></a></li></ul></li><li><a class="tocitem" href="gui.html">Graphical User Interface</a></li><li><a class="tocitem" href="config.html">Configuration</a></li></ul></li><li><span class="tocitem">Scientific documentation</span><ul><li><a class="tocitem" href="management.html">Farm management</a></li><li><a class="tocitem" href="crop-models.html">Crop models</a></li><li><a class="tocitem" href="skylark.html">Skylark</a></li></ul></li><li><span class="tocitem">Developer guide</span><ul><li><a class="tocitem" href="developing.html">Developing Persefone</a></li><li><a class="tocitem" href="adapting.html">Adapting Persefone</a></li><li><a class="tocitem" href="architecture.html">Source code architecture</a></li><li><a class="tocitem" href="gis.html">Maps and weather data</a></li><li><a class="tocitem" href="species-dsl.html">Defining new species</a></li><li><a class="tocitem" href="CHANGELOG.html">Changelog</a></li></ul></li><li><span class="tocitem">Software API</span><ul><li><a class="tocitem" href="simulation.html">Simulation</a></li><li><a class="tocitem" href="io.html">Input and Output</a></li><li><a class="tocitem" href="nature.html">Nature submodel</a></li><li><a class="tocitem" href="species.html">Species models</a></li><li><a class="tocitem" href="crops.html">Crop submodel</a></li><li><a class="tocitem" href="farm.html">Farm submodel</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">User guide</a></li><li class="is-active"><a href="using.html">The Persefone.jl Package</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="using.html">The Persefone.jl Package</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://git.idiv.de/persefone/persefone-model/-/tree/master/docs/src/using.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="The-Persefone.jl-Package"><a class="docs-heading-anchor" href="#The-Persefone.jl-Package">The Persefone.jl Package</a><a id="The-Persefone.jl-Package-1"></a><a class="docs-heading-anchor-permalink" href="#The-Persefone.jl-Package" title="Permalink"></a></h1><p><em>This page describes how to run Persefone.jl as a command line application or Julia package, which is the default mode. To use the model with a graphical user interface, see <a href="gui.html">here</a>.</em></p><h2 id="Installation"><a class="docs-heading-anchor" href="#Installation">Installation</a><a id="Installation-1"></a><a class="docs-heading-anchor-permalink" href="#Installation" title="Permalink"></a></h2><p><em>For more detailed installation instructions, see <a href="developing.html">here</a>.</em></p><p>Install the latest version of the <a href="https://julialang.org/downloads/">Julia</a> programming language (1.10+). The recommended editors are <a href="https://www.julia-vscode.org/">VSCode</a> or <a href="https://www.emacswiki.org/emacs/JuliaProgrammingLanguage">Emacs</a>. To install the package dependencies, open a Julia REPL in this folder and run:</p><pre><code class="language-julia hljs">using Pkg Pkg.activate(".") Pkg.instantiate()</code></pre><h2 id="Running-from-the-command-line"><a class="docs-heading-anchor" href="#Running-from-the-command-line">Running from the command line</a><a id="Running-from-the-command-line-1"></a><a class="docs-heading-anchor-permalink" href="#Running-from-the-command-line" title="Permalink"></a></h2><p>This is the normal mode of operation. Simply execute <code>run.jl</code> in a terminal, typically like so (in Linux):</p><pre><code class="nohighlight hljs">> julia run.jl -c <config></code></pre><p>where <code><config></code> specifies the configuration file to use. The recommended workflow is to copy <code>scr/parameters.toml</code> to a location of your choice and edit the copy to suit your requirements. The adapted config file can then be passed to <code>run.jl</code>. (If no configuration file is specified, Persefone will run with its default settings.)</p><p>The full list of commandline arguments is:</p><pre><code class="nohighlight hljs">usage: run.jl [-c CONFIGFILE] [-s SEED] [-o OUTDIR] [-l LOGLEVEL] [--version] [-h] @@ -18,4 +18,4 @@ optional arguments: > make docs # build the documentation > make release # create a release</code></pre><h2 id="Running-from-within-Julia"><a class="docs-heading-anchor" href="#Running-from-within-Julia">Running from within Julia</a><a id="Running-from-within-Julia-1"></a><a class="docs-heading-anchor-permalink" href="#Running-from-within-Julia" title="Permalink"></a></h2><p>To use the model from within Julia (either inside an interactive REPL or if you want to import it from your own software), do the following:</p><pre><code class="language-julia hljs">using Pkg Pkg.activate(".") # assuming you're in the Persefone root folder -using Persefone</code></pre><p>You can then access all Persefone functions, such as <a href="simulation.html#Persefone.simulate"><code>simulate</code></a>, <a href="simulation.html#Persefone.initialise"><code>initialise</code></a>, <a href="simulation.html#Persefone.stepsimulation!-Tuple{SimulationModel}"><code>stepsimulation!</code></a>, <a href="simulation.html#Persefone.simulate!-Tuple{SimulationModel}"><code>simulate!</code></a>, or <a href="io.html#Persefone.visualiseoutput-Tuple{SimulationModel}"><code>visualiseoutput</code></a>. (See <code>src/Persefone.jl</code> for a list of exported functions.)</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="index.html">« Introduction</a><a class="docs-footer-nextpage" href="gui.html">Graphical User Interface »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 16 July 2024 13:54">Tuesday 16 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +using Persefone</code></pre><p>You can then access all Persefone functions, such as <a href="simulation.html#Persefone.simulate"><code>simulate</code></a>, <a href="simulation.html#Persefone.initialise"><code>initialise</code></a>, <a href="simulation.html#Persefone.stepsimulation!-Tuple{SimulationModel}"><code>stepsimulation!</code></a>, <a href="simulation.html#Persefone.simulate!-Tuple{SimulationModel}"><code>simulate!</code></a>, or <a href="io.html#Persefone.visualiseoutput-Tuple{SimulationModel}"><code>visualiseoutput</code></a>. (See <code>src/Persefone.jl</code> for a list of exported functions.)</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="index.html">« Introduction</a><a class="docs-footer-nextpage" href="gui.html">Graphical User Interface »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.1.2 on <span class="colophon-date" title="Tuesday 30 July 2024 11:45">Tuesday 30 July 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/docs/builddocs.jl b/docs/builddocs.jl index 53abafae255a1b03079092d928884f1c95a8ec40..2f7268b4378ff011ef149cf7ac98ea9fd7573d95 100644 --- a/docs/builddocs.jl +++ b/docs/builddocs.jl @@ -35,13 +35,12 @@ makedocs(sitename="Persefone.jl", "gis.md", "species-dsl.md", "CHANGELOG.md"], - "Core" => [ + "Software API" => [ "simulation.md", - "io.md"], - "Nature" => [ + "io.md", "nature.md", - "energy.md", - "species.md"], - "crops.md", - "farm.md" + #"energy.md", + "species.md", + "crops.md", + "farm.md"] ]) diff --git a/docs/src/index.md b/docs/src/index.md index 7105cf16dcec5d302d1f1778c8185ff2b0b1a13f..dc2db2bcafe7a5f626818dd1063188c097e0ced4 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 2024-07-29 for **Persefone.jl v0.5.1** (commit [402fa8e](https://git.idiv.de/persefone/persefone-model/-/commit/402fa8e)).* +*This documentation was last updated on 2024-07-30 for **Persefone.jl v0.5.2** (commit [5deb973](https://git.idiv.de/persefone/persefone-model/-/commit/5deb973)).* diff --git a/docs/src/nature.md b/docs/src/nature.md index 480e45764ffa9642c923f4e7de9cd47fd8e64c71..d4c64a7cdb3b7a8af4740c3537b0f9c169a17575 100644 --- a/docs/src/nature.md +++ b/docs/src/nature.md @@ -1,4 +1,4 @@ -# Nature +# Nature submodel ## nature.jl @@ -38,16 +38,6 @@ Modules = [Persefone] Pages = ["nature/populations.jl"] ``` -## insects.jl - -This file contains the insect submodel, which calculates the likely insect biomass -in a given location at a given time. (**NOTE: currently not used.**) - -```@autodocs -Modules = [Persefone] -Pages = ["nature/insects.jl"] -``` - ## ecologicaldata.jl This file contains a set of life-history related utility functions needed by species. diff --git a/docs/src/skylark.md b/docs/src/skylark.md index bc2dcffbdbc190f251a21b3b95c45bd313f6b0db..25f3356e7b566afe35b017584c226c88955d18f1 100644 --- a/docs/src/skylark.md +++ b/docs/src/skylark.md @@ -1,7 +1,7 @@ # Skylark *Alauda arvensis* is a common and charismatic species of agricultural landscapes. -This animal model is one component of the [`nature`](architecture) submodel of Persefone.jl. +This animal model is one component of the [`nature`](architecture.html) submodel of Persefone.jl. The model description follows the ODD (Overview, Design concepts, Details) protocol (Grimm et al., [2006](https://doi.org/10.1016/j.ecolmodel.2006.04.023); [2010](https://doi.org/10.1016/j.ecolmodel.2010.08.019); [2020](https://doi.org/10.18564/jasss.4259)): @@ -15,16 +15,16 @@ The purpose of this animal model is to simulate the abundance and distribution o ### 2.1 Landscape -The [simulated landscape](gis) consists of a grid of pixels with a resolution of 10m and +The [simulated landscape](gis.html) consists of a grid of pixels with a resolution of 10m and can have an extent of 20km²-200km² (approximately; depending on the chosen input map). Each pixel is assigned a land cover class. It may also be associated with a farm plot, in which case it will contain information about the type and growth stage of the crop -planted here. [Farm management](management) determines which crops are grown when, and +planted here. [Farm management](management.html) determines which crops are grown when, and when disturbance (e.g. mowing, harvesting, tillage) takes place. ### 2.2 Animals -The simulated individuals (a.k.a. agents) are mature [skylarks](species#Skylark). Each skylark +The simulated individuals (a.k.a. agents) are mature [skylarks](species.html#Skylark). Each skylark is characterised by the following variables: - `ID` A unique identifier for this individual, which can be used to link it to its parents @@ -202,11 +202,11 @@ At the beginning of a model run, pairs of skylarks are created on grassland and keeping a distance of 60m to vertical structures and allowing each pair approximately 3ha of suitable habitat (an average territory size in agricultural landscapes). -For details, see the [source code](https://git.idiv.de/persefone/persefone-model/-/blob/master/src/nature/species/skylark.jl?ref_type=heads) and the associated [documentation](nature#populations.jl). +For details, see the [source code](https://git.idiv.de/persefone/persefone-model/-/blob/master/src/nature/species/skylark.jl?ref_type=heads) and the associated [documentation](nature.html#populations.jl). ## 6. Input data -The general input to Persefone (i.e. land use maps and weather data) is described [here](gis). +The general input to Persefone (i.e. land use maps and weather data) is described [here](gis.html). The following extract from the [source code](https://git.idiv.de/persefone/persefone-model/-/blob/master/src/nature/species/skylark.jl?ref_type=heads) lists the species parameters and values used by the Skylark model, based on the literature cited below: diff --git a/docs/src/species.md b/docs/src/species.md index 7b6dcb2a5ebd290b91b8cb246e3f34dc642a8eca..13c9fabd9986c96b47f05f2e8cabafebdeb00400 100644 --- a/docs/src/species.md +++ b/docs/src/species.md @@ -1,4 +1,4 @@ -# Species +# Species models The ecological submodel in Persefone simulates a range of species in agricultural landscapes.