SUMEDIAN - MEDIAN filter about a user-defined polygonal curve with the distance along the curve specified by key header word

 sumedian <stdin >stdout xshift= tshift= [optional parameters]         

 Required parameters:                                      
 xshift=          array of position values as specified by 
                  the `key' parameter                      
 tshift=          array of corresponding time values (sec) 
  ... or input via files:                                  
 nshift=          number of x,t values defining median times     
 xfile=           file containing position values as specified by
                  the `key' parameter                      
 tfile=           file containing corresponding time values (sec)

 Optional parameters:                                      
 key=tracl        Key header word specifying trace offset  
                        =offset  use trace number instead  

 mix=.6,1,1,1,.6  array of weights for mix (weighted moving average)

 verbose=0  verbose = 1 echoes information                 

 tmpdir=     if non-empty, use the value as a directory path
             prefix for storing temporary files; else if the
               the CWP_TMPDIR environment variable is set use    
               its value for the path; else use tmpfile()  

 Notes:                                              
 Median filtering is a process for suppressing a particular moveout on
 seismic sections. Median filtering has an advantage over traditional 
 dip filtering in that events with an arbitrary moveout may be suppressed

 The process consists of 3 steps. In the first step,             
 a copy of the data panel is shifted so that the polygon in x,t specifying
 moveout is flattened to horizontal. (The x,t pairs are specified either
 by the vector xshift,tshift or by the values in the datafiles xfile,tfile.)
 The second step in the process is to perform a mix (weighted moving  
 average) over the shifted panel to emphasize events with the specified
 moveout and destroy events with other moveouts . The panel is then    
 shifted back to its original moveout and is then subtracted from the  
 original data, eliminating all events with the user-specified moveout.

 The values of tshift are linearly interpolated for traces falling between
 given xshift values. The tshift interpolant is extrapolated to the left
 by the smallest time sample on the trace and to the right by the last
 value given in the tshift array.                          

 The files tfile and xfile are files of binary (C-style) floats. 

 The number of values defined by mix=val1,val2,... determines the number
 of traces to be averaged, the values determine the weights.           

 Caveat:                                             
 The median filter may perform poorly on the edges of a section. 
 Choosing larger beginning and ending mix values may help, but may also
 but may also introduce additional artifacts.                    


 Credits:

 CWP: John Stockwell, based in part on sumute, sureduce, sumix

 Trace header fields accessed: ns, dt, delrt, key=keyword