[bugfix] gaps are now merged when data are loaded and not when plotting (could cause problems with data object being empty)

This commit is contained in:
2019-08-14 14:52:56 +02:00
parent 15882ed27e
commit c1cb0e4a37
12 changed files with 5194 additions and 12 deletions
+20 -1
View File
@@ -878,7 +878,7 @@ def merge_stream(stream):
return stream, gaps
def check4gaps(data):
def check4gapsAndRemove(data):
"""
check for gaps in Stream and remove them
:param data: stream of seismic data
@@ -898,6 +898,25 @@ def check4gaps(data):
return data
def check4gapsAndMerge(data):
"""
check for gaps in Stream and merge if gaps are found
:param data: stream of seismic data
:type data: `~obspy.core.stream.Stream`
:return: data stream
:rtype: `~obspy.core.stream.Stream`
"""
gaps = data.get_gaps()
if gaps:
merged = ['{}.{}.{}.{}'.format(*gap[:4]) for gap in gaps]
data.merge(method=1)
print('Merged the following stations because of gaps:')
for merged_station in merged:
print(merged_station)
return data
def check4doubled(data):
"""
check for doubled stations for same channel in Stream and take only the first one