Something went wrong on our end
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
crops.html 19.81 KiB
<!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>