Text Triggers

AWIPS Builds OB4, OB5, OB6

Notes:

Build 4.2 added LDAD backup triggers, ADAPPT triggers, and fax triggers to the system. In 4.3, ww1 processing was added. This modifies the method for setting up LDAD triggers to better account for various combinations of WFO, RFC, and state IDs in building the list. Build 4.3 also included some ADAPPT modifications.

In Build 5.0, the only change was a modification to the ADAPPT list; see that section below.

An internal change in 5.1.1 allows the loading of triggers to continue even if a duplicate is encountered.

In 5.1.2, more ADAPPT triggers were added to support automatic generation of Watch County Notification and SLS.

For 5.2.1/5.2.2 update, the documentation reflects a change in adaptTrigger templates (section 2.3) regarding the HP-Linux adapt/ifps directory split.

For OB2, the path to ASOS_smDecoder.sh changes as noted in section 2.3.

New in OB4 is the addition of the contents of $FXA_LOCAL_SITE-wsoTrigger.template (if any) to the fxaTextTriggerActions list. This is to provide access to non-AWIPS NWS sites' (Alaska Region) products in the WWA monitor.

In OB6, PostGreSQL ('postgres') running on dx1 replaces Informix running on ds1. Several details change, but the basic trigger process remains. This is partially documented here, with more to come...

(Also in OB6, a partial replacement for the whole trigger mechanism is being started, using NotifyTextProd on dx2. So far, this capability is not documented here.)


1.0 Triggers Overview

The Text Triggers utility monitors the text data stream and matches a set of predefined AFOS PILs against the data being inserted into the text database. If a match is found to a PIL in the trigger table, the text storage routine writes the product to file $FXA_DATA/trigger/<cccnnnxxx>, and Informix initiates a predefined action (script). Two benefits of this are 1) processes interested in arrival of text products need not monitor the input data stream and 2) locally-generated text can be used as triggers, in addition to products from the Satellite Broadcast Network.

Text Triggers can be invoked for processing by the following AWIPS functional areas:

LDAD (for the site, and for site backup)
Hydro
ADAPPT
Fax
Local triggers

The relationship between a PIL and a triggered action is configured during the localization process. The triggers are installed onto the data server (file $FXA_HOME/informix/fxatextTriggerActions.txt) and loaded into an Informix table at that time, but they can be reset and reloaded at any time. The method of generating the list of PILs and associated actions differs for each of the functional areas. The LDAD and hydro triggers are generated using a site-specific configuration file, in conjunction with a template file. Fax triggers are set by the text workstation user and local-products triggers are created from site-generated files. In all cases, the PIL is passed as the last argument to the script.

2.0 Configuring Triggers

2.1 LDAD

LDAD actions are found in $FXA_HOME/data/localization/nationalData/ldadTrigger.template, which includes entries like

wwwSPSww1 | | | /awips/fxa/ldad/bin/textdbNotify.pl statement |
wwwTORww1 | | | /awips/fxa/ldad/bin/textdbNotify.pl warning |
wwwSVRww1 | | | /awips/fxa/ldad/bin/textdbNotify.pl warning |
wwwFFAww1 | | | /awips/fxa/ldad/bin/textdbNotify.pl watch |
wwwSTPsss | | | /awips/fxa/ldad/bin/textdbNotify.pl report |
rrrFFGsss | | | /awips/fxa/ldad/bin/textdbNotify.pl outlook |
rrrFFGww1 | | | /awips/fxa/ldad/bin/textdbNotify.pl outlook |
The www, ww1, sss, and rrr place-holders included in the template are replaced by site-specific locations defined in file $FXA_HOME/data/localization/LLL/LLL-ldadSiteConfig.txt, where LLL represents the local site ID. The file consists of at least four lines, defining each of the directives, as shown here:
www wfo www is a literal string and <wfo> is a variable three-letter string that identifies the CCC of an AFOS PIL.
ww1 wfo ww1 is a literal string and <wfo> is a variable three-letter string that identifies the XXX of an AFOS PIL. It is possible to have the same string as the www, or to have a different site identifier for ww1.*
sss state ID sss is a literal string and <state ID> is a variable two-letter string that identifies a state.
rrr rfc rrr is a literal string and <rfc> is a variable three-letter string that identifies a river forecast office.
* Note that the default LLL-ldadSiteConfig.txt files do not include a ww1 directive. One is added, using the value of the FXA_LOCAL_SITE environment variable, during triggers processing. If a different ww1 is needed, you can include it in a copy of your LLL-ldadSiteConfig.txt placed in $FXA_CUSTOM_FILES.

Some sites need consider products from only one WFO, state, and RFC. Many require multiple states and RFCs. Examples of these are Tucson and Pittsburgh, respectively:

TWC-ldadSiteConfig.txt reads

www PHX
ww1 PHX
sss AZ
rrr SLC

while PBZ-ldadSiteConfig.txt contains

www PIT
ww1 PIT
ww1 UNV
sss PA
sss NY
rrr PIT
rrr CRW

It is acceptable for more than one WFO to appear in the ldadSiteConfig file, though none of the default files has more than one.

In the case of multiple WFO entries, the three directives are grouped into a major and minor logical pairing, with the sss and rrr entries lying under a www processed as a group. Thus, a state ID or RFC may appear more than once in such a file.

Following is a (bogus) example of an XXX-ldadSiteConfig.txt that contains two www entries.

www DEN
ww1 DEN
ww1 PUB
sss CO
rrr MKC
www CYS
ww1 CYS
sss WY
sss NE
rrr MKC

Note: In all cases, directives must be ordered as shown in these examples - i.e., generally in www, ww1, sss, rrr order. In the two-www example above, processing proceeds as if there were two separate files. The DEN {DEN PUB} CO MKC set is processed followed by the CYS CYS {WY NE} MKC set.

The LDAD site backup trigger capability is identical to the main LDAD trigger configuration, the only difference being that the backup configuration file is named LLL-ldadSiteBackupConfig.txt and the template is $FXA_HOME/data/localization/nationalData/ldadSiteBackupTrigger.template.

Actions associated with the backup files are included in the TriggerActions file. Even though the current site backup template lacks any RFC information, an entry for rrr must be present. Note that your backup config file is not delivered as part of the AWIPS installation, but must be created locally.

2.2 Hydro

Hydro-related trigger PILs are generated from a combination of /awips/fxa/data/localization/nationalData/hydroTrigger.template and /awips/fxa/data/localization/LLL/LLL-hydroSiteConfig.txt. (The latter is used to configure both the hydro triggers and the acquisition filter patterns for hydro data received over the SBN.) The template consists of the single line

wwwMTRXXX | | | /awips/fxa/bin/moveMetars.csh |
One or more www directives are included in the hydroSiteConfig file, and are used to identify the METAR obs of interest to the hydro program. This information is added to the fxatextTriggerActions.txt file. The XXX is a wildcard, so all METARs from the CCC(s) of interest trigger the action.

2.3 ADAPPT

The Meteorological Development Laboratory utilizes text triggers for ADAPPT. ADAPPT ingests all the SAW and SEV products stored in the database for display within WWA. These are brought in via fxaTextTriggerActions entries copied from $FXA_HOME/data/localization/nationalData/adaptTriggerAll.template:

CCCSAWXXX | | | /awips/adapt/ifps/bin/hp/ingest_saw_lx.bat |
CCCSEVXXX | | | /awips/adapt/ifps/bin/hp/ingest_sev_lx.bat |
CCCWCLXXX | | | /awips/adapt/ifps/bin/hp/ingest_wcl_lx.bat |
CCCWOUXXX | | | /awips/adapt/ifps/bin/hp/ingest_wou_lx.bat |

ZFP products are used to create the Surface Area Forecast (SAF), read on the NOAA Weather Radio, and the local ASOS summary messages are used in the climate program; all of these are brought in via nationalData/adaptTrigger.template:

wwwZFPXXX | | | /awips/adapt/ifps/bin/hp/capture_off_words.bat |
wwwDSMXXX | | | /awips/adapt/climate/bin/HP-UX/ASOS_smDecoder.sh |
wwwMSMXXX | | | /awips/adapt/climate/bin/HP-UX/ASOS_smDecoder.sh |

Note: Prior to OB2, the path to ASOS_smDecoder.sh is /awips/adapt/adapt_apps/bin/.

For those sites that generate the Tabular State Forecast Product (TSFP), CCF triggers are added via $FXA_HOME/data/localization/LLL/LLL-adaptTrigger.template:

wwwCCFXXX | | | /awips/adapt/ifps/bin/hp/run_ccf_trans.bat |

where the www directive(s) are set in LLL-adaptSiteConfig.txt. Again, the CCC and XXX here are wildcards.

2.4 Fax

Text triggers can be configured to automatically transmit a fax when a PIL is detected. Via the Configure Auto Fax interface on the text workstation (see the User's Guide), a user can set up products to be faxed upon receipt. This information is stored in $FXA_DATA/workFiles/fax/LLL-faxTrigger.template, and is inserted directly in fxatextTriggerActions.txt after being modified to fit the TriggerActions file's format.

2.5 Local Triggers

Additional local triggers can be placed in file $FXA_DATA/siteConfig/textApps/siteTrigger.template. These are handled just as are the fax entries - simply expanded to fit the TriggerActions format. Each entry consists of a single line listing the PIL and the full path name of an executable to be invoked when the product is stored. You can create siteTrigger.template and add as many entries as you like.

Following is an example of BOU's siteTrigger.template:

NMCRRMWY        /data/fxa/siteConfig/textApps/snotel/decodeSNOTEL.csh
DENFWCTAD       /data/fxa/siteConfig/textApps/tempfcst/tempfcst.csh
DENAFDDEN       /data/fxa/siteConfig/textApps/collector/collectafd.csh
DENALGDEN       /data/fxa/siteConfig/textApps/collector/collectalg.csh
DENTAPDEN       /data/fxa/siteConfig/textApps/collector/collecttap.csh
DENRR3DEN       /home/andersen/scripts/decodeRR3s.pl DENRR3DEN
DENRR3GJT       /home/andersen/scripts/decodeRR3s.pl DENRR3GJT
DENRR3PUB       /home/andersen/scripts/decodeRR3s.pl DENRR3PUB
DENRR1GJT       /home/andersen/scripts/decodeRR3s.pl DENRR1GJT
DENRR2DEN       /home/andersen/scripts/decodeRR3s.pl DENRR2DEN
DENRR2ALS       /home/andersen/scripts/decodeRR3s.pl DENRR2ALS
TOPRR3GLD       /home/andersen/scripts/decodeRR3s.pl TOPRR3GLD
DENSTPCO        /home/andersen/scripts/decodeRR3s.pl DENSTPCO
SLCSTPUT        /home/andersen/scripts/decodeRR3s.pl SLCSTPCO
DENSPSDEN       /data/fxa/siteConfig/textApps/sigwx/sigwx.pl
DENWRKRR1       /home/andersen/scripts/decodeMtnstates.pl

Any script that is created for the local triggers should take as a final argument the AFOS PIL of the product.

3.0 Installing and Using Triggers

3.1 Scripts for installing triggers

Scripts needed to install triggers include

$FXA_HOME/data/localization/scripts/
fxatextTriggerConfig.sh
This is the triggers script called by localization when using the -trigger flag. It processes hydro, ADAPPT, fax, and local triggers directly, and calls fxatextTrigger.pl, below, for LDAD. Then, it calls the two Informix [postgres] scripts to establish the triggers in the database.
$FXA_HOME/data/localization/scripts/
fxatextTrigger.pl
This Perl script uses the ldadTrigger.template and the directives specified in LLL-ldadSiteConfig.txt to build a list of products to forward to the LDAD server for dissemination.
$FXA_HOME/informix/removeTrigger.sh
$FXA_HOME/postgres/removeTrigger.sh
This script removes all triggers from the Informix [PostGreSQL] database.
$FXA_HOME/informix/fxatextTrigger.sh
$FXA_HOME/postgres/fxatextTrigger.sh
This script removes existing triggers, then inserts the triggers listed in $FXA_HOME/informix[postgres]/fxatextTriggerActions.txt into the Informix [PostGreSQL] trigger table.

3.2 Installation Instructions

Prior to installing the triggers, verify that directory $FXA_DATA/trigger exists. The text files generated by Informix [PostGreSQL] in response to the triggers will go in this directory.

3.2.1 Formatting and Installing Triggers

The triggers are formatted and installed in Informix [PostGreSQL] by the -trigger localization option:

  ./mainScript.csh -trigger XXX XXX

In OB6, this option must be run on the dx. Below is an example of the pre-OB6 output from this step (DEN localization, run on ds1-fsli).

ds1-fsli{fxa}15: ./mainScript.csh -trigger DEN DEN
Results of this localization not being logged.
----------------------------------------------------------------
performing localization for DEN with the following steps:
trigger
LOCAL_WFO=BOU     INGEST_SITE=DEN     INGEST_WFO=BOU
running fxatextTriggerConfig.sh
Setting up informix triggers...
...reading ldad trigger info for  DEN
Calling ldad perl script
...reading ldad site backup trigger info for  DEN
Calling ldad perl script for backup
...reading hydro trigger info for  DEN
id is  Wxxx , string is  KBOU|KDEN|KGJT|KPUB
id is  Rxxx , string is  KKRF|KMKC|KFWR|KFTW|KTUA|KTUR|KTUL
id is  RegCode , string is  57
id is  www , string is  DEN
...reading adapt trigger info for  DEN
id is  www , string is  CYS
id is  www , string is  DEN
id is  www , string is  TOP
id is  www , string is  OMA
...reading site fax trigger info for  DEN
id is  DENTORDEN , string is  /awips/fxa/ldad/bin/sendFax.tcl
...reading site trigger info for  DEN
id is  DLDTSTDLD , string is  /awips/fxa/bin/testTrigger.csh
Now removing old triggers from the database...

Database selected.


Routine dropped.


Table dropped.



Database closed.

Installing new triggers into the database...
Setting up trigger for LDAD text data...

Database selected.


Table created.


Routine created.


Permission granted.


Trigger created.


214 row(s) loaded.



Database closed.

Trigger Setup Completed.
Trigger installation complete.
triggerScript done.
ds1-fsli{fxa}16:

Beginning with build 5.1.1, any errors associated with this process are logged to /awips/fxa/informix/errlog.

Note: Some sites have reported an error of this sort:

268: Unique constraint () violated. 100: ISAM error: duplicate value for a
record with unique key.
847: Error in load file line 181.
Error in line 2
Near character position 21

The cause of this is duplicate items in fxaTextTriggerActions.txt, which can result from errors in the templates. At least one site reported that the problem was that the directives were not in the prescribed order (see above) in LLL-ldadsiteConfig.txt. In either case, the fix is to manually edit fxaTextTriggerActions.txt to remove duplicates. Note that the issue here is a complete duplicate, not multiple actions associated with a given product, which is acceptable. The duplicate problem is eliminated in the 5.1.1 code.

3.2.2 Verifying DB Installation

To verify these entries in the database, type the following (on ds1):

/opt/informix/bin/dbaccess fxatext
q [Query-language]
u [Use-editor]
<return> [this will put you in a vi session]
iselect * from watchwarn<esc> [insert "select..."]
ZZ [or :wq! -- exit vi]
r [run]

You'll see output similar to the following:

DISPLAY:   Next  Restart  Exit
Display next page of results.

----------------------- fxatext@ONLINE --------- Press CTRL-W for Help --------

 
productid   DENSPSDEN
actualid
createtime
script       /awips/fxa/ldad/bin/textdbNotify.pl statement

productid   DENSVSDEN
actualid
createtime
script       /awips/fxa/ldad/bin/textdbNotify.pl statement

productid   DENTORDEN
actualid
createtime
script       /awips/fxa/ldad/bin/textdbNotify.pl warning

You can page through all these, but this indicates that the triggers have been installed. The actualid and createtime fields will be filled in as triggers are executed. (Press e 3 times to exit.)

3.2.3 Modifying the List of Triggers

The nature of the template mechanisms used to set up triggers is such that some extra PILs may be included, and some things you want may not be. A few extra entries is not a problem, though many (dozens or hundreds) can add noticeable overhead to your ds1 processing.

If, after reviewing $FXA_HOME/informix/fxatextTriggerActions.txt, you decide to make changes, follow this procedure:

  1. as user fxa, cd ~/informix
  2. edit fxatextTriggerActions.txt (use vi to avoid adding extraneous characters)
  3. run fxatextTrigger.sh to establish the new triggers

3.3 Testing a Trigger

At this point, you have successfully installed your triggers. How do you test?

First, pick a product from the fxatextTriggerActions.txt output. The Hydro trigger for WFO Denver is

DENMTRXXX | | | /awips/fxa/bin/moveMetars.csh |

which will trigger on any DENMTR* product. When such a product is inserted in the database, this will kick off the script /awips/fxa/bin/moveMetars.csh. As an example, we'll "trigger" DENMTRTST (a test trigger).

To verify this trigger, type the following:

textdb -w DENMTRTST
This is a test
^d [control-d]

This will create an entry in the database with the words "This is a test" written in it. In the TextDB_Server (write) log file, you will see something like this:

20:47:14.826 TextDB_Server.C EVENT: Request: DENMTRTST
20:47:14.921 TextDB_Impl.C EVENT: Unable to replaceVersion: 100
20:47:14.921 TextDB_Impl.C EVENT: Creating new version.  Version#: 33
20:47:15.000 TextDB_Impl.C EVENT: Version SQLCODE: 0
20:47:16.839 TextDB_Impl.C EVENT: Update Trigger kickoff SQLCODE: 0

This is a successful trigger.

3.4 Trigger Failures

Note the last line of the log illustration above. If the number following SQLCODE: is non-zero, type the following:
finderr n

The Informix error for this will be output. A common error code is -668, which occurs when the trigger cannot be run (or has errors while running). Things to check:

As noted above, LDAD triggers call script textdbNotify.pl. The log for this script is found on ds1 in /data/logs/fxa/<yyddhh>/textdbNotify00000ds1-<site>000000. A record of the LDAD triggers is found here.

3.5 Cautions and Notes


Authors: Mark Mihelic, Darien Davis, and Joe Wakefield. ADAPPT information provided by Ken Sperow.
Last updated 25 May 05