NAME

evproc - some boilerplate functions to drive the evproc generalized event processing

SYNOPSIS

use evproc ;

prettyprint($ref[,$prefix]) ;

$str = mystrtime($time) ;

$val = isyes($str) ;

clearlogs($obj) ;

addlog($obj,$level,$format[,$val1[,...]]) ;

$hashref = makereturn($obj,$disposition[,$name1,$val1[,...]]) ;

$disposition = setup_processes($obj) ;

($disposition,$hashref) = match_sta($obj,$sta) ;

$isamp = time2samp($deltime,$dt) ;

($tstart,$istart,$npts) = findrange($t0,$dt,$nsamp[,$tstart[,$tend]]) ;

($tstart,$tend) = trimtrace(@db) ;

($nbad,$fbad) = findbad(@db[,$tstart[,$tend]]) ;

($amax,$vmax,$tmax,$amp,$per,$mean,$std)
	= computestats(@db,$applycalib,$meanremove[,$tstart[,$tend]]) ;

DESCRIPTION

These routines provide utility functions for building up other evproc perl computational modules.

prettyprint will recursively print out the contents of a perl structure (hash, list or scalar) referenced by $ref. This is used for debugging purposes. A string $prefix can also be specified which is prepended to each line of output.

mystrtime is a utility function that returns a time string for $time in the form of "julianday:hr:mn:ss.sss".

isyes will return a boolean 0 or 1 derived from $str, which can be any of "yes", "no", "1", "0", etc.

clearlogs will clear out the internal log messages hash within the perl object referenced by $obj. The log messages hash is a standard way of communicating log messages at various levels of severity back to the orb/dbevproc program which then disposes of the log messages in a standard way.

addlog will add a single log message to the internal log messages hash within the perl object referenced by $obj. The log level is indicated by $level with higher levels meaning more detailed logs and level 0 meaning errors that should always be displayed. The message itself is formed according to $format and a variable list of values $val1, etc., in the same manner as the perl printf function.

makereturn will create the output perl hash that should always be returned from the object methods that are executed by orb/dbevproc (these methods are new, getwftimes, process_channel, process_station and process_network). The orb/dbevproc program is expecting this perl hash to exist and be populated with certain entries. The perl object is referenced by $obj. The overall return status is indicated by $disposition which should always be "ok" to indicate a successful return status and something else when not ok, like "skip" in getwftimes to indicate that a particular event-process should be skipped. Additional return values can optionally be specified through name-val pairs. Following is an example use of makereturn.



return makereturn ( $self, "ok", "sta" => $sta, "chan" => $chan ) ;


setup_processes is a utility function that is used by the Mlrichter(3p) and Mbusneic(3p) computational modules to parse the parameter file objects that are passed from the orbevproc.pf or dbevproc.pf parameter files by the orb/dbevproc program into the object creation methods. The perl object is referenced by $obj. The exit status is returned in $disposition and is "ok" if it was successful. This function parses out the channels and reject tables from the parameter file specifications and converts them into internal object perl structures.

match_sta is a utility function that is used by the Mlrichter(3p) and Mbusneic(3p) computational modules to match stations against the regular expressions in the channels and reject tables from the parameter file specifications. The perl object is referenced by $obj and the station to match is in $sta (CSS naming convention). The disposition ("ok" if there is a match) and a hash reference to the particular entry in the original channels table where the match occured, $hashref, is returned. This function should be used in conjunction with setup_processes.

time2samp is a utility function that will return the closest integer sample index, $isamp, that corresponds to data delta time of $deltime (this refers to the difference between the desired time and the data array start time) and with sampling increment $dt. This works properly for negative indices.

findrange is a utility function that finds the actual range of data sample values corresponding to desired start and end times. The data array start time is $t0, the data array sampling increment is $dt, the data array number of samples in $nsamp. The desired time range can be input as optional $tstart and $tend. The actual closest sample corresponding to the desired start time is returned in $tstart and the index within the input data array is returned in $istart. The number of sample values up to the desired end time is returned in $npts.

trimtrace is a utility function that looks for gap values at the beginning and end of a trace (@bd) and "trims" them off by returning the start ($tstart) and end times ($tend) corresponding to the trimmed trace. Note that the trace array itself is not modified and the input @db trace pointer should already be set to the desired record.

findbad is a utility function that looks for gap values throughout a trace (@bd) and returns the number of gap values ($nbad) and the fraction of gap values relative to the entire trace window ($fbad). Optional start ($tstart) and end times ($tend) can be specified to constrain the search. The input @db trace pointer should already be set to the desired record.

computestats is a utility function that computes a variety of statistics from a single data trace referenced by @db. The trace calib value will be applied to the data before processing if $applycalib is set. A mean value, $meanremove, can be specified which is removed from the data before processing. Note that this must be precomputed and it is assumed to be previously scaled in accordance with applycalib. Optional start ($tstart) and end times ($tend) can be specified to constrain the time range of the statistics. The input @db trace pointer should already be set to the desired record. The statistics returned are $amax, the maximum absolute trace value, $vmax, the trace value with sign corresponding to $amax, $tmax, the time corresponding to $amax, $amp and $per, the mid to peak amplitude and the full wavecycle period of the wavecycle with highest absolute amplitude immediate before or after $tmax with negative $per indicating the wavecycle was before $tmax, $mean, the mean value over the measurement time window and $std, the standard deviation over the measurement time window.

LIBRARY

use lib $ENV{ANTELOPE}/data/evproc ;

SEE ALSO

orbevproc(1), Magnitude(3p), Mlrichter(3p), Mbusneic(3p)

AUTHOR

Danny Harvey

Table of Contents
Antelope Release 4.10 Mac OS X 10.4.11 2008-06-17
Boulder Real Time Technologies, Inc For more information, contact support@brtt.com