DOCUMENTATION

SYNOPSIS

PERL PROGRAM NAME:  SUCHW - Change Header Word using one or two header word fields	
AUTHOR: Juan Lorenzo (Perl module only)
DATE:   
DESCRIPTION: Nov 3 2013,
Version: 0.1

USE suchw->clear(); suchw->(); $suchw[1] = suchw->Step();

NOTES

This program derives from suchw in Seismic Unix
"notes" keeps track of actions for possible use in graphics
"steps" keeps track of actions for execution in the system

Examples

SEISMIC UNIX NOTES

 SUCHW - Change Header Word using one or two header word fields	

  suchw <stdin >stdout [optional parameters]				

 Required parameters:							
 none									

 Optional parameters:							
 key1=cdp,...	output key(s) 						
 key2=cdp,...	input key(s) 						
 key3=cdp,...	input key(s)  						
 a=0,...		overall shift(s)				
 b=1,...		scale(s) on first input key(s) 			
 c=0,...		scale on second input key(s) 			
 d=1,...		overall scale(s)				
 e=1,...		exponent on first input key(s)
 f=1,...		exponent on second input key(s)

 The value of header word key1 is computed from the values of		
 key2 and key3 by:							

	val(key1) = (a + b * val(key2)^e + c * val(key3)^f) / d		

 Examples:								
 Shift cdp numbers by -1:						
	suchw <data >outdata a=-1					

 Add 1000 to tracr value:						
 	suchw key1=tracr key2=tracr a=1000 <infile >outfile		

 We set the receiver point (gx) field by summing the offset		
 and shot point (sx) fields and then we set the cdp field by		
 averaging the sx and gx fields (we choose to use the actual		
 locations for the cdp fields instead of the conventional		
 1, 2, 3, ... enumeration):						

   suchw <indata key1=gx key2=offset key3=sx b=1 c=1 |			
   suchw key1=cdp key2=gx key3=sx b=1 c=1 d=2 >outdata			

 Do both operations in one call:					

 suchw<indata key1=gx,cdp key2=offset,gx key3=sx,sx b=1,1 c=1,1 d=1,2 >outdata


 Credits:
	SEP: Einar Kjartansson
	CWP: Jack K. Cohen
      CWP: John Stockwell, 7 July 1995, added array of keys feature
      Delphi: Alexander Koek, 6 November 1995, changed calculation so
              headers of different types can be expressed in each other

CHANGES and their DATES

sub Step

collects switches and assembles bash instructions by adding the program name

sub note

collects switches and assembles bash instructions by adding the program name

sub clear

sub a

subs a, add_to_all 
add the following
value after 
all other operations
are complete

sub add_to_all

subs a, add_to_all 
add the following
value after 
all other operations
are complete

sub b

Multiply first header values by
this constant

sub c

Multiply second header values by
this constant

sub d

After all calculations are complete
divide the result by

sub divide_all_by

After all calculations are complete
divide the result by

sub e

Raise the first header values to
a given power

sub f

Raise the second header values to
a given power

sub first_header

select the first header value to use

sub hdr1_exponent

Raise the first header values to
a given power

sub hdr2_exponent

Raise the second header values to
a given power

sub key1

select the result header value to use

sub key2

select the first header value to use

sub key3

select the second header value to use 

sub multiply_hdr1_by

Multiply first header values by
this constant

sub multiply_hdr2_by

Multiply second header values by
this constant

sub result_header

select the result header value to use

sub second_header

select the second header value to use 

sub get_max_index

max index = number of input variables -1