2015-03-30 10:58:24 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Created Mar/Apr 2015
|
2015-04-02 15:45:38 +02:00
|
|
|
Function to calculate SNR of certain part of seismogram relative
|
2015-03-30 10:58:24 +02:00
|
|
|
to given time. Returns SNR and SNR [dB].
|
|
|
|
|
|
|
|
:author: Ludger Kueperkoch /MAGS EP3 working group
|
|
|
|
"""
|
|
|
|
|
2015-04-02 15:45:38 +02:00
|
|
|
import argparse
|
|
|
|
import obspy
|
|
|
|
from pylot.core.pick.utils import getSNR
|
2015-03-30 10:58:24 +02:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2015-04-02 15:45:38 +02:00
|
|
|
parser = argparse.ArgumentParser()
|
2016-03-21 11:14:16 +01:00
|
|
|
parser.add_argument('--data', '-d', type=obspy.core.stream.Stream,
|
2015-04-02 15:45:38 +02:00
|
|
|
help='time series (seismogram) read with obspy module '
|
|
|
|
'read',
|
|
|
|
dest='data')
|
|
|
|
parser.add_argument('--tsnr', '-s', type=tuple,
|
|
|
|
help='length of time windows around pick used to '
|
|
|
|
'determine SNR [s] (Tnoise, Tgap, Tsignal)',
|
|
|
|
dest='tsnr')
|
|
|
|
parser.add_argument('--time', '-t', type=float,
|
|
|
|
help='initial time from which noise and signal windows '
|
|
|
|
'are calculated',
|
|
|
|
dest='time')
|
|
|
|
args = parser.parse_args()
|
|
|
|
print getSNR(args.data, args.tsnr, args.time)
|