Skip to content
Snippets Groups Projects

Pollen beetle migration model - spatial version

This model is based on the work of Ferguson et al., (2015) to predict migration risk of the Pollen Beetle. The default value of 15 degrees Celsius is used to predict migration risk, as that is the temperature advised in the UK at which pollen beetles will fly. The model can only be used between growth stage 51 and 59.

Technical description

The model has been implemented by NIBIO. It is designed to fit into the gridded pest prediction models of VIPS.

Software requirements

The model can only be run on Linux, as some of the tools mentioned below are only available on Linux. The development and testing of the model has been done using Ubuntu Linux 22.04LTS.

CDO and GDAL

The heavy lifting in this model is done by the tools CDO and GDAL. These tools need to be installed and available. CDO is only available on Linux.

Python requirements

The Python requirements are specified in requirements.txt file, and are included in the virtualenv created by the run_ADASMELIAE.sh (see below).

Input data requirements

The model (as per 2024-04-19) assumes that a weather data file named YYYY_with_forecast.nc is available in the WEATHER_DATA_DIR folder. The file must contain daily timesteps with the weather parameter air_temperature_2m_max.

Running the model

In order to run the model, the following environment variables need to be set:

# Default value is False
DEBUG=False
# This is used to auto generate some variables and file names
MODEL_ID="ADASMELIAE"
# The start date MM-DD of the model
START_DATE_MM_DD=03-01
# The end date MM-DD of the model
END_DATE_MM_DD=04-01
# Where your script resides
HOME_DIR=/foo/home/ADASMELIAE/
# Path to folder for intermediary results
TMP_DIR=/foo/home/ADASMELIAE/tmp/
# Path to the weather data
WEATHER_DATA_DIR=/foo/weather/
# Used to construct filename from current year
WEATHER_DATA_FILENAME_DATEFORMAT="%Y_with_forecast.nc"
# Path to the output (GeoTIFF) files as seen from the running model code
RESULT_TIF_DIR=/foo/out/tif/
# Path to the generated mapfile as seen from the running model code
RESULT_MAPFILE_DIR=/foo/out/mapfile/
# The path to the output (GeoTIFF files) as seen from Mapserver
MAPSERVER_RESULT_TIF_DIR=/foo/mapserver/data/ADASMELISAE/
# Where your generated MAPFILE and query templates should be placed
MAPSERVER_RESULT_MAPFILE_DIR=/foo/mapserver/wms/ADASMELISAE/
# Where mapserver logs for this WMS are written
MAPSERVER_LOG_FILE=/foo/mapserver/log/ADASMELISAE.log
# Path to the temporary directory for writing temporary files and images. Must be writable by the user the web server is running as
MAPSERVER_IMAGE_PATH=/foo/mapserver/image/
# The value of the EXTENT parameter in Mapserver's mapfile. Units are DD (Decimal degrees)
MAPSERVER_EXTENT="-23.5 29.5 62.5 70.5"
# Path to optional CSV file with polygons for masking result.
MASK_FILE=europe_coastline.csv

...this is the contents of the env-sample file

$ ./run_ADASMELIAE.sh

This creates a Python virtualenv, installs all the Python dependencies, runs the model and stores output in a log file.

All intermediary files are stored in the TMP_DIR folder, and they are all deleted when the model is done calculating. The GeoTIFF files are stored in the RESULT_TIF_DIR folder, and the generated mapfile is stored in the RESULT_MAPFILE_DIR folder

Viewing the result of the model

The model outputs GeoTIFF files, two per day in the season/period of calculation:

  • result_WARNING_STATUS_[YYYY-MM-DD].tif, which indicates migration risk.
    • 2 = Low migration risk (yellow)
    • 3 = Medium migration risk (orange)
    • 4 = High migration risk (red)
  • result_[YYYY-MM-DD].tif, which contains the daily maximum air temperature

A Jinja2 template mapfile (for Mapserver) with separate layers (WARNING_STATUS and temperature) for each date is found in the mapfile/ folder.

TODO Examples of the two layers are shown below

WARNING_STATUS example. Showing Norway and surrounding area

WARNING_STATUS example. Showing Norway

WHS (Wet Hour Sum) example. Showing Norway and surrounding area

WHS (Wet Hour Sum) example. Showing Norway