Program sftahstack | Read Trace And Header (tah) from STDIN, stack matching header keys
[SYNOPSIS]
sftahstack < in.rsf > out.rsf key= xmute= tmute= verbose=1 ntaper=12
[COMMENTS]

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 tah 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 sftahstack program is designed to stack sorted data. Trace and 
header data (tah) are read from from standard input (usually a pipe).
Gathers to be stacked are defined by the input parameter 'key'.
The key parameter is a list of header keys to watch.  A new gather 
starts when one of the header keys change.  On each gather the stack
trace is initialized to zero, traces in the gather are summed, and
the stack trace is divided by the time variant fold, and the stacked
trace written to output.  The output trace header is taken from the
first trace in the input gather.    

EXAMPLE:

sftahread \
verbose=1 \
input=npr3_gathers.rsf \
| sftahnmo \
verbose=1  \
tnmo=0,2,6,10.5,16 vnmo=1500,1500,2250,3250,3700  \
| sftahstack key=iline,xline xmute=0,20000 tmute=0,20 ntaper=25 \
| sftahwrite \
verbose=1                           \
label2="xline" o2=1 n2=188 d2=1   \
label3="iline" o3=1 n3=345 d3=1   \
output=mappedstack.rsf \
>/dev/null

sfgrey <mappedstack.rsf | sfpen

In this example the cmp sorted prestack data, npr3_gathers.rsf,  are 
read by sftahread.  The headers are in the file npr3_gathers_hdr.rsf, 
the headers parameter default.  The headers are merged with the trace 
amplitudes and the tah data sent down the pipe for nmo and stack.  The
sftahstack program uses both the iline and xline keys to determine
which traces blong to a gather.  Using both keys avoids a problem on 
edges of a survey when uising xline along may merge gathers across 
ilines (a special case that does sometimes happen). sftahwrite writes
the trace data to mappedstack.rsf and the headers are written to the
file mappedstack_hdr.rsf.  The order of the data in the output file
is defined by the iline and xline trace headers, so the  data order
is (time,xline,iline).  Finally, the output volume is displayed using
sfgrey.

PARAMETERS
strings key= no default

list of header keys to monitor to determine when to break 
	between gathers.  A gather is a sequence of traces with the 
	same value for all the header keys.  Stack summs traces in 
	the gather, divides by the fold, and outputs the stack trace.

floats xmute= NULL

List of floats the same length as list of floats in the tmute
	parameter.  The (xmute,tmute) pairs are interpolated using the
	trace headers offset to determine trace start time.  The mute is
	always increased to the first non-zero sample.  The default mutes 
	at the first non-zero sample.

floats tmute= NULL

List of floats the same length as list of floats in the xmute
	parameter.  The (xmute,tmute) pairs are interpolated using the
	trace headers offset to determine trace start time. The mute is
	always increased to the first non-zero sample.  The default mutes 
	at the first non-zero sample.

int ntaper=12
the length of the taper to use at the start of the trace.
	

[PARAMETERS]
strings | key | = |   | 	 [numkeys]
int     | ntaper | =12 |   | 	

       length of the taper on the stack mute
    
floats  | tmute | = |   | 	 [numtmute]
int     | verbose | =1 |   | 	

     flag to control amount of print
     0 terse, 1 informative, 2 chatty, 3 debug
  
floats  | xmute | = |   | 	 [numxmute]
[DIRECTORY]
user/karl
