5.4. despike

Functions for despiking seismic data.

copyright:Calum Chamberlain.
license:GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)
despike.median_filter(tr, multiplier=10, windowlength=0.5, interp_len=0.05, debug=0)[source]

Filter out spikes in data according to the median absolute deviation of the data. Replaces spikes with linear interpolation. Works in-place on data.

Parameters:
  • tr (obspy.Trace) – trace to despike
  • multiplier (float) – median absolute deviation multiplier to find spikes above.
  • windowlength (int) – Length of window to look for spikes in in seconds.
  • interp_len (int) – Length in seconds to interpolate around spikes.
Returns:

obspy.trace

despike.template_remove(tr, template, cc_thresh, interp_len, debug=0)[source]

Looks for instances of template in the trace and removes the matches.

Parameters:
  • tr (obspy.core.Trace) – Trace to remove spikes from
  • template (osbpy.core.Trace) – Spike template to look for in data
  • cc_thresh (float) – Cross-correlation trheshold (-1 - 1)
  • interp_len (float) – Window length to remove and fill in seconds
  • debug (int) – Debug level
Returns:

tr, works in place