Search:
wiki:ew2liss
Last modified 17 months ago Last modified on 05/02/12 09:24:17

# Earthworm Module: ew2liss

Contributed by:

## Function

Ew2liss is the Earthworm module for serving Earthworm trace data in LISS (Live Internet Seismic Server) format.

## Details

Ew2liss is the Earthworm module for serving Earthworm trace data in LISS (Live Internet Seismic Server: ​http://earthquake.usgs.gov/monitoring/operations/) format. The LISS is a very simple service that provides trace data in miniSEED format in near-real-time over the Internet. The ew2liss module will convert selected SCNs (station-component-network) of trace data from an Earthworm transport ring, convert that data to miniSEED format, and serve the data to a single LISS client (such as liss2ew) over a TCP/IP network connection.

One LISS normally has data for a single station. One or more components are sent together in the data stream. In some cases, one component is provided in more than one sample-rate. The `location code' is used in this case to label the different kinds of data. Note that nothing prevents ew2liss from handling SCNs from many stations except this LISS convention. It may be that ew2liss and liss2ew could be used to exchange data between Earthworm installations. Since LISS uses Steim-2 compression, this format should use less network bandwidth than Earthworm's export_scn/import pair. Performing the compression and decompression will use more CPU time, however.

A comment about timing

Earthworm trace data (TRACE_BUF format) includes "starttime" and "endtime" (8-byte floating-point numbers) to mark the start and end times of each message. It also includes sample count (an integer) and samplerate (an 8-byte floating-point number). Frequently this samplerate value has been set to the nominal sample rate; the start and end times are assumed to be actual measured values.

The miniSEED format includes only a start time for each record. The sample rate is encoded in the data fixed record as two two-byte integers. These two integers are treated as multipliers if positive, divisors if negative; this a wide range of sample rate values can be expressed. In converting from Earthworm TRACE_BUF messages to miniSEED, errors would be introduced if the nominal sample rate was used to set the miniSEED sample rate factors. Instead, a best rate is determined from the starttime, endtime, and sample count values. Then this new sample rate is rounded to the nearest 0.0001 samples per second. This rounded is intended to reduce the discretization introduced by the conversion to the short integer rate factors. Finally, this new sample rate is used to set the miniSEED sample rate factors.

## Configuration File Commands

On startup, ew2liss reads the configuration file named on the command line. Commands in this file set all the parameters used for configuring the Earthworm LISS server module. (LISS is the Live Internet Seismic Server.) In the control file, lines may begin with a valid ew2liss 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: @model.d).

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

### FUNCTIONAL COMMAND LISTING

Below are the commands recognized by ew2liss, grouped by the function they influence. Most of the commands are required; they may be specified in any order in the control file.

       Earthworm system setup:
                    MyModuleId            required
                    InRing                 required
                    HeartBeatInterval      required
                    GetWavesFrom       required
                    Debug              optional

            LISS server parameters:
                    LISSaddr                required
                    LISSport                required
                    SeqFile          required
                    SocketTimeout           optional

            Data input parameters:
                    MaxSCNs                 required
                    ServeSCN              required

### 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. Default values and example commands are listed after each command description.

The following list is organized by:

command [argument here]

Debug
Processed by: ReadConfig
Function: Earthworm setup

Turns on debug logging for ew2liss. Currently does nothing at all.

    Default:  no debug logging
    Example:  Debug

GetWavesFrom [inst mod_id]
Function: Earthworm setup

Controls the TRACE_BUF messages input to ew2liss. Ew2liss will only process TRACE_BUF messages that come from module mod_id at installation inst. inst and mod_id are character strings (valid strings are listed in earthworm.d) which are related to single-byte numbers that uniquely identify each installation and module. Only 1 "GetWavesFrom" command may be issued; wildcards (INST_WILDCARD and MOD_WILDCARD) will force ew2liss to process all TRACE_BUF messages, regardless of their place of origin.

    Default:  none
    Example:   GetWavesFrom  INST_MENLO  MOD_WILDCARD

HeartBeatInterval [nsec]
Processed by: ReadConfig
Function: Earthworm Setup

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

    Default:  none
    Example:  HeartBeatInterval 30

InRing [ring]
Processed by: ReadConfig
Function: Earthworm setup

Tells ew2liss which shared memory region to use for input. ring is a character string (valid strings are listed in earthworm.d) that relates (in earthworm.d) to a unique number for the key to the shared memory region.

    Default:  none
    Example:  InRing WAVE_RING

LISSaddr [address]
Processed by: ReadConfig
Function: LISS parameters

Specify the address of the nework interface on the earthworm computer that you want to use for serving LISS. This can be either on IP address (four period-separated numbers) or the domain name of the server.

    Default:  none
    Example:  LISSaddr      123.45.6.78

LISSport [port]
Processed by: ReadConfig
Function: LISS parameters

Specifies the IP port number for the LISS. Normally this is 4000. But if you run more than one instance of ew2liss on one computer, they cannot use the same LISSaddr and LISSport.

    Default:  none
    Example:  LISSport  4000

LogFile [switch]
Processed by: ReadConfig
Function: Earthworm Setup

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 non-zero, ew2liss will write daily log file(s) called nnnnnxx.log_yyyymmdd where nnnnn is the name of the configuration file (with the suffix `.d' removed), xx is ew2liss's module id (set with MyModuleId command) and yyyymmdd is the current UTC date (ex: 19960123) on the system clock. The file(s) will be written in the EW_LOG directory (environment variable).

    Default:  none
    Example:  LogFile   1

MaxSCNs [n]
Processed by: ReadConfig
Function: Data Selection

Specifies the number of ServeSCN commands to be found in this configuration file.

    Default:  none
    Example:  MaxSCNs   3

MyModuleId [mod_id]
Processed by: ReadConfig
Function: Earthworm setup

Sets the module id for labeling all outgoing trigger, heartbeat, and error messages. mod_id is a character string (valid strings are listed in earthworm.d) that relates to a unique single-byte number.

    Default:  none
    Example:  MyModuleId MOD_L2E_ANMO

SeqFile [filename]
Processed by: ReadConfig
Function: LISS Parameter

Specifies the filename for the sequence number file, kept in the EW_PARAMS directory (environment variable). If this file does not exist, ew2liss will try to create it. From then on, it records the last sequence number used on a miniSEED record. These numbers are six digit decimal numbers.

    Default:  none
    Example:  SeqFile seq.lsn

ServeSCN [station component net location]
Processed by: ReadConfig
Function: Data selection

Specifies one stream of data to be read from the transport ring and served as LISS data. The station, component, and network are used to set the earthworm SCN of this data stream. These three parameters must be given explicitly (no wildcards). LISS channels may also identified by a location code. If you want, you can inlude a two-digit location code here; otherwise leave this blank. You must give one ServeSCN command for each SCN that you want to serve.

    Default:  none
    Example:  ServeSCN SEA BHZ UW

SocketTimeout [seconds]
Processed by: ReadConfig
Function: LISS parameters

Defines the number of seconds to wait for response from the LISS. This time interval must not be large than the HeartBeatInterval. Unlike in certain other Earthworm modules, you cannot turn off the timeout by using a value of -1.

    Default:  same as HeartBeatInterval
    Example:  SocketTimeout   20

### Sample Configuration File

    #
    #                     Configuration File for ew2liss
    #
    MyModId          MOD_EW2LISS
    InRing          WAVE_RING        # Transport ring to read trace data from
    HeartBeatInterval     30         # Heartbeat interval, in seconds,
    LogFile               1          # 1 -> Keep log, 0 -> no log file

    #
    # Specify logo of the messages to grab from the InRing.
    # TYPE_TRACEBUF is assumed, therefore only module ID and
    # installation ID need to be specified
    #
    GetWavesFrom    INST_WILDCARD MOD_WILDCARD  # TYPE_TRACEBUF (assumed)

    LISSaddr   123.45.6.78           # IP address of the LISS (server)
                                     # If you have DNS configured, you may also
                                     # give the domain name of the LISS.
    LISSport    4000                 # Port number for LISS; often this is 4000

    SocketTimeout  30                # Socket timeout in seconds; not more than
                                     # HeartBeatInterval

    SeqFile    seq.lsn               # Name of sequence number file.
    MaxSCNs        3                 # Number of SCNs to accept; must be at least
                                     # the number of ServeSCN commands.
    # List each sta/comp/net that you want to serve with a
    # "ServeSCN" command. Location code (LC) is a 2-digit numerical code that
    # you may use to further identify the data stream.
    # Location code may be omitted (left blank); all other entries must be
    # given explicitly (no wildcards).

    #          site comp net LC
    #          ---- ---- --- --
    ServeSCN  SEA   BHZ  UW 00
    ServeSCN  SEA   BHN  UW 00
    ServeSCN  SEA   BHE  UW 00

## Helpful Hints

### Download in other formats:

- Plain Text