Skip to content
Snippets Groups Projects
Commit df04f9c9 authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler
Browse files

Merge branch 'fix_sncl-Mar2025' into 'master'

Fix *SNCL.py for variation HEZ data

See merge request !406
parents 294b0420 48c46508
No related branches found
No related tags found
1 merge request!406Fix *SNCL.py for variation HEZ data
Pipeline #584211 passed
......@@ -146,17 +146,17 @@ def _get_channel_end(element: str, data_type: str) -> str:
channel_middle = "K"
elif element in ["F", "G"]:
channel_middle = "S"
channel_end = element.split("_")[0]
channel_end = element.split("_")
if data_type == "variation" or data_type[0] == "R":
# this may not actually be necessary since UVW were
# never used as legacy channels; it is included here
# solely for consistency with SNCL.py, but should be safe
if channel_end == "U":
channel_end = "H"
elif channel_end == "V":
channel_end = "Y"
elif channel_end == "W":
channel_end = "Z"
if len(channel_end) == 1:
channel_end = channel_end[0]
if channel_end == "U":
channel_end = "H"
elif channel_end == "V":
channel_end = "E"
elif channel_end == "W":
channel_end = "Z"
channel_end = channel_end[0][0] # 2nd [0] ensures a single character
return channel_middle + channel_end
......
......@@ -177,14 +177,17 @@ def _get_channel_end(element: str, data_type: str) -> str:
channel_middle = "Y"
elif "_Temp" in element:
channel_middle = "K"
channel_end = element.split("_")[0]
channel_end = element.split("_")
if data_type == "variation" or data_type[0] == "R":
if channel_end == "H":
channel_end = "U"
elif channel_end == "E":
channel_end = "V"
elif channel_end == "Z":
channel_end = "W"
if len(channel_end) == 1:
channel_end = channel_end[0]
if channel_end == "H":
channel_end = "U"
elif channel_end == "E":
channel_end = "V"
elif channel_end == "Z":
channel_end = "W"
channel_end = channel_end[0][0] # 2nd [0] ensures a single character
return channel_middle + channel_end
......
......@@ -116,6 +116,7 @@ def test_get_channel():
assert get_channel(element="D", interval="second", data_type="variation") == "SVD"
assert get_channel(element="F", interval="minute", data_type="variation") == "MSF"
assert get_channel(element="H", interval="hour", data_type="variation") == "HVH"
assert get_channel(element="U", interval="hour", data_type="variation") == "HVH"
assert get_channel(element="E-E", interval="day", data_type="variation") == "DQE"
assert get_channel(element="E-N", interval="minute", data_type="variation") == "MQN"
assert get_channel(element="SQ", interval="minute", data_type="variation") == "MSQ"
......
......@@ -173,6 +173,9 @@ def test_get_channel():
assert (
get_channel(element="U_Dist", interval="minute", data_type="variation") == "UFU"
)
assert (
get_channel(element="H_Dist", interval="minute", data_type="variation") == "UFH"
)
assert get_channel(element="U", interval="minute", data_type="RD") == "UFU"
assert (
get_channel(element="U_SQ", interval="minute", data_type="variation") == "UFU"
......
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