Something went wrong on our end
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
using.html 11.11 KiB
<!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</title><meta name="title" content="The Persefone.jl Package · Persefone"/><meta property="og:title" content="The Persefone.jl Package · Persefone"/><meta property="twitter:title" content="The Persefone.jl Package · Persefone"/><meta name="description" content="Documentation for Persefone."/><meta property="og:description" content="Documentation for Persefone."/><meta property="twitter:description" content="Documentation for Persefone."/><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 logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Persefone</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.9+). 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]
optional arguments:
-c, --configfile CONFIGFILE
name of the configuration file
-s, --seed SEED inital random seed (type: Int64)
-o, --outdir OUTDIR location of the output directory
-l, --loglevel LOGLEVEL
verbosity: "debug", "info", or "quiet"
--version show version information and exit
-h, --help show this help message and exit</code></pre><p>To run the test suite, switch to the <code>test</code> directory and execute <code>runtests.jl</code>.</p><p>If you are on Linux or MacOS, you can also use <code>make</code>:</p><pre><code class="nohighlight hljs">> make run # run a simulation with default values
> make test # run the test suite
> make profile # run and profile a default simulation
> 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{Agents.AgentBasedModel}"><code>stepsimulation!</code></a>, <a href="simulation.html#Persefone.simulate!-Tuple{Agents.AgentBasedModel}"><code>simulate!</code></a>, or <a href="io.html#Persefone.visualiseoutput"><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 31 October 2023 18:07">Tuesday 31 October 2023</span>. Using Julia version 1.9.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>