sftahheadermath (2.0-git)
Trace And Header MEADER MATH

        sftahheadermath < in.rsf > out.rsf verbose=1 output= outputkey=

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 sftahheadermath updates a trace header with a new value computed from
input trace headers. The program is modeled on sfheadermath. A formula
input to the parameter output is used to compute a value saves in the
outputkey header location. The forma can contain the binary operators
+, -, *, and /. Parenthesis, i.e. ( and ), can be used to specify
order of operation.

Known functions for float data:
cos, sin, tan, acos, asin, atan,
cosh, sinh, tanh, acosh, asinh, atanh,
exp, log, sqrt, abs, erf, erfc, sign

Known functions for int data: sign, abs

A simple example is 2D offset can be computed from sx and gx:
sftahheadermath outputkey=offset output=abs(sx-gx)

See also sftahmakeskey.


sftahread input=timodel_shot_data_II.rsf \
| sftahheadermath outputkey=cdpy output='(sy+gy)/2' \
| sftahheadermath outputkey=cdp output='cdpy/20+1' \
| sftahheadermath outputkey=cdpt output='offset/200+1' \
| sftahgain tpow=1 \
| sftahwrite output=timodel_ntg_II.rsf \
label2=cdp o2=1 n2=3606 d2=1 \
label3=cdpt o3=1 n3=1 d3=1 \

In this example input traces in timodel_shot_data_II.rsf are merged
with headers in timodel_shot_data_II_hdr.rsf and written to the pipe.
Three seperate executions of sftahheadermath are used to compute
headers. The first sftahheadermath averages sy and gy to compute cdpy.
The second sftahheadermath computes the cdp number by dividing cdpy by
the cdp interval, 20 meters. The third sftahheadermath compute the
cdpt by dividing the offset by 200. Sftahgain is used to multiply
trace amplitudes by time (a simple spreading correction. The traces
are passed to sftahwrite that outputs cdpt 1, the near trace, to the
file timodel_ntg_II.rsf. The trace headers are saved in
timodel_ntg_II_hdr.rsf. Sftahwrite also writes the traces to STDOUT,
which is directed to /dev/null (the bit bucket).

string output= no default

An equation to compute using the header keys. Equations should
problable be enclosed in quotes, ie ", to the equation can include
multiplication, *, or blanks.
For example, to compute the midpoint x input:

string outputkey= no default
the name of the output trace header key to put the evaluation of
output. For example to put the average of sx and gx into cdpx input:

string output=
Describes the output in a mathematical notation.
string outputkey=
name of the header key to put the results of the output equation
int verbose=1

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

Used In