Newer
Older
from geomagio.edge.LegacySNCL import LegacySNCL, get_channel, get_location
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def test_data_type():
"""edge_test.LegacySNCL_test.test_data_type()"""
assert (
LegacySNCL(station="BOU", channel="LFU", location="R0").data_type == "variation"
)
assert (
LegacySNCL(station="BOU", channel="LFU", location="A0").data_type == "adjusted"
)
assert (
LegacySNCL(station="BOU", channel="LFU", location="Q0").data_type
== "quasi-definitive"
)
assert (
LegacySNCL(station="BOU", channel="LFU", location="D0").data_type
== "definitive"
)
def test_element():
"""edge_test.LegacySNCL_test.test_element()"""
assert (
LegacySNCL(
station="BOU",
channel="MVD",
location="R0",
).element
== "D"
)
assert (
LegacySNCL(
station="BOU",
channel="MVU",
location="R0",
).element
== "U"
)
assert (
LegacySNCL(
station="BOU",
channel="MSF",
location="R0",
).element
== "F"
)
assert (
LegacySNCL(
station="BOU",
channel="MVH",
location="R0",
).element
== "H"
)
assert (
LegacySNCL(
station="BOU",
channel="MQE",
location="R0",
).element
== "E-E"
)
assert (
LegacySNCL(
station="BOU",
channel="MQN",
location="R0",
).element
== "E-N"
)
assert (
LegacySNCL(
station="BOU",
channel="MEH",
location="R0",
).element
== "H_Volt"
)
assert (
LegacySNCL(
station="BOU",
channel="MYH",
location="R0",
).element
== "H_Bin"
)
assert (
LegacySNCL(
station="BOU",
channel="MVH",
location="R1",
).element
== "H_Sat"
)
assert (
LegacySNCL(
station="BOU",
channel="MDT",
location="R0",
).element
== "DIST"
)
assert (
LegacySNCL(
station="BOU",
channel="MGD",
location="R0",
).element
== "DST"
)
def test_get_channel():
"""edge_test.LegacySNCL_test.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"
assert get_channel(element="SV", interval="minute", data_type="variation") == "MSV"
assert get_channel(element="UK1", interval="minute", data_type="variation") == "UK1"
assert (
get_channel(element="DIST", interval="minute", data_type="variation") == "MDT"
)
assert get_channel(element="DST", interval="minute", data_type="variation") == "MGD"
assert (
get_channel(element="UK1.R0", interval="minute", data_type="variation") == "UK1"
)
def test_get_location():
"""edge_test.LegacySNCL_test.test_get_location()"""
assert get_location(element="D", data_type="variation") == "R0"
assert get_location(element="D", data_type="adjusted") == "A0"
assert get_location(element="D", data_type="quasi-definitive") == "Q0"
assert get_location(element="D", data_type="definitive") == "D0"
assert get_location(element="D_Sat", data_type="variation") == "R1"
assert get_location(element="D_Sat", data_type="adjusted") == "A1"
assert get_location(element="D", data_type="R0") == "R0"
assert get_location(element="D", data_type="A0") == "A0"
assert get_location(element="D", data_type="Q0") == "Q0"
assert get_location(element="D", data_type="D0") == "D0"
assert get_location(element="D", data_type="R1") == "R1"
assert get_location(element="D", data_type="A1") == "A1"
def test_get_sncl():
"""edge_test.LegacySNCL_test.test_get_sncl()"""
assert LegacySNCL.get_sncl(
station="BOU", data_type="variation", interval="second", element="H"
) == LegacySNCL(station="BOU", network="NT", channel="SVH", location="R0")
assert LegacySNCL.get_sncl(
station="BOU", data_type="R0", interval="second", element="H"
) == LegacySNCL(station="BOU", network="NT", channel="SVH", location="R0")
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
def test_interval():
"""edge_test.LegacySNCL_test.test_interval()"""
assert (
LegacySNCL(
station="BOU",
channel="SVH",
location="R0",
data_format="legacy",
).interval
== "second"
)
assert (
LegacySNCL(
station="BOU",
channel="MVH",
location="R0",
data_format="legacy",
).interval
== "minute"
)
assert (
LegacySNCL(
station="BOU",
channel="HVH",
location="R0",
data_format="legacy",
).interval
== "hour"
)
assert (
LegacySNCL(
station="BOU",
channel="DVH",
location="R0",
data_format="legacy",
).interval
== "day"
)
def test_parse_sncl():
"""edge_test.LegacySNCL_test.test_parse_sncl()"""
assert LegacySNCL(station="BOU", channel="MVH", location="R0").parse_sncl() == {
"station": "BOU",
"network": "NT",
"data_type": "variation",
"element": "H",
"interval": "minute",
}