[bugfix] using Metadata class for pickDlg, not yet working for array_map (WIP!)

This commit is contained in:
Marcel Paffrath 2018-07-17 16:04:20 +02:00
parent c172cfa892
commit 37da7327d0
2 changed files with 14 additions and 6 deletions

View File

@ -69,7 +69,7 @@ from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents
from pylot.core.util.errors import DatastructureError, \ from pylot.core.util.errors import DatastructureError, \
OverwriteError OverwriteError
from pylot.core.util.connection import checkurl from pylot.core.util.connection import checkurl
from pylot.core.util.dataprocessing import read_metadata, restitute_data from pylot.core.util.dataprocessing import Metadata, restitute_data
from pylot.core.util.utils import fnConstructor, getLogin, \ from pylot.core.util.utils import fnConstructor, getLogin, \
full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \ full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \
pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, \ pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, \
@ -1063,7 +1063,7 @@ class MainWindow(QMainWindow):
self.dataStructure = DATASTRUCTURE['obspyDMT']() self.dataStructure = DATASTRUCTURE['obspyDMT']()
eventlist = check_all_obspy(eventlist) eventlist = check_all_obspy(eventlist)
else: else:
print('Settings Datastructure to PILOT') print('Setting Datastructure to PILOT')
self.dataStructure = DATASTRUCTURE['PILOT']() self.dataStructure = DATASTRUCTURE['PILOT']()
eventlist = check_all_pylot(eventlist) eventlist = check_all_pylot(eventlist)
if not eventlist: if not eventlist:
@ -1922,6 +1922,13 @@ class MainWindow(QMainWindow):
if True in self.comparable.values(): if True in self.comparable.values():
self.compare_action.setEnabled(True) self.compare_action.setEnabled(True)
self.draw() self.draw()
# MP MP ++++
# TODO: Quick and dirty, improve this on later iteration
if self.obspy_dmt:
self.metadata = Metadata(os.path.join(self.get_current_event_path(), 'resp'))
self.inventoryAction.setEnabled(not self.obspy_dmt)
# MP MP ---
@staticmethod @staticmethod
def checkEvent4comparison(event): def checkEvent4comparison(event):
@ -3094,7 +3101,7 @@ class MainWindow(QMainWindow):
set_background_color(item_list, QtGui.QColor(*(0, 143, 143, 255))) set_background_color(item_list, QtGui.QColor(*(0, 143, 143, 255)))
def read_metadata_thread(self, fninv): def read_metadata_thread(self, fninv):
self.rm_thread = Thread(self, read_metadata, arg=fninv, progressText='Reading metadata...', self.rm_thread = Thread(self, Metadata, arg=fninv, progressText='Reading metadata...',
pb_widget=self.mainProgressBarWidget) pb_widget=self.mainProgressBarWidget)
self.rm_thread.finished.connect(self.set_metadata) self.rm_thread.finished.connect(self.set_metadata)
self.rm_thread.start() self.rm_thread.start()

View File

@ -1691,9 +1691,10 @@ class PickDlg(QDialog):
func = {True: self.model.get_ray_paths_geo, func = {True: self.model.get_ray_paths_geo,
False: self.model.get_travel_times_geo} False: self.model.get_travel_times_geo}
phases = self.prepare_phases() phases = self.prepare_phases()
station_id = self.data.traces[0].get_id() trace = self.data.traces[0]
parser = self.metadata[1] station_id = trace.get_id()
station_coords = parser.get_coordinates(station_id) starttime = trace.stats.starttime
station_coords = self.metadata.get_coordinates(station_id, starttime)
origins = self.pylot_event.origins origins = self.pylot_event.origins
if origins: if origins:
source_origin = origins[0] source_origin = origins[0]