[add] remove mean from traces to avoid filtering artifact

Traces with constant offset (mean != 0) produce a large, low period artifact when filtered, even with tapering.
This commit is contained in:
Darius Arnold 2017-09-15 12:09:56 +02:00
parent 219d2d0e5a
commit 00df77e723

View File

@ -228,8 +228,10 @@ def autopickstation(wfstream, pickparam, verbose=False,
data=str(zdat)) data=str(zdat))
if verbose: print(msg) if verbose: print(msg)
z_copy = zdat.copy() z_copy = zdat.copy()
# filter and taper data
tr_filt = zdat[0].copy() tr_filt = zdat[0].copy()
#remove constant offset from data to avoid unwanted filter response
tr_filt.detrend(type='demean')
# filter and taper data
tr_filt.filter('bandpass', freqmin=bpz1[0], freqmax=bpz1[1], tr_filt.filter('bandpass', freqmin=bpz1[0], freqmax=bpz1[1],
zerophase=False) zerophase=False)
tr_filt.taper(max_percentage=0.05, type='hann') tr_filt.taper(max_percentage=0.05, type='hann')
@ -364,6 +366,9 @@ def autopickstation(wfstream, pickparam, verbose=False,
# filter and taper horizontal traces # filter and taper horizontal traces
trH1_filt = edat.copy() trH1_filt = edat.copy()
trH2_filt = ndat.copy() trH2_filt = ndat.copy()
# remove constant offset from data to avoid unwanted filter response
trH1_filt.detrend(type='demean')
trH2_filt.detrend(type='demean')
trH1_filt.filter('bandpass', freqmin=bph1[0], trH1_filt.filter('bandpass', freqmin=bph1[0],
freqmax=bph1[1], freqmax=bph1[1],
zerophase=False) zerophase=False)
@ -424,6 +429,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
# re-filter waveform with larger bandpass # re-filter waveform with larger bandpass
z_copy = zdat.copy() z_copy = zdat.copy()
tr_filt = zdat[0].copy() tr_filt = zdat[0].copy()
tr_filt.detrend(type='demean')
tr_filt.filter('bandpass', freqmin=bpz2[0], freqmax=bpz2[1], tr_filt.filter('bandpass', freqmin=bpz2[0], freqmax=bpz2[1],
zerophase=False) zerophase=False)
tr_filt.taper(max_percentage=0.05, type='hann') tr_filt.taper(max_percentage=0.05, type='hann')
@ -586,6 +592,8 @@ def autopickstation(wfstream, pickparam, verbose=False,
# filter and taper data # filter and taper data
trH1_filt = hdat[0].copy() trH1_filt = hdat[0].copy()
trH2_filt = hdat[1].copy() trH2_filt = hdat[1].copy()
trH1_filt.detrend(type='demean')
trH2_filt.detrend(type='demean')
trH1_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1], trH1_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
zerophase=False) zerophase=False)
trH2_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1], trH2_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
@ -604,6 +612,9 @@ def autopickstation(wfstream, pickparam, verbose=False,
trH1_filt = hdat[0].copy() trH1_filt = hdat[0].copy()
trH2_filt = hdat[1].copy() trH2_filt = hdat[1].copy()
trH3_filt = hdat[2].copy() trH3_filt = hdat[2].copy()
trH1_filt.detrend(type='demean')
trH2_filt.detrend(type='demean')
trH3_filt.detrend(type='demean')
trH1_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1], trH1_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
zerophase=False) zerophase=False)
trH2_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1], trH2_filt.filter('bandpass', freqmin=bph1[0], freqmax=bph1[1],
@ -671,6 +682,8 @@ def autopickstation(wfstream, pickparam, verbose=False,
if algoS == 'ARH': if algoS == 'ARH':
trH1_filt = hdat[0].copy() trH1_filt = hdat[0].copy()
trH2_filt = hdat[1].copy() trH2_filt = hdat[1].copy()
trH1_filt.detrend(type='demean')
trH2_filt.detrend(type='demean')
trH1_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1], trH1_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
zerophase=False) zerophase=False)
trH2_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1], trH2_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
@ -686,6 +699,9 @@ def autopickstation(wfstream, pickparam, verbose=False,
trH1_filt = hdat[0].copy() trH1_filt = hdat[0].copy()
trH2_filt = hdat[1].copy() trH2_filt = hdat[1].copy()
trH3_filt = hdat[2].copy() trH3_filt = hdat[2].copy()
trH1_filt.detrend(type='demean')
trH2_filt.detrend(type='demean')
trH3_filt.detrend(type='demean')
trH1_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1], trH1_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],
zerophase=False) zerophase=False)
trH2_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1], trH2_filt.filter('bandpass', freqmin=bph2[0], freqmax=bph2[1],