6   Software Extension for weeWX

The section on "Microclimates," above, justifies investment in an electronic backyard weather station to record daily maximum and minimum temperatures, from which cumulative degree-days may be calculated, which in turn is used to predict codling moth development.

Several models of inexpensive weather stations are available via online mail-order catalogs. Of course, most of them record other things, too, such as rainfail and wind direction and speed. Typically these devices consist of a pair of battery-powered units -- outdoor and indoor, that communicate wirelessly. The indoor unit connects to a USB port on a PC. The PC runs software that retrieves historical readings from the indoor unit as often as necessary to maintain an up-to-date database. Readings are summarized and then reported by the program as required over regular periods such as half-hour intervals.

One such software suite is weeWX, which runs on Linux operating systems. In itself, this is a good recommendation for converting to Linux. This may very well be the "killer app" that convinces many backyard orchardists to switch from Windows, although, according to Keffer, "Some intrepid users have run weeWX on Microsoft Windows, but this is not yet widely supported." The software works well with several dozen models of home and backyard weather stations and is used by hobbyists worldwide to contribute near realtime observations to online weather reporting services such as WeatherUnderground, CWOP, and PWSweather as well as to publish their own pages.

This paper describes "cydia," an extension to the weeWX software suite that graphically predicts codling moth development. Documenting this extension is the motivation for writing this paper. This paper assumes that the reader has installed weeWX and is familiar with its architecture and configuration.

An archive of the code for the extension is at: http://LacusVeris.com/cydia/weewx-cydia-0.1.tar.gz.

6.1   Sample Output

The cydia extension generates two files: a *.png image file and an *.html report whenever wee_reports determines that new copies are due.

Here is a sample of the image file, which normally is called /var/www/html/weewx/Cydia/C_pomonella.png.

When the degree-day trace reaches the "Egg Laying" horizon, it is time to do something about spraying for codling moths.

The report normally is called /var/www/html/weewx/Cydia/C_pomonella.html.

6.2   "cydia" Installation

The following procedure should be used to install the extension.

cydia

readme.txt
By:  Chuck Rhode, 14 May 2018

This is an extension to the weeWX Weather System.  It graphically
predicts developmental stages of the codling moth (Cydia pomonella),
an apple tree pest, based on daily temperature measurements.

Documentation is at:

o http://LacusVeris.com/cydia/index.shtml

Installation instructions:

The weeWX suite should already be installed.

0) Make sure the "installer" directory exists.  Create it, if it does
   not exist.  This may require "root" authority.

> mkdir /usr/share/weewx/user/installer

   While you are at "root," issue a *chown* to make the "installer"
   directory your own.

1) Download the cydia source-code archive.

> TMPDIR="/var/tmp"
> ARCHIVE="weewx-cydia-0.1.tar.gz"
> cd "$TMPDIR"
> wget "http://LacusVeris.com/cydia/$ARCHIVE"

2) Run the installer utility program.

> wee_extension --install="$TMPDIR/$ARCHIVE"

3) Modify the standard skin, which probably is called
   /etc/weewx/skins/Standard/skin.conf.  This extension distribution
   includes a file called /etc/weewx/skins/Standard/skin.conf.cydia,
   which is just like /etc/weewx/skins/Standard/skin.conf.dist except
   for the following changes.  These changes should be manually copied
   to the skin you are using.

3a) In the [Extras] stanza, include the following lines:

     cydia_img = "Cydia/C_pomonella.png"
     cydia_url = "Cydia/C_pomonella.html"

    This will add the C_pomonella.png image to the weewx home page and
    link the image to the Cumulative Degree Day report.

3b) In the [CheetahGenerator] [[SummaryByYear]] stanza after
    [[[NOAA_Year]]], include the following lines:

         [[[CydiaDDData]]]
             # This creates a *.csv file used by the CydiaGenerator.
             encoding = strict_ascii
             template = Cydia/NOAA-YYYY.csv.tmpl

3c) In the [CopyGenerator] stanza modify the copy_once line to include
    cydia.css.  It should look like this -- all on one line, of course:

     copy_once = backgrounds/*, weewx.css, cydia.css, mobile.css, favicon.ico, 
       smartphone/icons/*, smartphone/custom.js

3d) Add the following stanzas:

 ###############################################################################
 
 [CydiaGenerator]
     
     # This section provides options to CydiaGenerator, which predicts
     # development stages of various insects.  The generator produces a
     # *.png graph and an *.html page for each species, below.  The
     # graph inherits defaults from [[year_images]] of
     # [ImageGenerator], above.  These may be overridden.
 
     # CydiaGenerator reads the *.csv file, which is output by
     # CheetahGenerator according to Cydia/YTD.csv.tmpl, above.  This
     # *.csv file contains daily max/min temps, which are needed for
     # the special degree-day (DD) model implemented by CydiaGenerator.
     # This model is quite different from and ought not to be confused
     # with "heating degree-days."  CydiaGenerator performs similar
     # calculations for each species and creates a graph and a report
     # for each one.  Species may differ by temperature thresholds
     # between which development can occur and for which DDs are
     # accumulated.  CydiaGenerator projects a treatment schedule for
     # each species, based on the year-to-date accumulation of DDs.
 
     image_width = 600
     image_height = 360
     plot_type = line
     x_label_format = "%m '%y"
     top_label_font_size = 18
     unit_label_font_size = 12
     bottom_label_font_size = 12
     axis_label_font_size = 12
     horizon__font_color = 0x0000ff
     horizon_top_color = 0xbbbbff
     horizon_bottom_color = 0xdfdfdf
     horizon_edge_color = 0x0000ff
     horizon_gradient = 20
     horizon_label_font_path = /usr/share/fonts/truetype/freefont/FreeMonoBold.ttf
     horizon_label_font_size = 12
     horizon_label_font_color = 0x0000f0
     horizon_label_offset = 3
 
     [[Cydia/C_pomonella]]
 
         # Biofix is the cumulative degree days at which the first
         # sustained capture occurs of male codling moths in pheromone
         # traps.
 
         # The essence of the degree-day model of insect development is
         # that it is more or less consistently predictive in various
         # locations and in succeeding years.  The degree day
         # calculation uses the max and min temps for each day.  It is
         # thus immune to missing readings.  In fact, precise
         # calculation of degree days is probably less important than
         # proper interpretation of results and prompt application of
         # suggested insect controls.  The estimated Biofix, the
         # thresholds, and the offsets, below, are generally applicable
         # to most apple-growing regions of the country.  You are
         # encouraged to check with your County Agent of the United
         # States Department of Agriculture Cooperative Extension for
         # exact model parameters for your location.
 
         label = Cumulative Degree-Days -- C. pomonella
         threshold_lo = 50, degree_F
         threshold_hi = 88, degree_F
         biofix_estimated = 175, degree_F_day
         biofix_actual = None
 
         [[[Offsets_from_Biofix]]]
 
             [[[[Egg Laying]]]]
                 offset = 100, degree_F_day
 
             [[[[Egg Hatching]]]]
                 offset = 250, degree_F_day

3e) In the [Generator] stanza, modify the generator_list to include
    weewx.cydiagenerator.CydiaGenerator.  It should look like this --
    all on one line, of course:

    generator_list = weewx.cheetahgenerator.CheetahGenerator, 
      weewx.imagegenerator.ImageGenerator, weewx.cydiagenerator.CydiaGenerator, 
      weewx.reportengine.CopyGenerator

4) Run reports:

> wee_reports

This procedure inserts some code into your weeWX libraries.

Two python scripts are placed into /usr/share/weewx/weewx.

Two Cheetah templates are placed into /etc/weewx/skins/Standard/Cydia.

Two more files are placed into /etc/weewx/skins/Standard.

6.3   About Skin Configuration

The cydiagenerator.py module is a knock-off of cheetahgenerator.py, which is installed with the standard weeWX release. The cydiagenerator.py is meant to be used from the standard skin.

There are parameters that may be of interest to configure cydiagenerator.py. You can see them in the config stanzas in the skin.conf section of readme.txt, above.

Particularly, the image file and the report file take their names from the name of the Cydia/C_pomonella stanza.

The Cydia/C_pomonella stanza provides parameters for the insect degree-day development model that are approriate to codling moth. Additional stanzas (not shown) may be specified (inside the CydiaGenerator stanza) for other insect species that follow the same kind of model (single sine, horizontal cutoff).

  • The label parameter specifies the title line printed on the image and on the report.
  • The thresholds specify the limits of optimal temperature for insect development.
  • For codling moth, the biofix will be very close to 175 cumulative degree-days Fahrenheit.
  • If biofix is determined by other means, the actual degree-days may be specified. Substitute the actual degree-days of the second biofix for the beginning of the second flight.

Degree-day offsets of additional events from biofix are listed. The estimated biofix provides the baseline if the actual is not specified. The names of the stanzas within Offsets_from_Biofix provide the horizon labels on the image and the event names on the report. These are insect development milestones when control actions should be undertaken.

6.4   "cydia" De-installation

After this extension ceases to be useful, it may be uninstalled:

> wee_extension --uninstall=cydia

It will then be necessary manually to remove all the changes that were inserted into /etc/weewx/skins/Standard/skin.conf in step 3 of the installation instructions, above.