[bugfix] saving data did not work properly due to changed variable signature; picking on just one horizontal component now possible, crash was caused by mismatching component labels -> new function added to find these labels from the available data
This commit is contained in:
@@ -8,7 +8,7 @@ import os
|
||||
import pwd
|
||||
import re
|
||||
import subprocess
|
||||
from obspy.core import UTCDateTime
|
||||
from obspy import UTCDateTime, read
|
||||
|
||||
|
||||
def _pickle_method(m):
|
||||
@@ -354,6 +354,29 @@ def prepTimeAxis(stime, trace):
|
||||
return time_ax
|
||||
|
||||
|
||||
def find_horizontals(data):
|
||||
"""
|
||||
takes `obspy.core.stream.Stream` object and returns a list containing the component labels of the horizontal components available
|
||||
:param data: waveform data
|
||||
:type data: `obspy.core.stream.Stream`
|
||||
:return: components list
|
||||
:rtype: list
|
||||
|
||||
..example::
|
||||
|
||||
>>> st = read()
|
||||
>>> find_horizontals(st)
|
||||
[u'N', u'E']
|
||||
"""
|
||||
rval = []
|
||||
for tr in data:
|
||||
if tr.stats.channel[-1].upper() in ['Z', '3']:
|
||||
continue
|
||||
else:
|
||||
rval.append(tr.stats.channel[-1].upper())
|
||||
return rval
|
||||
|
||||
|
||||
def scaleWFData(data, factor=None, components='all'):
|
||||
"""
|
||||
produce scaled waveforms from given waveform data and a scaling factor,
|
||||
|
||||
Reference in New Issue
Block a user