# Earthworm Modules:
ewhtmlreport Configuration File Commands

(last revised October 27, 2012)
Page Index:
1. Example configuration file
2. Functional command listing
3. Alphabetic command listing & description
4. Standalone mode

On startup, ewhtmlemail reads the configuration file named on the command line. Commands in this file set up all parameters. In the control file, lines may begin with a valid ewhtmlreport command (listed below) or with one of 2 special characters:

>     #  marks the line as a comment (example: # This is a comment).

>     @  allows control files to be nested; one control file can be
>        accessed from another with the command "@" followed by
>        a string representing the path name of the next control file
>        (example: @pick_ew.d).

Command names must be typed in the control file exactly as shown in this document (upper/lower case matters!).

## 1. EXAMPLE CONFIGURATION FILE

    #
    # EWHTMLREPORT CONFIGURATION FILE
    #
     MyModuleId     MOD_EWHTMLREPORT       # This instance of ewhtmlreport
     InRing         HYPO_RING              # Transport ring to send heartbeat messages
     HeartbeatInt   30                     # Heartbeat interval in seconds
     LogFile        1                      # If 0. don't write logfile; if 1. do
     Debug          1                      # If 1, print debugging msgs

     MaxMessageSize 16384                  # Maximum size of HYP2000ARC or MAGNITUDE files
     site_file      memphis2.hinv          # hypoinverse file to locate stations
     ArcFolder      arc                    # Folder where HYP2000ARC files are stored
     MagFolder      mag                    # Folder where MAGNITUDE files are stored
     HTMLFile       temp/report            # Folder and file format of html reports
     ReportInt      1                      # Interval between reports, in days
     ReportTime     -1                     # UTC time of the report 0 - 23. -1 means send at start time
     ReportPeriod   200                    # Number of days considered for each report
                                           # Beware that this amy lead to VERY large files
     MaxDist        10                     # Maximum distance in km considered for the average event count per station (10)

## 2. FUNCTIONAL COMMAND LISTING

Below are the commands recognized by ewhtmlreport, grouped by the function they influence. Not all of the commands are required and they may be specified in any order.

    	Earthworm system setup:
    +		MyModuleId	Module id (mandatory)
    +		InRing		Shared memory region for input (mandatory)
    +		HeartBeatInt 	Interval between heartbeats (mandatory)
    +		MaxMessageSize 	Maximum size of HYP2000ARC or MAGNITUDE files

    	Processing:
    +		site_file 	Hypoinverse stations file (mandatory)
    +		HTMLFile 	Output folder and prefix for html report (mandatory)
    +		ArcFolder 	Folder of HYP2000ARC files (mandatory)
    +		MagFolder 	Folder of MAGNITUDE files (optional)
    +		HTMLBaseFile	HTML file used as base for the html reports (mandatory)
    +		ReportInt	Interval in days between reports (optional)
    +		ReportTime	UTC time when each report is generated (mandatory)
    +		ReportPeriod	Period of time considered for the generation of each report, in days
    +		MaxDist		Maximum distance to consider for local average event count (optional)

    	Output Control:
    +		LogFile		Log flag (mandatory)
    +		Debug		Debugging flag (optional)

## 3. ALPHABETIC COMMAND LISTING & DESCRIPTION

In the following section, all configuration file commands are listed in alphabetical order. Listed along with the command (bold-type) are its arguments (in red), the name of the subroutine that processes the command, and the function within the module that the command influences. A detailed description of the command and is also given.

    command arg1				processed by		function

    ArcFolder folder				config			ScanArcFolder

> Sets the location of a folder containing one or more HYP2000ARC files. Each file should contain a single HYP2000ARC message.

>     Default:	none
>     Sample:		ArcFolder arc

    Debug flag				config			output

> Sets a flag to control the volume of debugging information output by ewhtmlemail. If flag is zero, no debug info is written. If flag is non-zero, debug information is written to the logfile and screen.

>     Default:	0
>     Sample:		Debug 0

    HeartBeatInt nsec			config			earthworm setup

> Defines the number of seconds, nsec, between TYPE_HEARTBEAT messages issued by ewhtmlreport.

>     Default:	none
>     Sample:		HeartBeatInt 30

    HTMLBaseFile filename			PrintHTMLReport			Processing

> File containing the base html file used to generate the html reports. This file can be found in the src folder and contains the required html and javascript to produce a dataless report that is then populated with the event data from the HYP2000ARC files.

>     Default:	none
>     Sample:		HTMLBaseFile  ewhtmlreport.html

    HTMLFile filename			PrintHTMLReport			Processing

> Base name for the html files generated by ewhtmlreport. The actual filenames will be given by "filenameyyyymmddHHMMSS.html".

>     Default:	none
>     Sample:		HTMLFile  home/earthworm/events/rep

    InRing ring				config			earthworm setup

> Tells ewhtmlreport which shared memory region to place heartbeat messages.

>     Default:	none
>     Sample:		InRing HYPO_RING

    LogFile switch				config			output

> Sets the on-off switch for writing a log file to disk. If switch is 0, no log file will be written. If switch is 1, ewhtmlreport will write a daily log file(s) called ewhtmlreportxx.log_yymmdd where xx is statmgr's module id (set with "MyModuleId" command) and yymmdd is the current UTC date (ex: 960123) on the system clock. The file(s) will be written in the EW_LOG directory (environment variable).

>     Default:	none
>     Sample:		LogFile 0

    MagFolder folder				config			ScanArcFolder

> Sets the location of a folder containing one or more MAGNITUDE files. Each file should contain a single MAGNITUDE message.

>     Default:	none
>     Sample:		MagFolder mag

    MaxDist dist				PrintHTMLReport		output

> ewhtmlreport produces among other things, a chart with the event count per station. In order to verify if that event count is consistent with the surrounding stations, it also computes an average event count of all the stations within a radius dist km of each station, refered as the local average event count.

>     Default:	10
>     Sample:		MaxDist  20

    MaxMessageSize size			ScanArcFolder		Processing

> Specifies the maximum size in bytes of the HYP2000ARC and MAGNITUDE files to retrieve from the ArcFolder and MagFolder, respectively. Note that HYP2000ARC messages may be very large.

>     Default:	40000
>     Sample:		MaxMessageSize  40000

    MyModuleId mod_id			config			earthworm setup

> Sets the module id. mod_id is a character string (valid strings are listed in earthworm.d) that relates (in earthworm.d) to a unique single-byte number. If more than one ewhtmlemail is running at the same time, they must be given different module ids!

>     Default:	none
>     Sample:		MyModuleId  MOD_EWHTMLREPORT

    ReportInt rint			main			processing

> ReportInt sets the interval between consecutive reports as rint days.

>     Default:	1
>     Sample:		ReportInt  10

    ReportPeriod rper			main			processing

> ReportPeriod sets the time interval (rper in days) considered for the generation of each report. Hence, each report will use a time interval ending at the instant of its generation and starting rper days before. Note that if rper is very high, the generated reports can be very large, reaching several hundreds of kB each. Hence this command should be used with moderation.

>     Default:	60
>     Sample:		ReportPeriod  30

    ReportTime rtime			main			processing

> ReportTime sets the UTC time at which the reports will be generated. Setting rtime to -1 sets the generation of a reports at the start time, for debugging.

>     Default:	none
>     Sample:		ReportTime  8

    site_file filename			process_message			Processing

> Enters site codes and station locations into the site table by reading a HYPOINVERSE format station file called filename. In this file, stations are described by a 5-letter site name, a 2-letter network code and a 3-letter component code. The picker and binder must also be using this station-naming convention. The format of the file is described under "HYPOINVERSE STATION FILE FOR FULL 12-LETTER (S-N-C-L) CHANNEL NAMES".

>     Default:	none
>     Sample:		site_file  cvarg.hinv

## 4. STANDALONE MODE

Ewhtmlreport can operate as a standalone module. Type ewhtmlreport for the available commands.

Module Index | ewhtmlreport Overview