How to apply quantile clipping to Seismic Data?

Viewed 72

Currently I am trying to apply quantile clipping to seismic data using segyio to access Trace data and Numpy to perform data processing. I have written the following functions:

def clip(file,value):
traces = file.trace
for i,_ in enumerate(traces):
        traces[i] = np.where(traces[i]>value,value,traces[i])
        traces[i] = np.where(traces[i]<-value,-value,traces[i])

and

def qclip(file,value):
    data = np.array([i for i in file.trace ])
    clipval = np.quantile(np.abs(data),value)
    clip(file,clipval)

qclip takes segyio opened file and value in [0,1] to apply quantile clipping to the traces. It works but the value of clipping applied is very different from the value i get from Seismic Unix using:

sugain < infile qclip=value > outfile

here is the implementation of sugain qclip.

1 Answers

Try np.percentile instead of np.quantile

Related