[major, refs #200] major change for the magnitude estimation from GUI

restitution of waveform data has been moved to dataprocessing; the routines have been cleaned up and work in changed order now:
new function restitute_data is a wrapper function in order to restitute seismic data with the most popular kinds of station metadata
This commit is contained in:
2016-09-13 12:00:37 +02:00
parent 7c5b8cb646
commit 15700b074d
3 changed files with 147 additions and 119 deletions

View File

@@ -328,6 +328,23 @@ def isIterable(obj):
return False
return True
def key_for_set_value(d):
"""
takes a dictionary and returns the first key for which's value the
boolean is True
:param d: dictionary containing values
:type d: dict
:return: key to the first non-False value found; None if no value's
boolean equals True
"""
r = None
for k, v in d.items():
if v:
return k
return r
def prepTimeAxis(stime, trace):
'''
takes a starttime and a trace object and returns a valid time axis for
@@ -354,6 +371,20 @@ def prepTimeAxis(stime, trace):
return time_ax
def remove_underscores(data):
"""
takes a `obspy.core.stream.Stream` object and removes all underscores
from stationnames
:param data: stream of seismic data
:type data: `obspy.core.stream.Stream`
:return: data stream
"""
for tr in data:
# remove underscores
tr.stats.station = tr.stats.station.strip('_')
return data
def scaleWFData(data, factor=None, components='all'):
"""
produce scaled waveforms from given waveform data and a scaling factor,