forked from adjtomo/pysep
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent_input.py
More file actions
351 lines (324 loc) · 13 KB
/
event_input.py
File metadata and controls
351 lines (324 loc) · 13 KB
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
128
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
273
274
275
276
277
278
279
280
281
282
283
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
import obspy
import read_event_obspy_file as reof
from getwaveform import *
def get_ev_info(ev_info,iex):
# ===============================================================
# SilwalTape2016 example event (Anchorage) -- python run_getwaveform.py event_input 0
if iex == 0:
ev_info.use_catalog = 0 # do not use event catalog for source parameters
ev_info.otime = obspy.UTCDateTime("2009-04-07T20:12:55.351")
ev_info.min_dist = 0
ev_info.max_dist = 300
ev_info.tbefore_sec = 100
ev_info.tafter_sec = 300
# keep stations with missing components and fill the missing component with a null trace (MPEN)
#ev_info.icreateNull = 1
# RAW and ENZ files can be used when checking if you are receiving all possible data (example station: SOLD)
ev_info.isave_raw = False
ev_info.isave_raw_processed = False
ev_info.isave_ENZ = False
#ev_info.min_lat = 59
#ev_info.max_lat = 62
#ev_info.min_lon = -152
#ev_info.max_lon = -147
# default list of Alaska networks
# note 1: cannot use '*' because of IM
# note 2: may want to exclude the mid-band AV network
# note 3: these are temporary:
# XE BEAAR 1999
# XR ARCTIC 2004
# XZ STEEP 2005
# YV MOOS 2006
# XV FLATS 2014
# ZE SALMON 2015
# XG WVF 2016
# [7C MMEP 2015]
# TA
#ev_info.network = 'AK,AT,AV,CN,II,IU,US,XM,XV,XZ,YV'
#ev_info.network = 'AK' # for testing
ev_info.network = 'AK,AT,AV,CN,II,IU,US,XM,TA,XE,XR,XZ,YV,XV,ZE,XG'
ev_info.channel = 'BH?'
ev_info.use_catalog = 0
ev_info.elat = 61.45420
ev_info.elon = -149.7428
ev_info.edep = 33033.60
# ev_info.rlat = 61.45420
# ev_info.rlon = -149.7428
# ev_info.rtime = obspy.UTCDateTime("2009-04-07T20:12:55.351")
ev_info.emag = 4.6
# scaling and resampling needed for CAP
ev_info.resample_TF = True
ev_info.resample_freq = 50
ev_info.scale_factor = 100
#ev_info.phase_window = False
#-------for specfem------------
#ev_info.tbefore_sec = 0
#ev_info.resample_TF = False
#ev_info.scale_factor = 1
#ev_info.outformat = 'DISP'
#------------------------------
# Iniskin earthquake
if iex == 1:
ev_info.use_catalog = 0 # do not use event catalog for source parameters
# GCMT source parameters
# the otime is the centroid time and accounts for tshift
ev_info.otime = obspy.UTCDateTime("2016-01-24T10:30:37.400")
ev_info.elat = 59.75
ev_info.elon = -153.27
ev_info.edep = 110700
ev_info.emag = 7.1
# subset of stations
ev_info.min_dist = 0
ev_info.max_dist = 800
ev_info.tbefore_sec = 100
ev_info.tafter_sec = 600
ev_info.network = 'AV,CN,ZE,AT,TA,AK,XV,II,IU,US' # IM will probably crash it
ev_info.channel = 'BH?,HH?'
#ev_info.resample_freq = 0 # no resampling
#ev_info.resample_TF = False
#ev_info.scale_factor = 1 # no scale factor
# parameters for examining step response (causal low-pass filter on raw waveforms)
# delete AUQ, SPCP, SPBG
ev_info.rotateRTZ = False
ev_info.ifFilter = True
ev_info.filter_type = 'lowpass'
ev_info.f1 = 1/4
ev_info.zerophase = False
ev_info.remove_response = False
ev_info.ipre_filt = 0
ev_info.demean = False
ev_info.detrend = False
# For SALMON data
#ev_info.user = None
#ev_info.password = None
# MFFZ earthquakes for investigating the step response
# copied from event_input_flats
if iex == 2:
ev_info.use_catalog = 0
# -------------------------------------------------
ev_info.otime = obspy.UTCDateTime("2014-08-31T03:06:57.111")
ev_info.elat = 65.1526
ev_info.elon = -149.0398
ev_info.edep = 16614.7
ev_info.emag = 5.20
# -------------------------------------------------
ev_info.min_dist = 0
ev_info.max_dist = 300
ev_info.tbefore_sec = 200
ev_info.tafter_sec = 600
ev_info.network = 'AV,CN,AT,TA,AK,XV,II,IU,US'
# ev_info.network = 'XV,AK'
ev_info.channel = 'BH?,HH?'
#ev_info.scale_factor = 1
#ev_info.resample_freq = 0
#ev_info.resample_TF = False
# for CAP
# ev_info.resample_TF = True
# ev_info.scale_factor = 100
# ev_info.resample_freq = 50
# to investigate step response
ev_info.rotateRTZ = True
ev_info.rotateUVW = True
ev_info.ifFilter = True
ev_info.zerophase = False # causal
# filter_type = 'lowpass'
ev_info.filter_type = 'bandpass'
ev_info.f1 = 1/100 # fmin
ev_info.f2 = 1/10 # fmax
ev_info.corners = 4
# ev_info.remove_response = False
ev_info.remove_response = True
ev_info.ipre_filt = 1
ev_info.demean = True
ev_info.detrend = True
ev_info.output_cap_weight_file = False
# ev_info.outformat = 'DISP'
ev_info.ifsave_sacpaz = True
ev_info.taper = 0.2
# Loop over multiple event
if iex == 3:
ev_info.use_catalog = 0
# text file of source parameters
ievent = 1
events_file = "/home/ksmith/REPOSITORIES/manuscripts/kyle/papers/nenanabasin/data/nenanabasin_obspy.txt"
eids,otimes,elons,elats,edeps,emags = reof.read_events_obspy_file(events_file)
ev_info_list = []
#for xx in range(len(eids)):
#for xx in range(1,3):
for xx in range(ievent-1,ievent):
ev_info_temp = ev_info.copy()
ev_info_temp.otime = obspy.UTCDateTime(otimes[xx])
ev_info_temp.elat = elats[xx]
ev_info_temp.elon = elons[xx]
ev_info_temp.edep = edeps[xx]
ev_info_temp.emag = emags[xx]
ev_info_temp.eid = eids[xx]
# subset of stations
ev_info_temp.min_dist = 0
ev_info_temp.max_dist = 200
ev_info_temp.tbefore_sec = 100
ev_info_temp.tafter_sec = 500
ev_info_temp.network = 'AV,CN,ZE,AT,TA,AK,XV,II,IU,US'
#ev_info_temp.network = 'AK,AT,AV,CN,II,IU,US,XM,TA,XE,XR,XZ,YV,XV,ZE,XG'
ev_info_temp.channel = 'BH?,HH?'
#ev_info_temp.resample_freq = 40
#ev_info_temp.scale_factor = 100
#ev_info_temp.resample_TF = False
# append getwaveform objects
ev_info_list.append(ev_info_temp)
# always return ev_info
ev_info = ev_info_list
# Alaska data from far away event
if iex == 4:
ev_info.use_catalog = 0
# Mariana Event observed by FLATS
ev_info.otime = obspy.UTCDateTime("2016-07-29T21:18:26.000")
ev_info.elat = 18.5439
ev_info.elon = 145.541
ev_info.edep = 207620.0
ev_info.emag = 7.7
ev_info.rtime = obspy.UTCDateTime("2016-07-29T21:28:19.000")
# center at F3TN
ev_info.rlat = 64.7716
ev_info.rlon = -149.1465
ev_info.min_dist = 0
ev_info.max_dist = 150
ev_info.tbefore_sec = 100
ev_info.tafter_sec = 400
ev_info.network = 'AK,AT,II,IU,US,XM,XV,XZ,TA' # no CN,AV,YV,ZE
ev_info.channel = 'BH?,HH?'
# doublet event near Manley
if iex == 5:
ev_info.rlat = 64.7716
ev_info.rlon = -149.1465
ev_info.scale_factor = 1
ev_info.min_dist = 0
ev_info.max_dist = 150
ev_info.tbefore_sec = 100
ev_info.tafter_sec = 200
ev_info.network = 'XV,TA'
ev_info.channel = 'BH?,HH?'
ev_info.use_catalog = 0
ev_info.station = 'I23K,F3TN'
# AEC source parameters
ev_info.otime = obspy.UTCDateTime("2015-11-06T01:20:12.712")
ev_info.elat = 64.7552
ev_info.elon = -151.3103
ev_info.edep = 1502.1
ev_info.emag = 3.35
ev_info.rtime = ev_info.otime
# Illinois main event
if iex == 6:
ev_info.use_catalog=0
ev_info.otime = obspy.UTCDateTime("2008-04-18T09:36:59.110")
ev_info.elon = -87.886
ev_info.elat = 38.452
ev_info.edep = 14.3
ev_info.emag = 5.2
ev_info.min_dist = 0
ev_info.max_dist = 500
ev_info.tbefore_sec = 100
ev_info.tafter_sec = 300
ev_info.network = 'IU,NM'
ev_info.station = '*'
ev_info.channel = 'LH?,BH?'
# Uturuncu main event, AlvizuriTape2016
if iex == 7:
ev_info.use_catalog=0
ev_info.otime = obspy.UTCDateTime("2010-05-16T06:34:54.464")
ev_info.elon = -67.1856
ev_info.elat = -22.2600
ev_info.edep = -0.6
ev_info.emag = 2.8
ev_info.min_dist = 0
ev_info.max_dist = 500
ev_info.tbefore_sec = 100
ev_info.tafter_sec = 300
ev_info.network = 'XP'
ev_info.station = '*'
ev_info.channel = 'HH?'
# Manley earthquake (Kyle)
if iex == 8:
ev_info.use_catalog=0
ev_info.otime = obspy.UTCDateTime("2016-05-18T03:25:48.320")
ev_info.elat = 65.2466
ev_info.elon = -151.0651
ev_info.edep = 15156.2
ev_info.emag = 4.2
ev_info.rtime = ev_info.otime
ev_info.max_dist = 400
ev_info.tbefore_sec = 50
ev_info.tafter_sec = 600
ev_info.network = 'AK,AT,AV,CN,II,IU,US,XM,TA,XE,XR,XZ,YV,XV,ZE,XG'
ev_info.channel = 'BH?,HH?'
# for CAP
ev_info.resample_TF = True
ev_info.resample_freq = 50
ev_info.scale_factor = 100
# same as iex=11 but for the IRIS database
# GOAL: For LLNL events, we do NOT want to use the IRIS source parameters:
# origin time, hypocenter, magnitude.
# --> THIS EXAMPLE IS NOT CURRENTLY WORKING WITH sln01
# ERROR: FileNotFoundError: [Errno 2] No such file or directory: '19910914190000000/19910914190000000_ev_info.obj'
if iex == 9:
ev_info.overwrite_ddir = 0 # do NOT overwrite the existing directory
ev_info.client_name = 'IRIS'
#ev_info.client_name = 'NCEDC'
ev_info.use_catalog = 1
#ev_info.idb = 1 # IRIS database
# ev_info.resample_freq = 0 # no resampling
# ev_info.otime = obspy.UTCDateTime("1991-09-14T19:00:00.000Z") # Hoya actual
ev_info.otime = obspy.UTCDateTime("1991-09-14T19:00:08.031Z") # Hoya target
ev_info.min_dist = 0
ev_info.max_dist = 1200
ev_info.tbefore_sec = 100
ev_info.tafter_sec = 600
# needs to be run TWICE to get BK stations and IRIS stations
#ev_info.network = 'BK' # BK will go to NCEDC
ev_info.network = '*' # * will get all at IRIS DMC
ev_info.channel = 'BH?,LH?'
ev_info.overwrite_ddir = 0
ev_info.ifsave_stationxml = False
if iex == 10:
ev_info.idb = 1
ev_info.overwrite_ddir = 1 # delete data dir if it exists
ev_info.use_catalog = 0 # do not use event catalog for source parameters
sec_tol = 180
events_file = "/home/ksmith/REPOSITORIES/manuscripts/kyle/papers/nenanabasin/data/nenanabasin_obspy.txt"
eids,otimes,elons,elats,edeps,emags = reof.read_events_obspy_file(events_file)
ev_info_list = []
for xx in range(0,1):
ev_info_temp = ev_info.copy()
ev_info_temp.otime = obspy.UTCDateTime(otimes[xx])
ev_info_temp.elat = elats[xx]
ev_info_temp.elon = elons[xx]
ev_info_temp.edep = edeps[xx]
ev_info_temp.emag = emags[xx]
ev_info_temp.eid = eids[xx]
# subset of stations
ev_info_temp.min_dist = 0
#ev_info_temp.max_dist = 50
ev_info_temp.max_dist = 150
ev_info_temp.rlat = 64.7716
ev_info_temp.rlon = -149.1465
ev_info_temp.rtime = ev_info_temp.otime
saftcase = False
ev_info_temp.phases = ["P","S"]
ev_info_temp.write_sac_phase = True # put phase information in sac files
ev_info_temp.network = 'AV,CN,ZE,AT,TA,AK,XV,II,IU,US'
ev_info_temp.channel = 'BH?,HH?'
ev_info_temp.resample_TF = True # to be consistent with past past waveforms
ev_info_temp.resample_freq = 50
ev_info_temp.scale_factor = 1
ev_info_temp.tbefore_sec = 150
ev_info_temp.tafter_sec = 1000
print("before sec = ", ev_info_temp.tbefore_sec)
print("after sec = ", ev_info_temp.tafter_sec)
# append getwaveform objects
ev_info_list.append(ev_info_temp)
# always return ev_info
ev_info = ev_info_list
return(ev_info)
#=================================================================================
# END EXAMPLES
#=================================================================================