Newer
Older
Wilbur, Spencer Franklin
committed
1
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import pytest
from geomagio.edge import FDSNSNCL
from geomagio.edge.FDSNSNCL import get_FDSN_channel, get_location
def test_data_type():
"""edge_test.IRISSNCL_test.test_data_type()"""
assert (
FDSNSNCL(station="ANMO", network="IU", channel="LF1", location="40").data_type
== "variation"
)
def test_element():
"""edge_test.FDSNSNCL_test.test_element()"""
assert (
FDSNSNCL(station="ANMO", network="IU", channel="LF1", location="40").element
== "V"
)
assert (
FDSNSNCL(station="ANMO", network="IU", channel="LF2", location="40").element
== "U"
)
assert (
FDSNSNCL(station="ANMO", network="IU", channel="LFZ", location="40").element
== "W"
)
with pytest.raises(ValueError) as error:
FDSNSNCL(station="ANMO", network="IU", channel="LFH", location="40").element
assert error.value == "Unsupported channel LFH"
def test_get_FDSN_channel():
"""edge_test.FDSNSNCL_test.test_get_FDSN_channel()"""
assert (
get_FDSN_channel(
element="E",
interval="second",
data_type="variation",
network="IU",
location="40",
)
== "LF1"
)
assert (
get_FDSN_channel(
element="V",
interval="second",
data_type="variation",
network="IU",
location="40",
)
== "LF1"
)
assert (
get_FDSN_channel(
element="H",
interval="second",
data_type="variation",
network="IU",
location="40",
)
== "LF2"
)
assert (
get_FDSN_channel(
element="U",
interval="second",
data_type="variation",
network="IU",
location="40",
)
== "LF2"
)
assert (
get_FDSN_channel(
element="W",
interval="second",
data_type="variation",
network="IU",
location="40",
)
== "LFZ"
)
# predefined channel
assert (
get_FDSN_channel(
element="LFZ",
interval="second",
data_type="variation",
network="IU",
location="40",
)
== "LFZ"
)
with pytest.raises(ValueError) as error:
get_FDSN_channel(
element="D",
interval="second",
data_type="variation",
network="IU",
location="40",
)
assert error.value == "Unsupported element: D"
def test_get_sncl():
"""edge_test.IRISSNCL_test.test_get_sncl()"""
assert FDSNSNCL.get_sncl(
data_type="variation",
element="H",
interval="second",
station="ANMO",
network="IU",
location="40",
) == FDSNSNCL(station="ANMO", network="IU", channel="LF2", location="40")
with pytest.raises(ValueError) as error:
FDSNSNCL.get_sncl(
data_type="adjusted",
element="H",
interval="second",
station="ANMO",
network="IU",
location="40",
)
assert error.value == "Unsupported data type: adjusted"
Wilbur, Spencer Franklin
committed
assert FDSNSNCL.get_sncl(
data_type="adjusted",
element="H",
interval="second",
Wilbur, Spencer Franklin
committed
station="ANMO",
) == FDSNSNCL(station="ANMO", network="NT", channel="LFH", location="40")
Wilbur, Spencer Franklin
committed
assert error.value == "Unsupported data type: adjusted"
Wilbur, Spencer Franklin
committed
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
def test_interval():
"""edge_test.FDSNSNCL_test.test_interval()"""
assert (
FDSNSNCL(
station="ANMO",
network="IU",
channel="LF1",
location="40",
).interval
== "second"
)
def test_parse_sncl():
"""edge_test.FDSNSNCL_test.test_parse_sncl()"""
assert FDSNSNCL(
station="ANMO", network="IU", channel="LF1", location="40"
).parse_sncl() == {
"station": "ANMO",
"network": "IU",
"data_type": "variation",
"element": "V",
"interval": "second",
}