Program sftahspecbal | Read Trace And Header (tah) from standard input, SPECtral BALance
[SYNOPSIS]
sftahspecbal < in.rsf > out.rsf xstart= tstart= verbose=1 ntaper=12 wagc=-1 pnoise=0.01 fmin=5 fmax=95 finc=5
[COMMENTS]

THIS PROGRAM WAS WRITEN, BUT NEVER SUCESSFULLY TESTED.  RESULTS LOOK 
POOR, BUT UNABLE TO SPEND TIME ON THE ALGORITHM, I ADDED IT TO THE 
REPOSOTORY AND HOPE TO RETURN TO WORK ON IT AGAIN... SOMEDAY!

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 sftahspecbal program is designed to improve the resolution and 
appearance of the final imaged seismic section (ie after migration 
and stack.  When applied to noisey land data early in the processing 
sequence (after surface consisntant decon and before migration and 
stack) it attenuates noise on post migration and stack data.  There
are several algorithms called spectral balancing, whitening, or 
broading.  This program implenents a popular method.  Each input 
trace is split into several narrow frequency bands by bandpass 
filtering.  AGC is applied to rach frequency band, and the frequency
bands are summed.  User parameters control the filter bands and the
AGC length.  (reference http://www.xsgeo.com/course/spec.htm#content).

EXAMPLE:

sftahsort input=shots-receivers-23900_headfix.rsf        \
sort="xline:600,601 offset"                              \
| sftahspecbal fmin=5 fmax=95 finc=5 wagc=.250 noise=.05 \
| sftahwrite                                             \
verbose=1                                                \
mode=seq                                                 \
output=specbalcmps.rsf                                   \
>/dev/null

sfimage <specbalcmps.rsf | sfpen

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 spectral balancing.  

sftahspecbal, spectral balance, was run by dividing the data into 5 Hz
frequency bands, applying .25 second agc, summing the scaled bands,
and dividing by the sum of the scalars.

Sftahwrite writes the the trace data to specbalcmp.rsf and the headers 
are written to the file specbalcmp_hdr.rsf.  The output traces are just
sequentially written to the output file.
kls

PARAMETERS

float fmin= NULL

Center of the first frequency band.
	

[PARAMETERS]
float   | finc | =5 |   | 	frequency band increment 
float   | fmax | =95 |   | 	maximum frequency band 
float   | fmin | =5 |   | 	minimum frequency band 
int     | ntaper | =12 |   | 	
float   | pnoise | =0.01 |   | 	relative additive noise level 
floats  | tstart | = |   | 	 [numtstart]
int     | verbose | =1 |   | 	

       flag to control amount of print
       0 terse, 1 informative, 2 chatty, 3 debug
    
float   | wagc | =-1 |   | 	

       length of the agc window in seconds
    
floats  | xstart | = |   | 	 [numxstart]
[DIRECTORY]
user/karl
