Skip to content
Snippets Groups Projects

Naerstad Potato Blight Model - spatial version

The model is based on several years of experiments where trap plants have been placed next to a potato field infected with late blight. Infections on these plants have been correlated with weather conditions the day of exposure, and this is the data the model is based on. The model predicts if there are favorable conditions for spore production and the following spread, survival and infection of these spores. The model produces an infection risk, and a value of 2.5 corresponds to one spot of late blight on each trap plant exposed. This value of 2.5 is the threshold where the model issues a warning.

Technical description

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 the requirements.txt file, and are included in the virtualenv created by the run_NAERSTADMO.sh (see below).

Input data requirements

The model assumes weather data files named met_1_0km_nordic-[YYYY-MM-DD].nc with hourly values of:

  • Temperature (TM)
  • Relative humidity (UM)
  • Precipitation (RR)
  • Wind speed (FF)
  • Global radiation (Q0)

Running the model

It is required that you have set the following environment variables:

# Path to this code
HOME_DIR=/foobar/gridmodels/NAERSTADMO/
# Path to the weather data files. Expecting hourly values in files named met_1_0km_nordic-[YYYY-MM-DD].nc
WEATHER_DATA_DIR=/foobar/met_1_0km_nordic/2024/
# Start date for the model (MM-DD)
RECURRING_START_DATE=05-15
# Local time zone
LOCAL_TIMEZONE=Europe/Oslo
# Use this file to crop the output of the grid
MASK_FILE=Norge_landomrader.csv
# Where the GeoTIFF files will be output
DATA_DIR=/foobar/mapserver/data/NAERSTADMO/
# Where the mapfile will be output
MAPFILE_DIR=/foobar/mapserver/wms/NAERSTADMO/
# Path to the GeoTIFF files used by mapserver (written to mapfile)
MAPSERVER_DATA_DIR=/foobar2/mapserver/data/NAERSTADMO/
# Path to the mapfile used by mapserver (written to mapfile)
MAPSERVER_MAPFILE_DIR=/foobar2/mapserver/wms/NAERSTADMO/
# Path to the mapserver log file for this WMS (written to mapfile)
MAPSERVER_LOG_FILE=/foobar2/mapserver/log/NAERSTADMO.log
# Path for mapserver to store tmp images (written to mapfile)
MAPSERVER_IMAGE_PATH=/foobar2/mapserver/tmp/
# Extent of map  (written to mapfile)
MAPSERVER_EXTENT="-1.5831861262936526 52.4465003983706595 39.2608060398730458 71.7683216082912736"
# Whether or not to debug log. Default value is False
DEBUG=False

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

Running the model for the current year

$ ./run_NAERSTADMO.sh

This creates a Python virtualenv, installs all the Python dependencies and runs the model. The model logs to the file log/NAERSTADMO.log, and output in the form of geoTIFF and WMS files are written to the directories given in .env. It is important to understand that each model run is dependent on the previous run, through the content of the directory out. The model uses the files in out to find the most recent day with a model result, and (re)calculates for the period from 4 days prior to this day to 1 day after. When the out directory is empty, the start date is set to the RECURRING_START_DATE of the current year.

Running the model for a specific year

$ ./run_NAERSTADMO.sh 2024

This ensures that the model starts at the specified year, retrieves the appropriate weather data, and writes the output files to a path that includes the given year. Important During the current year’s model period, do not run the model for any other year on the server, as this will corrupt the output directory out. If you need to rerun the model for an entire season, it must be done sequentially, once for every day in the period. Before starting, ensure that the out directory is empty. Then trigger the model once per day for the entire period.

Troubleshooting

Remember to set DEBUG=True in the .env file, as this will give you a lot more details in the log file.

Viewing the result of the model

TODO Add more details

WARNING_STATUS example. Showing Norway and surrounding area