[Bugfix]: Fix stationlist in TuneAutopicker dialog, partial fix of #266
Remove the channel from the station id
This commit is contained in:
parent
6a0c1dda9d
commit
f1690edf71
@ -1219,6 +1219,21 @@ def check_event_folder(path):
|
|||||||
return ev_type
|
return ev_type
|
||||||
|
|
||||||
|
|
||||||
|
def station_id_remove_channel(station_id):
|
||||||
|
"""
|
||||||
|
Remove the channel from a SEED station id and return Network.Station.Location.
|
||||||
|
>>> station_id_remove_channel("BW.MANZ..EHZ")
|
||||||
|
'BW.MANZ.'
|
||||||
|
>>> station_id_remove_channel("BW.MANZ.A.EHZ")
|
||||||
|
'BW.MANZ.A'
|
||||||
|
|
||||||
|
:param station_id:
|
||||||
|
:return: station id with channel removed
|
||||||
|
"""
|
||||||
|
# split at the last occuring dot and keep the left part
|
||||||
|
station_id = station_id.rpartition('.')[0]
|
||||||
|
return station_id
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ from pylot.core.util.utils import prepTimeAxis, full_range, demeanTrace, isSorte
|
|||||||
pick_linestyle_plt, pick_color_plt, \
|
pick_linestyle_plt, pick_color_plt, \
|
||||||
check4rotated, check4doubled, merge_stream, identifyPhase, \
|
check4rotated, check4doubled, merge_stream, 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, station_id_remove_channel
|
||||||
from autoPyLoT import autoPyLoT
|
from autoPyLoT import autoPyLoT
|
||||||
from pylot.core.util.thread import Thread
|
from pylot.core.util.thread import Thread
|
||||||
from pylot.core.util.dataprocessing import Metadata
|
from pylot.core.util.dataprocessing import Metadata
|
||||||
@ -3304,6 +3304,13 @@ class TuneAutopicker(QWidget):
|
|||||||
self.stationBox.activated.connect(self.fill_tabs)
|
self.stationBox.activated.connect(self.fill_tabs)
|
||||||
|
|
||||||
def catch_station_ids(self):
|
def catch_station_ids(self):
|
||||||
|
"""
|
||||||
|
Fill self.station_ids dictionary.
|
||||||
|
The dict keys are the strings of the station ids in format network.station.location, the values are lists of
|
||||||
|
filenames, which contain traces of that station.
|
||||||
|
E.g. if file A.mseed and B.mseed contain traces from station X.Y.Z, then the dict would contain
|
||||||
|
{"X.Y.Z" : ["/full/path/to/A.mseed", "/full/path/to/B.mseed"]}
|
||||||
|
"""
|
||||||
self.station_ids = {}
|
self.station_ids = {}
|
||||||
eventpath = self.get_current_event_fp()
|
eventpath = self.get_current_event_fp()
|
||||||
self.wftype = 'processed' if self.obspy_dmt else ''
|
self.wftype = 'processed' if self.obspy_dmt else ''
|
||||||
@ -3320,6 +3327,7 @@ class TuneAutopicker(QWidget):
|
|||||||
continue
|
continue
|
||||||
for trace in st:
|
for trace in st:
|
||||||
station_id = trace.get_id()
|
station_id = trace.get_id()
|
||||||
|
station_id = station_id_remove_channel(station_id)
|
||||||
if not station_id in self.station_ids:
|
if not station_id in self.station_ids:
|
||||||
self.station_ids[station_id] = []
|
self.station_ids[station_id] = []
|
||||||
self.station_ids[station_id].append(filename)
|
self.station_ids[station_id].append(filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user