[update] on obspyDMT compatibility (WIP)

This commit is contained in:
Marcel Paffrath 2018-06-19 10:35:34 +02:00
parent ec32981787
commit ca886d4355
2 changed files with 24 additions and 20 deletions

View File

@ -139,6 +139,7 @@ class MainWindow(QMainWindow):
self.apd_local = None self.apd_local = None
self.apd_sge = None self.apd_sge = None
self.stations_highlighted = [] self.stations_highlighted = []
self.obspy_dmt = False
self.poS_id = None self.poS_id = None
self.ae_id = None self.ae_id = None
@ -1006,7 +1007,6 @@ class MainWindow(QMainWindow):
# TODO: add dataStructure class for obspyDMT here, this is just a workaround! # TODO: add dataStructure class for obspyDMT here, this is just a workaround!
eventpath = self.get_current_event_path(eventbox) eventpath = self.get_current_event_path(eventbox)
basepath = eventpath.split(os.path.basename(eventpath))[0] basepath = eventpath.split(os.path.basename(eventpath))[0]
obspy_dmt = check_obspydmt_structure(basepath)
if self.dataStructure: if self.dataStructure:
if not eventpath: if not eventpath:
return return
@ -1700,9 +1700,9 @@ class MainWindow(QMainWindow):
self.fnames_syn = [] self.fnames_syn = []
eventpath = self.get_current_event_path() eventpath = self.get_current_event_path()
basepath = eventpath.split(os.path.basename(eventpath))[0] basepath = eventpath.split(os.path.basename(eventpath))[0]
obspy_dmt = check_obspydmt_structure(basepath) self.obspy_dmt = check_obspydmt_structure(basepath)
self.dataPlot.activateObspyDMToptions(obspy_dmt) self.dataPlot.activateObspyDMToptions(self.obspy_dmt)
if obspy_dmt: if self.obspy_dmt:
self.prepareObspyDMT_data(eventpath) self.prepareObspyDMT_data(eventpath)
def loadWaveformData(self): def loadWaveformData(self):
@ -2392,7 +2392,8 @@ class MainWindow(QMainWindow):
self.init_fig_dict() self.init_fig_dict()
#if not self.tap: #if not self.tap:
# init TuneAutopicker object # init TuneAutopicker object
self.tap = TuneAutopicker(self) wftype = self.dataPlot.qcombo_processed.currentText() if self.obspy_dmt else None
self.tap = TuneAutopicker(self, wftype)
# first call of update to init tabs with empty canvas # first call of update to init tabs with empty canvas
self.update_autopicker() self.update_autopicker()
# connect update signal of TuneAutopicker with update function # connect update signal of TuneAutopicker with update function

View File

@ -3008,13 +3008,13 @@ class TuneAutopicker(QWidget):
:type: PyLoT Mainwindow :type: PyLoT Mainwindow
''' '''
def __init__(self, parent): def __init__(self, parent, wftype=None):
QtGui.QWidget.__init__(self, parent, 1) QtGui.QWidget.__init__(self, parent, 1)
self._style = parent._style self._style = parent._style
self.setWindowTitle('PyLoT - Tune Autopicker') self.setWindowTitle('PyLoT - Tune Autopicker')
self.parameter = self.parent()._inputs self.parameter = self.parent()._inputs
self.fig_dict = self.parent().fig_dict self.fig_dict = self.parent().fig_dict
self.data = Data() self.wftype = wftype
self.pdlg_widget = None self.pdlg_widget = None
self.pylot_picks = None self.pylot_picks = None
self.init_main_layouts() self.init_main_layouts()
@ -3072,18 +3072,19 @@ class TuneAutopicker(QWidget):
self.stationBox.activated.connect(self.fill_tabs) self.stationBox.activated.connect(self.fill_tabs)
def fill_stationbox(self): def fill_stationbox(self):
fnames = self.parent().getWFFnames_from_eventbox(eventbox=self.eventBox) #fnames = self.parent().fnames #getWFFnames_from_eventbox(eventbox=self.eventBox)
self.data.setWFData(fnames) #self.data.setWFData(fnames)
self.data = self.parent().data
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) # 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
trim_station_components(wfdat, trim_start=True, trim_end=False) # trim_station_components(wfdat, trim_start=True, trim_end=False)
self.stationBox.clear() self.stationBox.clear()
stations = [] stations = []
for trace in self.data.getWFData(): for trace in self.data.getWFData():
@ -3145,7 +3146,9 @@ class TuneAutopicker(QWidget):
return self.eventBox.currentText().split('/')[-1] return self.eventBox.currentText().split('/')[-1]
def get_current_event_fp(self): def get_current_event_fp(self):
return self.eventBox.currentText() wfext = self.wftype if self.wftype else ''
fp = os.path.join(self.eventBox.currentText(), wfext)
return fp
def get_current_event_picks(self, station): def get_current_event_picks(self, station):
event = self.get_current_event() event = self.get_current_event()
@ -3175,11 +3178,11 @@ class TuneAutopicker(QWidget):
self.pdlg_widget = None self.pdlg_widget = None
return return
station = self.get_current_station() station = self.get_current_station()
data = self.data.getWFData() wfdata = self.data.getWFData()
metadata = self.parent().metadata metadata = self.parent().metadata
event = self.get_current_event() event = self.get_current_event()
filteroptions = self.parent().filteroptions filteroptions = self.parent().filteroptions
self.pickDlg = PickDlg(self.parent(), data=data.select(station=station), self.pickDlg = PickDlg(self.parent(), data=wfdata.select(station=station).copy(),
station=station, parameter=self.parameter, station=station, parameter=self.parameter,
picks=self.get_current_event_picks(station), picks=self.get_current_event_picks(station),
autopicks=self.get_current_event_autopicks(station), autopicks=self.get_current_event_autopicks(station),