Skip to content
Snippets Groups Projects
Tor-Einar Skog's avatar
Tor-Einar Skog authored
Cdo 2.4 miniconda

See merge request !1
a4290153
History

Septoria reference humidity model - spatial version

The reference humidity model was developed as a supplement to the Humidity model. In this model 20 consecutive hours are required to fulfil a risk period. One constraint in this method is that you can have 19 consecutive risk hours or,
fx 14 hours with risk then one hour below the Rh threshold and then maybe 14 hours again with risk hours. In one of these situations, the model will indicate a risk. In the reference model the definition of Humid hours was introduced. The Rh threshold was avoided as humid hours do not need to be consecutive. The running sum of humid hours across three days indicate that the Septoria risk is higher than if you have three days with humid conditions than two or one. The operation of the model should include weather forecast data and should run 6 days ahead from current day if you include a 7-day weather forecast (60 hours from national met office and until 7 days from ECMWF)

The model was tested against the Humidity model in a Danish Septoria project funded by the GUDP. The threshold of 40 was defined as high risk as this coincided with periods when the humidity model recommended to apply fungicide (if not already protected). The humidity model includes a decision model about when to spray, protection periods ect. The reference model was used to quality control the recommendations in a way that, if the reference humidity hours were higher than 40 (no thresholds) then the user should check the raw data for calculation of the Humidity model (threshold, 20 consecutive hours). If 2-3 periods of 17, 18, or 19 consecutive hours appear, then one can consider to protect the crop based on the reference model alone.

The Humidity model is considered as a DSS with several components. The reference humidity model is considered as a weather based submodel for the risk of Septoria, Easy to map and calculate based on weather data alone.

Technical description

The model has been implemented by Tor-Einar Skog, 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_SEPTREFHUM.sh (see below).

Input data requirements

The model (as per 2023-10-25) assumes that weather data files named met_1_0km_nordic-[YYYY-MM-DD].nc are available in the in/ folder. The files must contain hourly timesteps with the following weather parameters:

  • RR (Rainfall in mm)
  • UM (Relative humidity in %)

Running the model

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

# This is used to auto generate some variables and file names
MODEL_ID="SEPTREFHUM"
# Where your application resides
HOME_DIR=/home/foo/2023_vips_in_space/
# Path to the weather data
WEATHER_DATA_DIR=in/
# Used for iterating the weather data files
FILENAME_PATTERN="met_1_0km_nordic-*.nc"
# Used to extract date info from the filename
FILENAME_DATEFORMAT="met_1_0km_nordic-%Y-%m-%d.nc"
# Names of weather parameters in NetCDF files
# Hourly precipitation
RR="RR"
# Relative humidity (2m)
UM="UM"
# Timezone for weather data/daily aggregations
LOCAL_TIMEZONE="Europe/Oslo"
# Path to optional CSV file with polygons for masking result. 
MASK_FILE=Norge_landomrader.csv
# Path to the output (GeoTIFF) files as seen from the running model code
DATA_DIR=out/
# Path to the generated mapfile as seen from the running model code
MAPFILE_DIR=mapfile/
# The path to the output (GeoTIFF files) as seen from Mapserver
MAPSERVER_DATA_DIR=/foo/mapserver/data/SEPTREFHUM/
# Where your generated MAPFILE and query templates should be placed
MAPSERVER_MAPFILE_DIR=/foo/mapserver/wms/SEPTREFHUM/
# Where mapserver logs for this WMS are written
MAPSERVER_LOG_FILE=/foo/mapserver/log/SEPTREFHUM.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/tmp/
# The value of the EXTENT parameter in Mapserver's mapfile. Units are DD (Decimal degrees)
MAPSERVER_EXTENT="-1.5831861262936526 52.4465003983706595 39.2608060398730458 71.7683216082912736"

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

$ ./run_SEPTREFHUM.sh

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

Alternatively, primarily for development purposes, you can run the Python script SEPTREFHUM directly:

$ ./SEPTREFHUM.py

All intermediary files are stored in the tmp/ folder, and they are all deleted when the model is done calculating. The GeoTIFF files are stored in the out/ folder, and the generated mapfile is stored in the mapfile/ 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, wich indicates infection risk of Septoria.
    • 0 = No infection risk (grey)
    • 2 = Low infection risk (yellow)
    • 3 = Medium infection risk (orange)
    • 4 = High risk (red)
  • result_[YYYY-MM-DD].tif, which contains the wet hour sum (WHS) - which is the sum of wet hours for "yesterday", "today" and "tomorrow", relative to the current file date.

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

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

Notes to self