Command Line Interaction

Trace group processing commands can be entered at the prompt in the message window or by using the -commands, -commands.onread, or -commands.preset program arguments on the command line or in a defaults file.
_______________________

Commands consist of one or more required keywords followed by optional key/value parameters. For any key/value parameters that are not specified, the parameter values will be set to the values from any previous invocation of the command, otherwise to default values.

The command syntax is shown in brackets "[...]" in the message window when a command is invoked from the command line or through the graphical user interface.

Multiple commands can be entered on one line, the commands must be separated by a comma (,) or a semi-colon (;). Substitution with trace header values is performed for argument values prefixed with &, e.g. &dist is replaced with the numeric distance in km. Substitution is attempted first from the SeisGram2K trace header, then from the original data file header. To force substitution with header values from the original data file header, prefixed with &&, e.g. &&USER1. Substitution is case dependent.

The command syntax is similar to, but not always identical to, the SAC command syntax, when a corresponding SAC command exists.
_______________________

Command Syntax:
_______________________


Program actions:

quit: q
_______________________


Trace group actions:

read: r

write: w

deletechannel: dc <group_index>

select: sel <group_index>

clone: clo

readpredictedphases: rpp file <fileURL> format <format_type>

funcgen: fgen IMPULSE <index_center> | SINE <freq Hz> <phase deg> [delta <dt>] [npts <num_samples>]
generates a function in a new trace-group
_______________________


Time domain processing:

integrate: int

integratemaxposneg: intmpn
integrates abs val of positive and negative values separately, loads case with maximum integral into samples (use for Mwpd magnitude)

integratemaxposneg: intmpnpk
integrates abs val of positive and negative values separately, loads case with maximum integral for a single pulse into samples (use for Mwp magnitude)

differentiate: dif

removemean: rmean [lb <n_points_from_begin_to_use>] | [ref1 offset1 ref2 offset2]

removetrend: rtrend
A least squares curve fit of a straight line to the data is calculated; this straight line or trend is then subtracted from the data.

cutinmemory: cutim [ref1 offset1 ref2 offset2]
where ref1 and ref2 are time in sec from trace reference time or features on traces (B,E,O, WINDOW_CENTER, WINDOW_START, WINDOW_END or phase/pick label)for begin and end of cut; offset1 and offset2 are offsets in sec from ref1 and ref2, respectively.

smooth: smo [type TRIANGLE | BOXCAR] [ha <window_half_width_in_samples>]

square: sqr

squareroot: sqrt

log: natural logarithm

log10: logarithm base 10

normalize: norm

multiply: mul [v1] <value>

divide: div [v1] <value>

add: add [v1] <value>

subtract: sub [v1] <value>

chop: chop
chops negative parts of a trace: sets all samples with value < 0.0 to 0.0

geomspread: rgain [freq <freq>]
remove response from a trace using constant gain given frequency response function evaluated at a specified frequency

geomspread: gs
multiplies trace by P wave geometrical spreading factor (Aki & Richards, eq. 9.44). Requires that GSARC and DEPTH header variables are set
and that a TauP model is available (see Phases Toolbar and -taup.* arguments)

multlinear: mlin v1 <value_at_begin> v2 <value_at_end>

instper: iper [alpha <alpha>]
implementation of the Allen-Kanamori instantaneous-period algorithm (Allen and Kanamori (2003), The Potential for Earthquake Early Warning in Southern California, Science, 300, 786-789.)

instperwin: iperw [win <nnn>]
implementation of the instantaneous-period algorithm using the Tau_c (windowed) algorithm of Kanamori, H. (2005). Real-time seismology and earthquake damage mitigation. Annual Review of Earth and Planetary Sciences 33, 195–214.

zerocrossperiod: zcper
estimates the dominant signal period based on the time between successive zero crossings.
_______________________


Frequency domain display:

plotspectrum: plotsp [mode LogLog | LogLin | LinLog | LinLin | EquiLogLog] [type Magnitude | Phase | Real | Imaginary | SpectralDensity]
plots spectrum of active trace with options of axes type and data mode

plotspectrogram: plotspgm [mode LinFreq* | LogFreq] [colors Rainbow | Greyscale]
plots spectrum of active trace with options of axes type and data mode
_______________________


Frequency domain filtering and processing:
Note: append a plus "+" after the last command parameter to indicate that another frequency domain process follows. SG2K will then not performs the redundant inverse FFT and forward FFT between the two processes.

bandpass: bp bu|amp [n <num_poles>] [co <low_freq> <high_freq>]

highpass: hp bu|amp [n <num_poles>] [co <low_freq>]

lowpass: lp bu|amp [n <num_poles>] [co <high_freq>]

gaussian: gau [fcent <cent_freq>] [alpha <alpha>]

integrate: fint

differentiate: fdif

hilbert: hil

envelope: env
attenuation: ratt
removes frequency dependent attenuation using t* along ray path. Requires that GSARC and DEPTH header variables are set
and that a TauP model is available (see Phases Toolbar and -taup.* arguments)
see also program argument freq.rattenuation.fmax

transfer: trans [from <response>] [to <response>] [freq <f0> <f1> <f2> <f3>]

convolve: con [master <index>] [type CONVOLUTION | DECONVOLUTION] [ref <masterRefTime>] [wa <waterLevel>]
_______________________


Signal measurement:

markptop: markp
find and set picks for maximum peak-to-peak amplitude in a sliding window of width 0.8 sec

markztop: markz [id <id>]
find and set pick for maximum zero-to-peak amplitude on active trace, pick name is O-Pmax or <id> if present

markfeature: markf ref <ref> [offset <offset> id <id>]
find and set pick for amplitude at specified offset in seconds from specified reference feature (use exact string or regular-expression for names of existing picks), mark pick name is <id>_<ref>

marklinepiv: marklp [id <pivotID>] [de <linePivotDelay>] [val <linePivotDistanceLimit>] [wi <linePivotErrorWidth>]
find and set pick for pivot point of curve.

markbox: markb [id1 <boxID1>] [id1 <boxID2>]
set picks for maximum peak-to-peak amplitude in a sliding window of width 0.8 sec

peakwindow: pkwin [wi <window_width>] [me <measurement_step>] [thres <threshold>]
set picks if peak amplitude in window of width window_width sec is greater than threshold, checking every measurement_step sec.

peakext: pkext [np <max_number_peaks>] [ma <min_amplitude>] [ndev <num_std_dev_for_error_estimate]
find and set pick for one or more peaks on active trace, if minAmplitude is set, only peaks with amplitude >= minAmplitude * maximumPeakAmplitude will be picked, if ndev is set uncertainty is set from time width from peak to last previous sample where amplitude = exp(-0.5 * sdev)

stalta: sla [stw <short_term_window_len] [ltw <long_term_window_len>] [ra <trigger_ratio>] [dir FORWARD | BACKWARD] [result PICKS | TRIGGERS | STA/LTA]
implementation of a basic STA/LTA picker.
see Pick Toolbar -> Sta/Lta Tool for details

bkpick: bkp [ltw <long_term_window_len>] [thres1 <threshold_1] [thres2 <threshold_2>] [tupevt <time_up_event>] [tdnmax <time_down_max>] [dir FORWARD | BACKWARD] [result PICKS | TRIGGERS | CHAR_FUNC]
implementation of the Baer-Kradolfer picker (Baer, M., and U. Kradolfer (1987), An automatic phase picker for local and teleseismic events. Bull. Seism. Soc. Am., 77, 1437-1445.)
long_term_window_len sets length of window in seconds for cumulation of mean and std-dev statistics (in original Bear-Kradolfer formulation, statistics are cumulated from beginning of trace)
see Pick Toolbar -> BK Picker for details

filterpick_5: filp_5 [filtw <filter_window_len>] [ltw <long_term_window_len>] [thres1 <threshold_1] [thres2 <threshold_2>] [tupevt <time_up_event>] [result PICKS | TRIGGERS | CHAR_FUNC]
implementation of the FilterPicker (A. Lomax, C. Satriano and M. Vassallo (2012), Automatic picker developments and optimization: FilterPicker - a robust, broadband picker for real-time seismic monitoring and earthquake early-warning, Seism. Res. Lett. , 83, 531-540, doi: 10.1785/gssrl.83.3.531.)
see Pick Toolbar -> FP5 for details