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
],
},
"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,
Wilbur, Spencer Franklin
committed
"geodetic_latitude": 34.94591,
"geodetic_longitude": -106.4572,
Wilbur, Spencer Franklin
committed
"station_name": "Albuquerque",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"CASY": {
"metadata": {
"elevation": 10,
Wilbur, Spencer Franklin
committed
"geodetic_latitude": -66.2792,
"geodetic_longitude": 110.5354,
Wilbur, Spencer Franklin
committed
"station_name": "Casey",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"COLA": {
"metadata": {
"elevation": 200,
Wilbur, Spencer Franklin
committed
"geodetic_latitude": 64.8736,
"geodetic_longitude": -147.8616,
Wilbur, Spencer Franklin
committed
"station_name": "College Outpost",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"COR": {
"metadata": {
"elevation": 110,
Wilbur, Spencer Franklin
committed
"geodetic_latitude": 44.5855,
"geodetic_longitude": -123.3046,
Wilbur, Spencer Franklin
committed
"station_name": "Corvallis",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
Wilbur, Spencer Franklin
committed
"KBS": {
Wilbur, Spencer Franklin
committed
"metadata": {
Wilbur, Spencer Franklin
committed
"elevation": 90,
"geodetic_latitude": 78.9154,
"geodetic_longitude": 11.9385,
"station_name": "Ny-Alesund",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"KONO": {
"metadata": {
"elevation": 558,
"geodetic_latitude": 59.6521,
"geodetic_longitude": 9.5946,
"station_name": "Kongsberg",
Wilbur, Spencer Franklin
committed
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"RSSD": {
"metadata": {
"elevation": 2090,
Wilbur, Spencer Franklin
committed
"geodetic_latitude": 44.1212,
"geodetic_longitude": -104.0359,
Wilbur, Spencer Franklin
committed
"station_name": "Black Hills",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"SBA": {
"metadata": {
"elevation": 50,
Wilbur, Spencer Franklin
committed
"geodetic_latitude": -77.8492,
"geodetic_longitude": 166.7572,
Wilbur, Spencer Franklin
committed
"station_name": "Scott Base",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"SFJD": {
"metadata": {
"elevation": 330,
Wilbur, Spencer Franklin
committed
"geodetic_latitude": 66.9961,
"geodetic_longitude": -50.6207,
Wilbur, Spencer Franklin
committed
"station_name": "Sondre Stromfjord",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
Wilbur, Spencer Franklin
committed
129
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
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
"SSPA": {
"metadata": {
"elevation": 270,
"geodetic_latitude": 40.6358,
"geodetic_longitude": -77.8876,
"station_name": "Standing Stone, Pennsylvania",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"QSPA": {
"metadata": {
"elevation": 2850,
"geodetic_latitude": -89.9289,
"geodetic_longitude": 144.4382,
"station_name": "South Pole Remote Earth Science Observatory",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"E62A": {
"metadata": {
"elevation": 365,
"geodetic_latitude": 46.6201,
"geodetic_longitude": -69.5227,
"station_name": "Eastport",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"E46A": {
"metadata": {
"elevation": 269,
"geodetic_latitude": 46.3665,
"geodetic_longitude": -84.3062,
"station_name": "Lake Superior",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"PAB": {
"metadata": {
"elevation": 950,
"geodetic_latitude": 39.5446,
"geodetic_longitude": -4.3499,
"station_name": "San Pablo, Spain",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"WCI": {
"metadata": {
"elevation": 210,
"geodetic_latitude": 38.2289,
"geodetic_longitude": -86.2939,
"station_name": "Wyandotte Cave, Indiana, USA",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"KSU1": {
"metadata": {
"elevation": 317,
"geodetic_latitude": 39.1009,
"geodetic_longitude": -96.6094,
"station_name": "Kansas State University",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"EYMN": {
"metadata": {
"elevation": 475,
"geodetic_latitude": 47.9462,
"geodetic_longitude": -91.4953,
"station_name": "Ely, Minnesota, USA",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"GOGA": {
"metadata": {
"elevation": 150,
"geodetic_latitude": 33.41476,
"geodetic_longitude": -83.47327,
"station_name": "Godfrey, GA, USA",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"DGMT": {
"metadata": {
"elevation": 646,
"geodetic_latitude": 48.4702,
"geodetic_longitude": -104.1959,
"station_name": "Dagmar Montana, USA",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"DWPF": {
"metadata": {
"elevation": 30,
"geodetic_latitude": 28.1103,
"geodetic_longitude": -81.4327,
"station_name": "Disney Wilderness Preserve, Florida, USA",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"ECSD": {
"metadata": {
"elevation": 478,
"geodetic_latitude": 43.7337,
"geodetic_longitude": -96.6141,
"station_name": "EROS Data Center, Sioux Falls, South Dakota, USA",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"HRV": {
"metadata": {
"elevation": 200,
"geodetic_latitude": 42.5064,
"geodetic_longitude": -71.5583,
"station_name": "Adam Dziewonski Observatory (Oak Ridge), Massachusetts, USA",
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
"O20A": {
Wilbur, Spencer Franklin
committed
"metadata": {
Wilbur, Spencer Franklin
committed
"elevation": 1915,
"geodetic_latitude": 40.1348,
"geodetic_longitude": -108.2416,
"station_name": "White River City, CO, USA",
Wilbur, Spencer Franklin
committed
"agency_name": "United States Geological Survey (USGS)",
"declination_base": None,
},
"interval_specific": DEFAULT_INTERVAL_SPECIFIC,
},
}
Wilbur, Spencer Franklin
committed
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
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]