feature/port-to-py3 #11
21
PyLoT.py
21
PyLoT.py
@ -1174,7 +1174,7 @@ class MainWindow(QMainWindow):
|
|||||||
print(msg.format(len(eventlist_subset)))
|
print(msg.format(len(eventlist_subset)))
|
||||||
eventlist = [eventname for eventname in eventlist if eventname in eventlist_subset]
|
eventlist = [eventname for eventname in eventlist if eventname in eventlist_subset]
|
||||||
if check_obspydmt_structure(basepath):
|
if check_obspydmt_structure(basepath):
|
||||||
print('Recognized obspyDMT structure in selected files. Settings Datastructure to ObspyDMT')
|
print('Recognized obspyDMT structure in selected files. Setting Datastructure to ObspyDMT')
|
||||||
self.dataStructure = DATASTRUCTURE['obspyDMT']()
|
self.dataStructure = DATASTRUCTURE['obspyDMT']()
|
||||||
eventlist = check_all_obspy(eventlist)
|
eventlist = check_all_obspy(eventlist)
|
||||||
else:
|
else:
|
||||||
@ -1399,18 +1399,19 @@ class MainWindow(QMainWindow):
|
|||||||
event_ref = event.isRefEvent()
|
event_ref = event.isRefEvent()
|
||||||
event_test = event.isTestEvent()
|
event_test = event.isTestEvent()
|
||||||
|
|
||||||
time = lat = lon = depth = localmag = momentmag = None
|
time = lat = lon = depth = localmag = None
|
||||||
if len(event.origins) == 1:
|
if len(event.origins) == 1:
|
||||||
origin = event.origins[0]
|
origin = event.origins[0]
|
||||||
time = origin.time + 0 # add 0 because there was an exception for time = 0s
|
time = origin.time + 0 # add 0 because there was an exception for time = 0s
|
||||||
lat = origin.latitude
|
lat = origin.latitude
|
||||||
lon = origin.longitude
|
lon = origin.longitude
|
||||||
depth = origin.depth
|
depth = origin.depth
|
||||||
if len(event.magnitudes) > 1:
|
|
||||||
moment_magnitude = event.magnitudes[0]
|
moment_magnitude = event.magnitudes[0]
|
||||||
|
momentmag = '%4.1f' % moment_magnitude.mag
|
||||||
|
if len(event.magnitudes) > 1:
|
||||||
local_magnitude = event.magnitudes[1]
|
local_magnitude = event.magnitudes[1]
|
||||||
localmag = '%4.1f' % local_magnitude.mag
|
localmag = '%4.1f' % local_magnitude.mag
|
||||||
momentmag = '%4.1f'% moment_magnitude.mag
|
|
||||||
|
|
||||||
# text = '{path:{plen}} | manual: [{p:3d}] | auto: [{a:3d}]'
|
# text = '{path:{plen}} | manual: [{p:3d}] | auto: [{a:3d}]'
|
||||||
# text = text.format(path=event_path,
|
# text = text.format(path=event_path,
|
||||||
@ -1885,6 +1886,10 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
curr_event = self.get_current_event()
|
curr_event = self.get_current_event()
|
||||||
|
if not curr_event:
|
||||||
|
print('Could not find current event. Try reload?')
|
||||||
|
return
|
||||||
|
|
||||||
if len(curr_event.origins) > 0:
|
if len(curr_event.origins) > 0:
|
||||||
origin_time = curr_event.origins[0].time
|
origin_time = curr_event.origins[0].time
|
||||||
tstart = settings.value('tstart') if get_None(settings.value('tstart')) else 0
|
tstart = settings.value('tstart') if get_None(settings.value('tstart')) else 0
|
||||||
@ -3292,13 +3297,15 @@ class MainWindow(QMainWindow):
|
|||||||
if event.magnitudes:
|
if event.magnitudes:
|
||||||
moment_magnitude = event.magnitudes[0]
|
moment_magnitude = event.magnitudes[0]
|
||||||
moment_magnitude.mag = '%4.1f' % moment_magnitude.mag
|
moment_magnitude.mag = '%4.1f' % moment_magnitude.mag
|
||||||
|
moment_mag = str(moment_magnitude.mag)
|
||||||
if len(event.magnitudes) > 1:
|
if len(event.magnitudes) > 1:
|
||||||
local_magnitude = event.magnitudes[1]
|
local_magnitude = event.magnitudes[1]
|
||||||
local_magnitude.mag = '%4.1f' % local_magnitude.mag
|
local_magnitude.mag = '%4.1f' % local_magnitude.mag
|
||||||
|
local_mag = str(local_magnitude.mag)
|
||||||
else:
|
else:
|
||||||
local_magnitude = moment_magnitude # MP MP small workaround in case there is no local magnitude, todo: improve this
|
local_mag = None
|
||||||
item_momentmag.setText(str(moment_magnitude.mag))
|
item_momentmag.setText(moment_mag)
|
||||||
item_localmag.setText(str(local_magnitude.mag))
|
item_localmag.setText(local_mag)
|
||||||
item_notes.setText(event.notes)
|
item_notes.setText(event.notes)
|
||||||
|
|
||||||
set_enabled(item_path, True, False)
|
set_enabled(item_path, True, False)
|
||||||
|
@ -1315,6 +1315,7 @@ def get_quality_class(uncertainty, weight_classes):
|
|||||||
:return: quality of pick (0-4)
|
:return: quality of pick (0-4)
|
||||||
:rtype: int
|
:rtype: int
|
||||||
"""
|
"""
|
||||||
|
if not uncertainty: return max(weight_classes)
|
||||||
try:
|
try:
|
||||||
# create generator expression containing all indices of values in weight classes that are >= than uncertainty.
|
# create generator expression containing all indices of values in weight classes that are >= than uncertainty.
|
||||||
# call next on it once to receive first value
|
# call next on it once to receive first value
|
||||||
|
@ -83,10 +83,10 @@ class Metadata(object):
|
|||||||
print('Path {} not in inventories list.'.format(path_to_inventory))
|
print('Path {} not in inventories list.'.format(path_to_inventory))
|
||||||
return
|
return
|
||||||
self.inventories.remove(path_to_inventory)
|
self.inventories.remove(path_to_inventory)
|
||||||
for filename in self.inventory_files.keys():
|
for filename in list(self.inventory_files.keys()):
|
||||||
if filename.startswith(path_to_inventory):
|
if filename.startswith(path_to_inventory):
|
||||||
del (self.inventory_files[filename])
|
del (self.inventory_files[filename])
|
||||||
for seed_id in self.seed_ids.keys():
|
for seed_id in list(self.seed_ids.keys()):
|
||||||
if self.seed_ids[seed_id].startswith(path_to_inventory):
|
if self.seed_ids[seed_id].startswith(path_to_inventory):
|
||||||
del (self.seed_ids[seed_id])
|
del (self.seed_ids[seed_id])
|
||||||
# have to clean self.stations_dict as well
|
# have to clean self.stations_dict as well
|
||||||
|
@ -5453,7 +5453,7 @@ class LoadDataDlg(QDialog):
|
|||||||
class HelpForm(QDialog):
|
class HelpForm(QDialog):
|
||||||
def __init__(self, parent=None,
|
def __init__(self, parent=None,
|
||||||
page=QUrl('https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/')):
|
page=QUrl('https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/')):
|
||||||
super(HelpForm, self).__init__(parent, 1)
|
super(HelpForm, self).__init__(parent)
|
||||||
self.setAttribute(Qt.WA_DeleteOnClose)
|
self.setAttribute(Qt.WA_DeleteOnClose)
|
||||||
self.setAttribute(Qt.WA_GroupLeader)
|
self.setAttribute(Qt.WA_GroupLeader)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user