DOCUMENTATION

SYNOPSIS

PERL PROGRAM NAME:  SUPEF - Wiener predictive error filtering		
		
AUTHOR: Juan Lorenzo (Perl module only)

DATE: 
  
DESCRIPTION:

Version: 

USE

NOTES

Examples

SEISMIC UNIX NOTES

 SUPEF - Wiener predictive error filtering				

 supef <stdin >stdout  [optional parameters]				

 Required parameters:							
 dt is mandatory if not set in header			 		

 Optional parameters:							
 cdp= 			CDPs for which minlag, maxlag, pnoise, mincorr, 
			maxcorr are set	(see Notes)			
 minlag=dt		first lag of prediction filter (sec)		
 maxlag=last		lag default is (tmax-tmin)/20			
 pnoise=0.001		relative additive noise level			
 mincorr=tmin		start of autocorrelation window (sec)		
 maxcorr=tmax		end of autocorrelation window (sec)		
 showwiener=0		=1 to show Wiener filter on each trace		
 mix=1,...	 	array of weights (floats) for moving		
				average of the autocorrelations		
 outpar=/dev/null	output parameter file, contains the Wiener filter
 			if showwiener=1 is set				
 method=linear	 for linear interpolation of cdp values			
		       =mono for monotonic cubic interpolation of cdps	
		       =akima for Akima's cubic interpolation of cdps	
		       =spline for cubic spline interpolation of cdps	

 Trace header fields accessed: ns, dt					
 Trace header fields modified: none					

 Notes:								

 1) To apply spiking decon (Wiener filtering with no gap):		

 Run the following command						

    suacor < data.su | suximage perc=95				

 You will see horizontal strip running across the center of your plot.	
 This is the autocorrelation wavelet for each trace. The idea of spiking
 decon is to apply a Wiener filter with no gap to the data to collapse	
 the waveform into a spike. The idea is to pick the width of the	
 autocorrelation waveform _from beginning to end_ (not trough to trough)
 and use this time for MAXLAG_SPIKING:					

  supef < data.su maxlag=MAXLAG_SPIKING  > dataspiked.su		

 2) Prediction Error Filter (i.e. gapped Wiener filtering)		
 The purpose of gapped decon is to suppress repetitions in the data	
 such as those caused by water bottom multiples.			

 To look for the period of the repetitions				

    suacor ntout=1000 < dataspiked.su | suximage perc=95		

 The value of ntout must be larger than the default 100. The idea is	
 to look for repetitions in the autocorrelation. These repetitions will
 appear as a family of parallel stripes above and below the main	
 autocorrelation waveform. Set MAXLAG_PEF to the period of the repetitions
 Set MINLAG_PEF to be slightly larger than the value of MAXLAG_SPIKING	
 that you used to spike the data. In general, the periodicity of the	
 repetitions in the autocorrelation will be the GAP_SIZE 		
 with     MAXLAG_PEF = GAP_SIZE + MINLAG_PEF 				
 some experimentation may be necessary to see sensitivity to choices	
 of MAXLAG_PEF.							

  supef < dataspiked.su minlag=MINLAG_PEF maxlag=MAXLAG_PEF > datapef.su

 Some experimentation may be required to get a satisfactory result.	

 3) It may be effective to sort your data into cdp gathers with susort,
 and perform sunmo correction to the water speed with sunmo, prior to 	
 attempts to suppress water bottom multiples. After applying supef, the
 user should apply inverse nmo to undo the nmo to water speed prior to	
 further processing. Or, do the predictive decon on fully nmo-corrected
 gathers.								

 For a filter expressed as a function of cdp, specify the array	
     cdp=cdp1,cdp2,...							
 and for each cdp specified, specify the minlag and maxlag arrays as	
      minlag=min1,min2,...     maxlag=max1,max2,...   			

 It is required that the number of minlag and maxlag values be equal to
 the number of cdp's specified.  If the number of			
 values in these arrays does not equal the number of cdp's, only the first
 value will be used.							

 Caveat:								
 The showwiener=1 option writes out the wiener filter to outpar, and   
 the prediction error filter to stdout, which is			", 
     1,0,0,...,-wiener[0],...,-wiener[imaxlag-1] 			
 where the sample value of -wiener[0], is  iminlag in the pe-filter.	
 The pe-filter is output as a SU format datafile, one pe-filter for each
 trace input.								


 Credits:
	CWP: Shuki Ronen, Jack K. Cohen, Ken Larner
      CWP: John Stockwell, added mixing feature (April 1998)
      CSM: Tanya Slota (September 2005) added cdp feature

      Technical Reference:
	A. Ziolkowski, "Deconvolution", for value of maxlag default:
		page 91: imaxlag < nt/10.  I took nt/20.

 Notes:
	The prediction error filter is 1,0,0...,0,-wiener[0], ...,
	so no point in explicitly forming it.

	If imaxlag < 2*iminlag - 1, then we don't need to compute the
	autocorrelation for lags:
		imaxlag-iminlag+1, ..., iminlag-1
	It doesn't seem worth the duplicated code to implement this.

 Trace header fields accessed: ns

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 cdp

sub minlag

sub maxlag

sub pnoise

sub mincorr

sub maxcorr

sub showwiener

sub mix

sub outpar

sub method

sub ntout

sub get_max_index

max index = number of input variables -1