[change] try to merge streams instead of deleting them when they have gaps
This commit is contained in:
parent
5f2848d584
commit
a85b79e432
@ -869,6 +869,19 @@ def trim_station_components(data, trim_start=True, trim_end=True):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def merge_stream(stream):
|
||||||
|
gaps = stream.get_gaps()
|
||||||
|
if gaps:
|
||||||
|
# list of merged stations (seed_ids)
|
||||||
|
merged = ['{}.{}.{}.{}'.format(*gap[:4]) for gap in gaps]
|
||||||
|
stream.merge()
|
||||||
|
print('Merged the following stations because of gaps:')
|
||||||
|
for merged_station in merged:
|
||||||
|
print(merged_station)
|
||||||
|
|
||||||
|
return stream, gaps
|
||||||
|
|
||||||
|
|
||||||
def check4gaps(data):
|
def check4gaps(data):
|
||||||
"""
|
"""
|
||||||
check for gaps in Stream and remove them
|
check for gaps in Stream and remove them
|
||||||
|
@ -52,7 +52,7 @@ from pylot.core.pick.compare import Comparison
|
|||||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS
|
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS
|
||||||
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
||||||
demeanTrace, isSorted, findComboBoxIndex, clims, pick_linestyle_plt, pick_color_plt, \
|
demeanTrace, isSorted, findComboBoxIndex, clims, pick_linestyle_plt, pick_color_plt, \
|
||||||
check4rotated, check4doubled, check4gaps, remove_underscores, find_horizontals, identifyPhase, \
|
check4rotated, check4doubled, check4gaps, merge_stream, remove_underscores, find_horizontals, identifyPhase, \
|
||||||
loopIdentifyPhase, trim_station_components, transformFilteroptions2String, \
|
loopIdentifyPhase, trim_station_components, transformFilteroptions2String, \
|
||||||
identifyPhaseID, real_Bool, pick_color, getAutoFilteroptions, SetChannelComponents
|
identifyPhaseID, real_Bool, pick_color, getAutoFilteroptions, SetChannelComponents
|
||||||
from autoPyLoT import autoPyLoT
|
from autoPyLoT import autoPyLoT
|
||||||
@ -734,13 +734,7 @@ class WaveformWidgetPG(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
st_select = wfdata
|
st_select = wfdata
|
||||||
|
|
||||||
gaps = st_select.get_gaps()
|
st_select, gaps = merge_stream(st_select)
|
||||||
if gaps:
|
|
||||||
merged = ['{}.{}.{}.{}'.format(*gap[:4]) for gap in gaps]
|
|
||||||
st_select.merge()
|
|
||||||
print('Merged the following stations because of gaps:')
|
|
||||||
for merged_station in merged:
|
|
||||||
print(merged_station)
|
|
||||||
|
|
||||||
# list containing tuples of network, station, channel (for sorting)
|
# list containing tuples of network, station, channel (for sorting)
|
||||||
nsc = []
|
nsc = []
|
||||||
@ -3240,6 +3234,7 @@ class TuneAutopicker(QWidget):
|
|||||||
self.resize(1280, 720)
|
self.resize(1280, 720)
|
||||||
self.center()
|
self.center()
|
||||||
self._manual_pick_plots = []
|
self._manual_pick_plots = []
|
||||||
|
self.fnames = None
|
||||||
if hasattr(self.parent(), 'metadata'):
|
if hasattr(self.parent(), 'metadata'):
|
||||||
self.metadata = self.parent().metadata
|
self.metadata = self.parent().metadata
|
||||||
else:
|
else:
|
||||||
@ -3328,13 +3323,16 @@ class TuneAutopicker(QWidget):
|
|||||||
|
|
||||||
def load_wf_data(self):
|
def load_wf_data(self):
|
||||||
fnames = self.station_ids[self.get_current_station_id()]
|
fnames = self.station_ids[self.get_current_station_id()]
|
||||||
|
if not fnames == self.fnames:
|
||||||
|
self.fnames = fnames
|
||||||
self.data.setWFData(fnames)
|
self.data.setWFData(fnames)
|
||||||
wfdat = self.data.getWFData() # all available streams
|
wfdat = self.data.getWFData() # all available streams
|
||||||
# remove possible underscores in station names
|
# remove possible underscores in station names
|
||||||
#wfdat = remove_underscores(wfdat)
|
#wfdat = remove_underscores(wfdat)
|
||||||
# rotate misaligned stations to ZNE
|
# rotate misaligned stations to ZNE
|
||||||
# check for gaps and doubled channels
|
# check for gaps and doubled channels
|
||||||
check4gaps(wfdat)
|
wfdat, gaps = merge_stream(wfdat)
|
||||||
|
#check4gaps(wfdat)
|
||||||
check4doubled(wfdat)
|
check4doubled(wfdat)
|
||||||
wfdat = check4rotated(wfdat, self.parent().metadata, verbosity=0)
|
wfdat = check4rotated(wfdat, self.parent().metadata, verbosity=0)
|
||||||
# trim station components to same start value
|
# trim station components to same start value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user