Skip to content
Snippets Groups Projects
Commit 7b9ce802 authored by Kien Le's avatar Kien Le
Browse files

Fix RT130 waveform channels not being recognized

parent bbbf444d
No related branches found
No related tags found
1 merge request!341Fix RT130 waveform channels not being recognized
import re
from typing import Dict, List
from sohstationviewer.conf.constants import ColorMode
......@@ -26,7 +27,15 @@ def get_chan_plot_info(org_chan_id: str, data_type: str,
chan = convert_actual_channel_to_db_channel_w_question_mark(chan,
data_type)
if len(org_chan_id) == 3 and org_chan_id.startswith('DS'):
# RT130 waveform channels is formed by the string DS followed by the data
# stream number, a dash character, and the channel number.
# Doing incomplete checks for RT130 waveform channels have caused a bunch
# of problems before (see https://git.passcal.nmt.edu/software_public/passoft/sohstationviewer/-/merge_requests/240?diff_id=5092&start_sha=55ac101ffac8860ba66ac5e7b694e70ee397919c # noqa
# and https://git.passcal.nmt.edu/software_public/passoft/sohstationviewer/-/issues/287). # noqa
# So, we match RT130 waveform channels exactly with a regex to avoid these
# problems.
rt130_waveform_regex = re.compile(r'DS\d-\d')
if rt130_waveform_regex.match(org_chan_id):
chan = 'SEISMIC'
if dbConf['seisRE'].match(chan):
chan = 'SEISMIC'
......
......@@ -65,7 +65,7 @@ class TestGetChanPlotInfo(BaseTestCase):
with self.subTest("RT130 Seismic"):
expected_result = {'param': 'Seismic data',
'dbChannel': 'SEISMIC',
'channel': 'DS2',
'channel': 'DS2-1',
'plotType': 'linesSRate',
'height': 8,
'unit': '',
......@@ -73,8 +73,8 @@ class TestGetChanPlotInfo(BaseTestCase):
'dbLabel': None,
'fixPoint': 0,
'valueColors': '',
'label': 'DS2'}
self.assertDictEqual(get_chan_plot_info('DS2', 'RT130'),
'label': 'DS2-1'}
self.assertDictEqual(get_chan_plot_info('DS2-1', 'RT130'),
expected_result)
with self.subTest("MSeed Seismic"):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment