sftahgain (2.0-git)
index
user/karl/Mtahgain.c
Read Trace And Header (tah) from standard input and apply GAIN

 
Synopsis
        sftahgain < in.rsf > out.rsf xstart= tstart= verbose=1 scale=1.0 tpow=0.0 epow=0.0 agc=0.0

tah is the abbreviation of Trace And Header. Madagascar programs
that begin with sftah are a designed to:
1- read trace and headers from separate rsf files and write them to
standard output (ie sftahread)
2- filter programs that read and write standard input/output and
process the tahxstart data (eg sftahnmo, sftahstack)
3- read tah data from standard input and write separate rsf files for
the trace and headers data (ie sftahwrite)

These programs allow Seismic Unix (su) like processing in Madagascar.
Some programs have su like names.

Some programs in this suite are sftahread, sftahgethw, ftahhdrmath,
and sftahwrite.

The sftahgain program is designed to apply various amplitude gain
functions. These gain functions include multiply by a constant,
trace balance, clipping, AGC, t**pow, exp(epow*t) and AGC. Trace
and header data (tah) are read from standard input (usually a pipe).
Data is scaled:
out(t) = scale * BAL{CLIP[AGC{[t^tpow * exp(epow * t)}]}
Then trace and header data is written to standard output.

EXAMPLE:

sftahsort input=shots-receivers-23900_headfix.rsf \
sort="xline:600,601 offset" \
| sftahgain agc=.5 \
| sftahmakeskey pkey=xline skey=cdpt \
| sftahwrite \
verbose=1 \
label2=cdpt o2=1 n2=100 d2=1 \
label3=xline o3=600 n3=1 d3=1 \
output=agccmps.rsf \
>/dev/null

sfgrey
In this example the shot organized prestack data in the file
shots-receivers-23900_headfix.rsf are read in xline offset order by
sftahsort program. The headers are in the file
shots-receivers-23900_headfix_hdr.rsf, the headers parameter default.
The headers are merged with the trace amplitudes and the tah data sent
down the pipe for scaling (agc).

sftahagc applies a .5 second automatic gain control (agc)

The program sftahmakeskey is used to create a secondary key used
in the following sftahwrite to define the location to wrte the trace
in the output file. Sftahmakeskey makes a secondary key (skey=cdpt)
the count the traces starting in the a primary key gather (pkey=xline).
The input traces gathered by xline by sftahsort. Sftahmakeskey sets
cdpt to 1 when the trace has a new xline. If the trace has the same
xline as the previous trace cdpt is incremented

Sftahwrite writes the the trace data to agccmp.rsf and the headers are
written to the file agccmp_hdr.rsf. The order of the data in the output
file is defined by the cdpt and xline trace headers, so the data order
is (time,cmpt,xline). Finally, the output volume is displayed using
sfgrey.

Operation order:

out(t) = scale * BAL{CLIP[AGC{[t^tpow * exp(epow * t)}]}

 
Parameters
       
 
float agc=0.0
Length of agc window in seconds. 0.0 means no agc
 
float epow=0.0
multiply data by exp(epow*t)
 
float scale=1.0
multiply data by this float
 
float tpow=0.0
multiply data by t^tpow
 
floats tstart=
list of times that correspont to xstart and define the offset
dependent start time for the agc scaling [numtstart]
 
int verbose=1


flag to control amount of print
0 terse, 1 informative, 2 chatty, 3 debug

 
floats xstart=
list of offsets that correspond to tstart and define the offset
dependent start time for the agc scaling [numxstart]

 
Used In
       

 
DATA
        seam-phase1-2d/cvs
teapotdome/firstlook
teapotdome/scdecon
teapotdome/vels
teapotdome/zomig
viking/basicm8r
viking/decon
viking/firstlook