MST_GROUPSORT(3)

DESCRIPTION
Manipulate MSTrace segments in a MSTraceGroup

SYNOPSIS
#include <libmseed.h>
MSTrace  *mst_groupsort ( MSTraceGroup *mstg, flag quality );
MSTrace  *mst_groupheal ( MSTraceGroup *mstg, double timetol,
                          double sampratetol );

DESCRIPTION
mst_groupsort will sort the MSTrace segments in a MSTraceGroup first on the source name (as returned by mst_srcname), then on start time, then on descending end time, and finally on sample rate. The quality flag, passed directly to mst_srcname, controls the addition of the quality indicator to the source name and thus the addition of sorting on the quality indicator (but only if the MSTrace has an associated quality, see mst_srcname(3) for more details). mst_groupheal will attempt to heal MSTrace segments in a MSTraceGroup if they fit within the specified time and sample rate tolerance (timetol and sampratetol respectively). This is useful when, for whatever reason, the MSTraceGroup has separate MSTrace segments which belong together. This usually only happens when data is added to a MSTraceGroup in random data time order. Before attempting to heal the MSTraces the MSTraceGroup will be sorted using mst_groupsort. If sampratetol is -1.0 the default tolerance of abs(1-sr1/sr2) is used. If timetol is -1.0 the default time tolerance of 1/2 the sample period will be used.

RETURN VALUES
mst_groupsort returns 0 on success and -1 on error. mst_groupheal returns the number of MSTrace segments merged on success and -1 on error.

SEE ALSO
ms_intro(3) and mst_srcname(3).

AUTHOR
Chad Trabant
IRIS Data Management Center