Newer
Older
Wilbur, Spencer Franklin
committed
DEFAULT_INTERVAL_SPECIFIC = {
"day": {
"data_interval_type": "1-day (00:00-23:59)",
"filter_comments": [
"Scalar and Vector 1-day values are computed from average of 1-minute values in the day (00:00-23:59)",
],
},
"hour": {
"data_interval_type": "1-hour (00-59)",
"filter_comments": [
"Scalar and Vector 1-hour values are computed from average of 1-minute values in the hour (00-59)",
],
},
"minute": {
"data_interval_type": "1-minute",
"filter_comments": [
Wilbur, Spencer Franklin
committed
"Scalar and Vector 1-minute values are computed from 1 Hz values using an INTERMAGNET gaussian filter centered on the start of the minute (00:15-01:45))."
Wilbur, Spencer Franklin
committed
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
128
129
],
},
"second": {
"data_interval_type": "1-second",
"filter_comments": [
"Vector 1-second values are computed from 10 Hz values using a Blackman filter (123 taps, cutoff 0.25Hz) centered on the start of the second."
],
},
}
DEFAULT_ASL_METADATA = {
"ANMO": {
"metadata": {
"elevation": 1820,
"geodetic_latitude": 34.946,
"geodetic_longitude": -106.457,
"station_name": "Albuquerque",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"CASY": {
"metadata": {
"elevation": 10,
"geodetic_latitude": -66.279,
"geodetic_longitude": 110.535,
"station_name": "Casey",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"COLA": {
"metadata": {
"elevation": 200,
"geodetic_latitude": 64.874,
"geodetic_longitude": -147.862,
"station_name": "College Outpost",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"COR": {
"metadata": {
"elevation": 110,
"geodetic_latitude": 44.586,
"geodetic_longitude": -123.305,
"station_name": "Corvallis",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"QSPA": {
"metadata": {
"elevation": 2850,
"geodetic_latitude": -89.929,
"geodetic_longitude": 144.438,
"station_name": "South Pole Remote Earth Science Observatory",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"RSSD": {
"metadata": {
"elevation": 2090,
"geodetic_latitude": 44.121,
"geodetic_longitude": -104.036,
"station_name": "Black Hills",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"SBA": {
"metadata": {
"elevation": 50,
"geodetic_latitude": -77.849,
"geodetic_longitude": 166.757,
"station_name": "Scott Base",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"SFJD": {
"metadata": {
"elevation": 330,
"geodetic_latitude": 66.996,
"geodetic_longitude": -50.621,
"station_name": "Sondre Stromfjord",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"SPA": {
"metadata": {
"elevation": 2927,
"geodetic_latitude": -90.0,
"geodetic_longitude": 0.0,
"station_name": "South Pole",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
}
Wilbur, Spencer Franklin
committed
130
131
132
133
134
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
161
162
163
164
165
166
167
168
169
170
class VariometerMetadata(object):
"""Helper class for providing all the metadata needed for a geomag
timeseries.
Notes
-----
Currently the only method is set_metadata. Eventually this will probably
pull from a database, or maybe a config file.
"""
def __init__(self, metadata=None, interval_specific=None):
self.metadata = metadata or DEFAULT_ASL_METADATA
self.interval_specific = interval_specific or DEFAULT_INTERVAL_SPECIFIC
def set_metadata(self, stats, observatory, channel, type, interval):
"""Set timeseries metadata (aka a traces stats)
Parameters
----------
stats : obspy.core.trace.stats
the class associated with a given obspy trace, which contains
it's metadata
observatory : string
the observatory code to look up.
channel : str
single character channel {H, E, D, Z, F}
type : {'variation', 'quasi-definitive'}
data type.
interval : {'minute', 'second'}
data interval.
Returns
-------
obspy.core.trace.stats
the combined stats and the default metadata.
"""
stats["channel"] = channel
stats["data_interval"] = interval
stats["data_type"] = type
if observatory not in self.metadata:
Wilbur, Spencer Franklin
committed
print(f"Observatory '{observatory}' not found in metadata.")
print("Available Observatories:", self.metadata.keys())
Wilbur, Spencer Franklin
committed
return
# copy in standard metadata
metadata = self.metadata[observatory]["metadata"]
for key in metadata:
stats[key] = metadata[key]
# copy in interval specific metadata
interval_specific = self.interval_specific
if "interval_specific" in self.metadata[observatory]:
interval_specific = self.metadata[observatory]["interval_specific"]
# stats['data_interval_type'] = data_interval_type[interval]
if interval in interval_specific:
for key in interval_specific[interval]:
stats[key] = interval_specific[interval][key]