2004/03/05:LDD

Earthworm msg types used by NCSN that will require new versions
to implement Location code in SCNL:

Current Msg Type     New Msg Type            Generated by
----------------     -------------           ------------
TYPE_TRACEBUF        TYPE_TRACEBUF2          all data sources

TYPE_TRACE_COMP_UA   TYPE_TRACE2_COMP_UA     compress_UA

TYPE_PICK2K          TYPE_PICK_SCNL          pick_ew

TYPE_CODA2K          TYPE_CODA_SCNL          pick_ew

TYPE_EVENT2K         TYPE_EVENT_SCNL         eqproc,eqprelim

TYPE_CARLSTATRIG     TYPE_CARLSTATRIG_SCNL   carlstatrig

TYPE_TRIGLIST2K      TYPE_TRIGLIST_SCNL      carlsubtrig,arc2trignc,
                                             evansassoc

TYPE_LPTRIG          TYPE_LPTRIG_SCNL        evanstrig

Format already contains fields for L, but code must be changed
to implement it:
TYPE_HYP2000ARC      TYPE_HYP2000ARC         eqcoda,hyp2000_mgr


New Message TYPE Details
------------------------
TYPE_TRACEBUF2 & TYPE_TRACE2_COMP_UA
The new trace data message header will be of the same length as 
the current message header. The location and version fields will 
be carved out of the currently over-sized chan field.  All other
fields will remain the same length and in the same position in 
the header. This means that the station and network fields will
still remain over-sized with respect to the SEED field length
requirements.

Here's the original and my suggestion for new trace header:

/*---------------------------------------------------------------------------*
 * Definition of original TYPE_TRACEBUF header with CSS3.0-length SNC fields *
 *                                                                           *
 * NOTE: The principal time fields in the TRACE_HEADER are:                  * 
 *         starttime, nsamp, and samprate.                                   *
 *       The endtime field is included as a redundant convenience.           *
 *---------------------------------------------------------------------------*/

#define NETWORK_NULL_STRING "-"

#define	TRACE_STA_LEN	7
#define	TRACE_CHAN_LEN	9
#define	TRACE_NET_LEN	9
#define TRACE_LOC_LEN   3

typedef struct {
        int     pinno;                 /* Pin number */
        int     nsamp;                 /* Number of samples in packet */
        double  starttime;             /* time of first sample in epoch seconds
                                          (seconds since midnight 1/1/1970) */
        double  endtime;               /* Time of last sample in epoch seconds */
        double  samprate;              /* Sample rate; nominal */
        char    sta[TRACE_STA_LEN];    /* Site name */
        char    net[TRACE_NET_LEN];    /* Network name */
        char    chan[TRACE_CHAN_LEN];  /* Component/channel code */
        char    datatype[3];           /* Data format code */
        char    quality[2];            /* Data-quality field */
        char    pad[2];                /* padding */
} TRACE_HEADER;

/*---------------------------------------------------------------------------*
 * Definition of TYPE_TRACEBUF2 header with SEED SNCL fields                 *
 *                                                                           *
 * NOTE: The principal time fields in the TRACE_HEADER are:                  * 
 *         starttime, nsamp, and samprate.                                   *
 *       The endtime field is included as a redundant convenience.           *
 *---------------------------------------------------------------------------*/

#define	TRACE2_STA_LEN	7
#define	TRACE2_NET_LEN	9
#define	TRACE2_CHAN_LEN	4   /* SEED: 3 chars plus terminating NULL */
#define	TRACE2_LOC_LEN	3   /* SEED: 2 chars plus terminating NULL */

typedef struct {
        int     pinno;                  /* Pin number */
        int     nsamp;                  /* Number of samples in packet */
        double  starttime;              /* time of first sample in epoch seconds
                                           (seconds since midnight 1/1/1970) */
        double  endtime;                /* Time of last sample in epoch seconds */
        double  samprate;               /* Sample rate; nominal */
        char    sta[TRACE2_STA_LEN];    /* NTS: Site name */
        char    net[TRACE2_NET_LEN];    /* NTS: Network name */
        char    chan[TRACE2_CHAN_LEN];  /* NTS: Component/channel code */
        char    loc[TRACE2_LOC_LEN];    /* NTS: Location code */
        char    version[2];             /* version field */
        char    datatype[3];            /* NTS: Data format code */
        char    quality[2];             /* Data-quality field */
        char    pad[2];                 /* padding */ 
} TRACE2_HEADER;

The version field is included to differentiate the TYPE_TRACEBUF2
message from the TYPE_TRACEBUF when data are stored without the
context of an Earthworm message logo. This is important for NCSN 
because our continuous archive consists of files of raw trace messages.
We have to be able to read a trace header and decide whether it 
contains the loc field or not.  The Earthworm tankplayer module has 
the same requirement; it reads a file containing raw trace messages
and will have to know whether to write them to the ring as 
TYPE_TRACEBUF or TYPE_TRACEBUF2 messages. 

The version field will be filled with 2 ASCII characters (no NULLs):
  version[0] is the main version number
  Version[1] is the subversion number
Let's go with version[0]='2' and version[1]='0' for now. 


