Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
gis.html 14.67 KiB
<!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">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
50: bare soil
60: agriculture</code></pre><p>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).</p><p>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 <code>Raster -&gt; Extraction -&gt; Clip Raster by Extent</code>. Select the Mundialis map as the input layer, set the clipping extent by choosing your region vector layer under <code>Calculate from Layer</code> and specify the output file name before clicking <code>Run</code>. This will generate a TIF file that you can pass to Persefone as the <code>landcovermap</code> parameter.</p><h2 id="Field-ID-maps"><a class="docs-heading-anchor" href="#Field-ID-maps">Field ID maps</a><a id="Field-ID-maps-1"></a><a class="docs-heading-anchor-permalink" href="#Field-ID-maps" title="Permalink"></a></h2><p>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.</p><p>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 <a href="https://thueringenviewer.thueringen.de/thviewer/invekos.html">here</a>. 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.</p><p>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 (&quot;Feldblockident&quot;) 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 &quot;FID&quot; and set it to a 32-bit integer), and enter <code>@row_number</code> in the  expression field. Then save the layer and close the calculator.</p><p>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&#39;re working with the Thüringen InVeKoS data (other data sets may have a different structure), right-click on the layer name in QGIS&#39; layer overview and click on &quot;Filter...&quot;. Then, enter this expression in the query builder: <code>&quot;BNK&quot; = &#39;AL&#39; OR &quot;BNK&quot; = &#39;GL&#39;</code> and click &quot;OK&quot;. This will select only field and grassland plots.</p><p>Next, open the rasteriser (<code>Raster -&gt; Conversion -&gt; Rasterize</code>). Select your FID field as the &quot;Field to use for a burn-in value&quot;, and your land cover map (as created above - this ensures the two layers match) as the output extent. Make sure  the &quot;fixed value to burn&quot; is &quot;Not set&quot;. Then choose &quot;Georeferenced units&quot; as the  &quot;Out raster size units&quot; and set horizontal and vertical resolution to 10.0. In  the advanced parameters, set the output data type to <code>UInt32</code>. Finally, enter an  output file name and run. The resulting TIF file can be passed to Persefone as the <code>farmfieldmap</code> parameter.</p><h2 id="Weather-data"><a class="docs-heading-anchor" href="#Weather-data">Weather data</a><a id="Weather-data-1"></a><a class="docs-heading-anchor-permalink" href="#Weather-data" title="Permalink"></a></h2><p>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 <a href="https://www.dwd.de/DE/leistungen/cdc/cdc_ueberblick-klimadaten.html?nn=16102">German weather service (DWD)</a>. The relevant data are in the folder <a href="https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/daily/kl/historical/"><code>daily/kl/historical</code></a>.</p><p>The description of this data set and the list of weather stations can be found in the Persefone repository, in the <code>docs</code> 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.</p><ul><li><strong>Region Jena:</strong> station number 02444 (&quot;Jena (Sternwarte)&quot;)</li><li><strong>Region Eichsfeld:</strong></li><li><strong>Region Thüringer Becken:</strong> station number 00896 (&quot;Dachwig&quot;)</li><li><strong>Region Hohenlohe:</strong></li><li><strong>Region Bodensee:</strong></li><li><strong>Region Nördlicher Oberrhein:</strong></li></ul><p>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).</p><p>Then use <code>data/extract_weather_data.R</code> to process the data into the format needed by Persefone:</p><pre><code class="language-R hljs">library(tidyverse)

## replace this with the correct file name
weatherfile = &quot;produkt_klima_tag_18210101_20221231_02444.txt&quot;

data = read.table(weatherfile, sep=&quot;;&quot;, header=T)

weather = data %&gt;%
    ## drop values before 2000 to save space
    filter(MESS_DATUM&gt;=20000101) %&gt;%
    ## select relevant variables and convert place-holder values to NA
    select(MESS_DATUM, FM, RSK, SDK, VPM, TMK, TXK, TNK) %&gt;%
    mutate(date=MESS_DATUM, MESS_DATUM=NULL,
           mean_windspeed=na_if(FM, -999), FM=NULL,
           precipitation=na_if(RSK, -999), RSK=NULL,
           sunshine_hours=na_if(SDK, -999), SDK=NULL,
           mean_vapour_pressure=na_if(VPM, -999), VPM=NULL,
           mean_temperature=na_if(TMK, -999), TMK=NULL,
           max_temperature=na_if(TXK, -999), TXK=NULL,
           min_temperature=na_if(TNK, -999), TNK=NULL)

## replace with the desired file name
write.csv(weather, file=&quot;weather_jena.csv&quot;, 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="Wednesday 11 September 2024 16:19">Wednesday 11 September 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>