6 Software Extension for weeWX
The section on "Microclimate," above, justifies investment in an electronic backyard weather station to record daily maximum and minimum temperatures, from which cumulative growing 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 rainfall 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 by Tom Keffer and Matthew Wall, which runs on Linux operating systems. 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 cydia extension is at:
6.1 Sample Output
The cydia extension generates at least two files, a graph and a report, whenever wee_reports determines that new copies are due.
Here is a sample of the graph, which typically is called:
This is what it looks like:
When the degree-day trace reaches the "Egg Laying" horizon, it is time to do something about spraying for codling moths.
The corresponding report normally would be called:
6.2 "cydia" Installation
The following procedure should be used to install the extension.
cydia readme.txt By: Chuck Rhode, 04 Feb 2019 *cydia* 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: http://LacusVeris.com/cydia/index.shtml In order to use the *cydia* extension, the weeWX suite should already be installed. These installation instructions apply only to the *cydia* extension and use the following convention: BIN_ROOT="/usr/share/weewx" CONFIG_ROOT="/etc/weewx" SKIN_ROOT="/etc/weewx/skins" HTML_ROOT="/var/www/html/weewx" Depending on how weeWX was installed, the paths weeWX actually uses may be different. Be sure to use the same paths as weeWX. Here are the steps: 0) Make sure the "installer" directory exists. Create it, if it does not exist. This may require "root" authority. >> BIN_ROOT="/usr/share/weewx" # Is this the correct path for weeWX? >> mkdir "$BIN_ROOT/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-1.2.tar.gz" >> cd "$TMPDIR" >> wget "http://LacusVeris.com/cydia/$ARCHIVE" 2) Run the installer utility program. >> wee_extension --install="$TMPDIR/$ARCHIVE" This procedure will scatter files in several places. The exact locations will depend on how weeWX itself was installed. 3) Modify the radar include file. This is called $SKIN_ROOT/Seasons/radar.inc. Make a copy. >> cp -a "$SKIN_ROOT/Seasons/radar.inc" "$SKIN_ROOT/Seasons/radar.inc.dist" This extension distribution includes a file called $SKIN_ROOT/Seasons/radar.inc.cydia, which is just like $SKIN_ROOT/Seasons/radar.inc.dist except for the changes in $SKIN_ROOT/Seasons/radar.inc.cydia.diff. These changes should be applied to the template you are using, which no doubt is $SKIN_ROOT/Seasons/radar.inc. Insert the following changes: Insert two more "if blocks" as follows: #if $Extras.has_key('cydia_1_img') <div id='radar_widget' class="widget"> <div class="widget_title"> C. pomonella -- First Flight <a class="widget_control" onclick="toggle_widget('radar')">♦</a> </div> <div id="radar_img"> #if $Extras.has_key('cydia_1_url') <a href="$Extras.cydia_1_url"> #end if <img src="$Extras.cydia_1_img" alt="C. pomonella Development" /> #if $Extras.has_key('cydia_1_url') </a> <p>Click image for C. pomonella Development Report</p> #end if </div> </div> #end if #if $Extras.has_key('cydia_2_img') <div id='radar_widget' class="widget"> <div class="widget_title"> C. pomonella -- Second Flight <a class="widget_control" onclick="toggle_widget('radar')">♦</a> </div> <div id="radar_img"> #if $Extras.has_key('cydia_2_url') <a href="$Extras.cydia_2_url"> #end if <img src="$Extras.cydia_2_img" alt="C. pomonella Development" /> #if $Extras.has_key('cydia_2_url') </a> <p>Click image for C. pomonella Development Report</p> #end if </div> </div> #end if What these do is to display the "Growing Degree-Days" graphs under the statistics in the left-hand column. 4) Modify the seasons skin. This is called $SKIN_ROOT/Seasons/skin.conf. Make a copy. >> cp -a "$SKIN_ROOT/Seasons/skin.conf" "$SKIN_ROOT/Seasons/skin.conf.dist" This extension distribution includes a file called $SKIN_ROOT/Seasons/skin.conf.cydia, which is just like $SKIN_ROOT/Seasons/skin.conf.dist except for the changes in $SKIN_ROOT/Seasons/skin.conf.cydia.diff. These changes should be applied to the skin you are using, which no doubt is $SKIN_ROOT/Seasons/skin.conf. Here is a description of these changes. 4a) In the [Extras] stanza, include the following lines: cydia_1_img = "Cydia/C_pomonella_First_Flight.png" cydia_1_url = "Cydia/C_pomonella_First_Flight.html" cydia_2_img = "Cydia/C_pomonella_Second_Flight.png" cydia_2_url = "Cydia/C_pomonella_Second_Flight.html" This will add the graphs to the weewx home page and link the images to the Cumulative Degree-Day reports. 4b) 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 4c) 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 4d) 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 growing degree-day (GDD) models implemented by # CydiaGenerator. These models are quite different from and ought # not to be confused with degree-day (DD) models used by # architects and building-construction engineers. CydiaGenerator # performs similar calculations for each species and creates a # graph and a report for each one. Species may differ by # temperature thresholds and cutoffs between which development can # occur and for which GDDs are accumulated. CydiaGenerator # projects a treatment schedule for each species, based on the # year-to-date accumulation of GDDs. 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 = 5, -15 [[Cydia/C_pomonella_First_Flight]] # Biofix is the cumulative growing degree-days at which the # first sustained capture occurs of male codling moths in # pheromone traps. # Insect development has been shown to be linearly dependent # on various models of cumulative growing degree-days, # depending on species. The benefit of the growing # degree-days models of insect development is that they are # more or less consistently predictive in various locations # and in succeeding years. The growing degree-days # calculations use the max and min temps for each day. They # are thus mostly immune to missing readings. In fact, # precise calculation of growing degree-days is probably less # important than proper interpretation of results and prompt # application of suggested insect controls. # In terms of codling moth, the estimated Biofix, the # threshold, the cutoff, 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. # The usual method of calculation for codling moth is # gdd_single_sine_horizontal_cutoff. Other methods are: # dd_conventional, gdd_single_sine_vertical_cutoff, # gdd_single_sine_no_cutoff, and # gdd_single_sine_intermediate_cutoff. start_date = None # Default New Year's Day. end_date = None # Default today. label = Cumulative GDD -- C. pomonella (1st Flight) threshold = 50, degree_F cutoff = 88, degree_F method = gdd_single_sine_horizontal_cutoff 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 [[Cydia/C_pomonella_Second_Flight]] start_date = None # Default New Year's Day. end_date = None # Default today. label = Cumulative GDD -- C. pomonella (2nd Flight) threshold = 50, degree_F cutoff = 88, degree_F method = gdd_single_sine_horizontal_cutoff biofix_estimated = 1175, degree_F_day biofix_actual = None [[[Offsets_from_Biofix]]] [[[[Egg Laying]]]] offset = 100, degree_F_day [[[[Egg Hatching]]]] offset = 250, degree_F_day 4e) 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 5) Run reports: >> wee_reports
This procedure inserts some code into your weeWX libraries.
Two python scripts are placed into $BIN_ROOT/weewx.
Three Cheetah templates are placed into $SKIN_ROOT/Seasons/Cydia.
Five more files are placed into $SKIN_ROOT/Seasons. You should make "as distributed" copies of skin.conf and radar.inc, called skin.conf.dist and radar.inc.dist, respectively.
Normally, you will locally modify skin.conf and radar.inc for your own purposes, leaving skin.conf.dist and radar.inc.dist untouched. Alternatively, you may wish to apply the differences in skin.conf.cydia.diff and radar.inc.cydia.diff to skin.conf and radar.inc, respectively.
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 configure cydiagenerator.py. You can see these parameters in the config stanzas in the skin.conf section of readme.txt, above.
Particularly, the graph and the report take their names from descendants of the [CydiaGenerator] stanza, such as [[Cydia/C_pomonella_First_Flight]] and [[Cydia/C_pomonella_Second_Flight]].
The descendant stanzas provide parameters for the insect degree-day development model that are appropriate to codling moth. Additional stanzas (not shown) may be specified inside the [CydiaGenerator] stanza for other insect species.
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 graph 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 $SKIN_ROOT/Seasons/skin.conf and $SKIN_ROOT/Seasons/radar.inc.