DOCUMENTATION

SYNOPSIS

PROGRAM NAME: sunmo 
AUTHOR: Chang Liu
DATE:   Dec 1 2013
DESCRIPTION: 
Version: 0.0.1
         0.0.2 July 15, 2015 (JML)
		  0.0.3 Jan 14, 2020 (DLL)
		  0.0.4 Feb 06, 2020 (DLL)
=head2 USE

NOTES

Examples

SEISMIC UNIX NOTES

 SUNMO - NMO for an arbitrary velocity function of time and CDP	     

  sunmo <stdin >stdout [optional parameters]				     

 Optional Parameters:							     
 tnmo=0,...		NMO times corresponding to velocities in vnmo	     
 vnmo=1500,...		NMO velocities corresponding to times in tnmo	     
 cdp=			CDPs for which vnmo & tnmo are specified (see Notes) 
 smute=1.5		samples with NMO stretch exceeding smute are zeroed  
 lmute=25		length (in samples) of linear ramp for stretch mute  
 sscale=1		=1 to divide output samples by NMO stretch factor    
 invert=0		=1 to perform (approximate) inverse NMO		     
 upward=0		=1 to scan upward to find first sample to kill	     
 voutfile=		if set, interplolated velocity function v[cdp][t] is 
			output to named file.			     	     
 Notes:								     
 For constant-velocity NMO, specify only one vnmo=constant and omit tnmo.   

 NMO interpolation error is less than 1 0.000000or frequencies less than 600f   
 the Nyquist frequency.						     

 Exact inverse NMO is impossible, particularly for early times at large     
 offsets and for frequencies near Nyquist with large interpolation errors.  

 The "offset" header field must be set.				     
 Use suazimuth to set offset header field when sx,sy,gx,gy are all	     
 nonzero. 							   	     

 For NMO with a velocity function of time only, specify the arrays	     
	   vnmo=v1,v2,... tnmo=t1,t2,...				     
 where v1 is the velocity at time t1, v2 is the velocity at time t2, ...    
 The times specified in the tnmo array must be monotonically increasing.    
 Linear interpolation and constant extrapolation of the specified velocities
 is used to compute the velocities at times not specified.		     
 The same holds for the anisotropy coefficients as a function of time only. 

 For NMO with a velocity function of time and CDP, specify the array	     
	   cdp=cdp1,cdp2,...						     
 and, for each CDP specified, specify the vnmo and tnmo arrays as described 
 above. The first (vnmo,tnmo) pair corresponds to the first cdp, and so on. 
 Linear interpolation and constant extrapolation of 1/velocity^2 is used    
 to compute velocities at CDPs not specified.				     

 The format of the output interpolated velocity file is unformatted C floats
 with vout[cdp][t], with time as the fast dimension and may be used as an   
 input velocity file for further processing.				     

 Note that this version of sunmo does not attempt to deal with	anisotropy.  
 The version of sunmo with experimental anisotropy support is "sunmo_a


 Credits:
	SEP: Shuki Ronen, Chuck Sword
	CWP: Shuki Ronen, Jack, Dave Hale, Bjoern Rommel
      Modified: 08/08/98 - Carlos E. Theodoro - option for lateral offset
      Modified: 07/11/02 - Sang-yong Suh -
	  added "upward" option to handle decreasing velocity function.
      CWP: Sept 2010: John Stockwell
	  1. replaced Carlos Theodoro's fix 
	  2. added  the instruction in the selfdoc to use suazimuth to set 
	      offset so that it accounts for lateral offset. 
        3. removed  Bjoren Rommel's anisotropy stuff. sunmo_a is the 
           version with the anisotropy parameters left in.
        4. note that scalel does not scale the offset field in
           the segy standard.
 Technical Reference:
	The Common Depth Point Stack
	William A. Schneider
	Proc. IEEE, v. 72, n. 10, p. 1238-1254
	1984

 Trace header fields accessed: ns, dt, delrt, offset, cdp, scalel

CHANGES and their DATES

Juan Lorenzo July 15 2015
introduced "par" subroutine

V0.0.3 Jan 14 2020 automatic use of scalel

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 _get_data_scale

get scalco or scalel from file header

instantiate class

sub cdp

sub invert

sub lmute

sub par V0.0.3 1-14-2020 DLL automatic use of data_scale

read par file (assume in m/s or ft/s) scale a new output par file * data-scale assign new output par file

A typical parfile does only handles one gather at a time

instantiate classes

declare local variables

private definitions

read i/p file

scale par file values

write new par file

cat scaled par files

Declare

local variables

Set up a list of files for action

my $file_name_list_in
my $file_name_list_out
my @file_name_list 

Set up FLOW

RUN FLOW

LOG FLOW(s)

to screen and FILE

send to sunmo

sub par V0.0.3 1-14-2020 DLL automatic use of data_scale

read par file (assume in m/s or ft/s) scale a new output par file * data-scale assign new output par file

A typical parfile does only handles one gather at a time

instantiate classes

declare local variables

private definitions

read i/p file

scale par file values

write new par file

send to sunmo

sub smute

sub sscale

sub set_base_file_name

sub tnmo

sub upward

sub vnmo

sub vnmo_mps

sub voutfile

sub get_max_index

max index = number of input variables -1