Bugfix: Captured error, if earllatepicker returns None for lpickS1/2, epickS1/2, and Serror1/2.

This commit is contained in:
Ludger Küperkoch 2015-11-24 13:35:23 +01:00
parent ab8775c58d
commit 7f05568f65

View File

@ -500,58 +500,60 @@ def autopickstation(wfstream, pickparam):
[lpickS2, epickS2, Serror2] = earllatepicker(h_copy, nfacS, [lpickS2, epickS2, Serror2] = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
mpickS, iplot) mpickS, iplot)
if algoS == 'ARH': if epickS1 is not None and epickS2 is not None:
# get earliest pick of both earliest possible picks if algoS == 'ARH':
epick = [epickS1, epickS2] # get earliest pick of both earliest possible picks
lpick = [lpickS1, lpickS2] epick = [epickS1, epickS2]
pickerr = [Serror1, Serror2] lpick = [lpickS1, lpickS2]
if epickS1 == None and epickS2 is not None: pickerr = [Serror1, Serror2]
ipick = 1 if epickS1 == None and epickS2 is not None:
elif epickS1 is not None and epickS2 == None: ipick = 1
ipick = 0 elif epickS1 is not None and epickS2 == None:
elif epickS1 is not None and epickS2 is not None: ipick = 0
ipick = np.argmin([epickS1, epickS2]) elif epickS1 is not None and epickS2 is not None:
elif algoS == 'AR3': ipick = np.argmin([epickS1, epickS2])
[lpickS3, epickS3, Serror3] = earllatepicker(h_copy, nfacS, elif algoS == 'AR3':
tsnrh, [lpickS3, epickS3, Serror3] = earllatepicker(h_copy, nfacS,
mpickS, iplot) tsnrh,
# get earliest pick of all three picks mpickS, iplot)
epick = [epickS1, epickS2, epickS3] # get earliest pick of all three picks
lpick = [lpickS1, lpickS2, lpickS3] epick = [epickS1, epickS2, epickS3]
pickerr = [Serror1, Serror2, Serror3] lpick = [lpickS1, lpickS2, lpickS3]
if epickS1 == None and epickS2 is not None \ pickerr = [Serror1, Serror2, Serror3]
and epickS3 is not None: if epickS1 == None and epickS2 is not None \
ipick = np.argmin([epickS2, epickS3]) and epickS3 is not None:
elif epickS1 is not None and epickS2 == None \ ipick = np.argmin([epickS2, epickS3])
and epickS3 is not None: elif epickS1 is not None and epickS2 == None \
ipick = np.argmin([epickS2, epickS3]) and epickS3 is not None:
elif epickS1 is not None and epickS2 is not None \ ipick = np.argmin([epickS2, epickS3])
and epickS3 == None: elif epickS1 is not None and epickS2 is not None \
ipick = np.argmin([epickS1, epickS2]) and epickS3 == None:
elif epickS1 is not None and epickS2 is not None \ ipick = np.argmin([epickS1, epickS2])
and epickS3 is not None: elif epickS1 is not None and epickS2 is not None \
ipick = np.argmin([epickS1, epickS2, epickS3]) and epickS3 is not None:
epickS = epick[ipick] ipick = np.argmin([epickS1, epickS2, epickS3])
lpickS = lpick[ipick]
Serror = pickerr[ipick]
# get SNR epickS = epick[ipick]
[SNRS, SNRSdB, Snoiselevel] = getSNR(h_copy, tsnrh, mpickS) lpickS = lpick[ipick]
Serror = pickerr[ipick]
# weight S-onset using symmetric error # get SNR
if Serror <= timeerrorsS[0]: [SNRS, SNRSdB, Snoiselevel] = getSNR(h_copy, tsnrh, mpickS)
Sweight = 0
elif timeerrorsS[0] < Serror <= timeerrorsS[1]:
Sweight = 1
elif Perror > timeerrorsS[1] and Serror <= timeerrorsS[2]:
Sweight = 2
elif timeerrorsS[2] < Serror <= timeerrorsS[3]:
Sweight = 3
elif Serror > timeerrorsS[3]:
Sweight = 4
print 'autopickstation: S-weight: %d, SNR: %f, SNR[dB]: %f' % ( # weight S-onset using symmetric error
Sweight, SNRS, SNRSdB) if Serror <= timeerrorsS[0]:
Sweight = 0
elif timeerrorsS[0] < Serror <= timeerrorsS[1]:
Sweight = 1
elif Perror > timeerrorsS[1] and Serror <= timeerrorsS[2]:
Sweight = 2
elif timeerrorsS[2] < Serror <= timeerrorsS[3]:
Sweight = 3
elif Serror > timeerrorsS[3]:
Sweight = 4
print 'autopickstation: S-weight: %d, SNR: %f, SNR[dB]: %f' % (
Sweight, SNRS, SNRSdB)
################################################################## ##################################################################
# get Wood-Anderson peak-to-peak amplitude # get Wood-Anderson peak-to-peak amplitude
print "################################################" print "################################################"