-
Lene Wasskog authoredLene Wasskog authored
template.j2 8.01 KiB
{# This Jinja2 template is used for generating a map file for the model #}
MAP
# This mapfile is generated using Jinja2 templates
#
# Copyright (C) 2024 NIBIO <https://www.nibio.no/>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
NAME "VIPS.ADASMELIAE"
# WGS84
EXTENT {{mapserver_extent}}
UNITS DD
CONFIG "MS_ERRORFILE" "{{mapserver_log_file}}"
PROJECTION
"init=epsg:4326"
END
WEB
IMAGEPATH "{{mapserver_image_path}}"
IMAGEURL "/tmp/"
# List of standard metadata: https://mapserver.org/ogc/wms_server.html#web-object-metadata
# i18n support: https://mapserver.org/ogc/inspire.html#inspire-multi-language-support
METADATA
"wms_keywordlist" "Pollen Beetle Migration Model (ADASMELIAE)"
{% if languages %}
"wms_inspire_capabilities" "embed"
"wms_languages" "{{ language_codes|join(",")}}" # The first is the default
{% endif %}
"wms_abstract" "
<div id='preamble'>
<p>Pollen beetle (Meligethes spp.) adults are approximately 2.5 mm, metallic
greenish-black. Oilseed rape is only vulnerable to pollen beetle damage if large
numbers of adult beetles migrate into the crop during green bud stage (BBCH
Growth stages 51-59). Adult females bite oilseed rape buds and lay their eggs
inside, resulting in withered buds and reduced pod set. Migration can be predicted
based on daily maximum air temperature; migrations begins at 12 degrees Celsius,
and large numbers migrate above 15 degrees Celsius. Where a high risk of migration
coincides with the vulnerable growth stage, crops should be monitored and an
appropriate threshold used to inform management decisions.
</p>
</div>
<div id='body'>
<p>This DSS was adapted from work carried out in the UK, and is considered applicable,
but not yet validated in, Belgium, Luxembourg, Netherlands, France, Germany, Rep.
Ireland, and Denmark. Only to be used during Oilseed rape growth stages 51-59.
This model is a simplification of a more detailed model described in Ferguson et
al. (2015) Pest Management Science 72, 609-317.
<a href='https://doi.org/10.1002/ps.4069'>https://doi.org/10.1002/ps.4069</a>
</p>
<h3>Explanation of parameters</h3>
<ul>
<li>Warning status = Yellow signifies temperatures below 12 degrees Celcius and low migration risk. Migrations begins at 12 degrees Celsius (orange), and large numbers migrate above 15 degrees Celsius (red).</li>
<li><span itemprop='temperature'>Maximum air temperature</span> = Daily maximum air temperatures are visualized using a color gradient. Areas with temperatures below 12°C are shaded in blue, indicating cooler weather. As temperatures increase, the color shifts gradually to red, with a full red shade marking areas above 22°C. </li>
</ul>
</div>
"
"wms_enable_request" "*"
"wms_title" "Pollen Beetle Migration Model"
"wms_getfeatureinfo_formatlist" "text/plain,text/html,text/xml"
"wms_accessconstraints" "none"
"wms_addresstype" ""
"wms_address" "Høgskoleveien 7"
"wms_city" "Ås"
"wms_stateorprovince" "Ås"
"wms_postcode" "1430"
"wms_country" "Norway"
"wms_contactelectronicmailaddress" "vips@nibio.no"
"wms_feature_info_mime_type" "text/html"
"wms_contactperson" "Berit Nordskog"
"wms_contactposition" "owner"
"wms_contactorganization" "Norsk institutt for bioøkonomi (NIBIO)"
END
END #web
############################# Start of legend #########################################################
# The legend configuration uses the CLASSITEM information in each layer to generate colour icons and labels
LEGEND
STATUS ON
KEYSIZE 16 12
LABEL
TYPE TRUETYPE
SIZE 10
COLOR 0 0 0
OFFSET 0 -3
END
END
{% for timestep_date in timestep_dates %}
LAYER
NAME "{{model_id}}.WARNING_STATUS.{{ timestep_date }}"
DATA "{{mapserver_data_dir}}result_WARNING_STATUS_{{ timestep_date }}.tif"
TEMPLATE "{{mapserver_mapfile_dir}}query_template.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS
TYPE RASTER
PROCESSING "BANDS=1" # WARNING_STATUS band on top (others invisible, but band values are available in the query template)
PROCESSING "NODATA=-1"
STATUS ON
METADATA
"wms_title" "Pollen Beetle Migration Model {{ timestep_date }}"
{% for language in languages %}
"wms_abstract.{{language.language_code}}" "
{
\"isWarningStatus\": true,
\"legendItems\": [
{
\"classification\": 2,
\"legendLabel\": \"{{ language.low_risk }}\",
\"legendIconCSS\": \"width: 25px; background-color: #FFDF00;\"
},
{
\"classification\": 3,
\"legendLabel\": \"{{ language.medium_risk }}\",
\"legendIconCSS\": \"width: 25px; background-color: #FF8C00;\"
},
{
\"classification\": 4,
\"legendLabel\": \"{{ language.high_risk }}\",
\"legendIconCSS\": \"width: 25px; background-color: #FF0000;\"
}
]
}
"
{% endfor %}
END
CLASSITEM "[pixel]"
# class using simple string comparison, equivalent to ([pixel] = 0)
CLASS
NAME "Low infection risk"
EXPRESSION ([pixel] >= 0 AND [pixel] <= 2)
STYLE
COLOR 255 223 0 # Yellow
END
END
CLASS
NAME "Medium infection risk"
EXPRESSION ([pixel] > 2 AND [pixel] <= 3)
STYLE
COLOR 255 140 0 # Orange
END
END
CLASS
NAME "High infection risk"
EXPRESSION ([pixel] > 3)
STYLE
COLOR 255 0 0 # Red
END
END
END # Layer
LAYER
NAME "{{model_id}}.temperature.{{ timestep_date }}"
DATA "{{mapserver_data_dir}}result_{{ timestep_date }}.tif"
TEMPLATE "{{mapserver_mapfile_dir}}query_template_temperature.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS
TYPE RASTER
#PROCESSING "BANDS=1" # Temperature band on top (others invisible, but band values are available in the query template)
#PROCESSING "SCALE=AUTO"
#PROCESSING "NODATA=-1"
STATUS ON
METADATA
"wms_title" "Pollen Beetle Migration Model temperature {{ timestep_date }}"
{% for language in languages %}
"wms_abstract.{{language.language_code}}" "
{
\"isWarningStatus\": false,
\"legendItems\": [
{
\"legendLabel\": \"{{ language.temperature }}\",
\"legendIconCSS\": \"width: 25px; background: linear-gradient(to right, #0000FF, #FF0000);\"
}
]
}
"
{% endfor %}
END
CLASSITEM "[pixel]"
CLASS
NAME "Below 12"
EXPRESSION ([pixel] < 12)
STYLE
COLOR 0 0 255 # RGB for blue
END
END
CLASS
NAME "Temperature range"
EXPRESSION ([pixel] >= 12 AND [pixel] <= 22)
STYLE
DATARANGE 12 22
COLORRANGE 0 0 255 255 0 0
END
END
CLASS
NAME "Above 22"
EXPRESSION ([pixel] > 22)
STYLE
COLOR 255 0 0 # RGB for red
END
END
END # Layer
{% endfor %}
END #map