Dear all,
I have been trying to work with a GSE2.0 seismic bulletin, I was trying to obtain the information of each variable (lat, lon, depth, mag, sminor, smajor, az) from each seismic events headers.
I read the documents https://docs.obspy.org/packages/autogen/obspy.io.gse2.bulletin._read_gse2.html#obspy.io.gse2.bulletin._read_gse2.
And I try the code to save the variables on dataframes to do some statistics :
year = 2000
fields = {
'line_1': {
'Date': slice(1, 11),
'Time': slice(12, 22),
'Latitude': slice(26, 34),
'Longitude': slice(36, 44),
'Depth': slice(48, 53),
'Gap': slice(67, 70),
'Mag1': slice(75, 78),
},
'line_2': {
'rms': slice(7, 11),
'az': slice(40, 46),
'Smajor': slice(26, 34),
'Sminor': slice(35, 39),
},
'arrival': {
'Sta': slice(1, 5),
'Phase': slice(24, 28),
},
}
catalog = read_events(r'D:\Inves\Catalogs\OSC\GSE_OSC/'+year+'.txt', fields = fields)
sta = []
times = []
lats = []
lons = []
deps = []
magnitudes = []
magnitudestype = []
for event in catalog:
if len(event.origins) != 0 and len(event.magnitudes) != 0:
times.append(event.origins[0].time.datetime)
lats.append(event.origins[0].latitude)
lons.append(event.origins[0].longitude)
deps.append(event.origins[0].depth/1000)
magnitudes.append(event.magnitudes[0].mag)
magnitudestype.append(event.magnitudes[0].magnitude_type )
Smajor.append(event.origins[1].Smajor)
However I got th error if I want to obtain the values from the 2nd line header (Smajorm Sminor, rms, az):
Traceback (most recent call last):
File "C:\Users\Director\AppData\Local\Temp/ipykernel_16064/4187544156.py", line 62, in <module>
Smajor.append(event.origins[1].Smajor)
IndexError: list index out of range
Would you mid please give a hand to improve the code to save the information from Smajor, Sminor, az, gap fields from the GSE2.0 seismic bulletin.
I must say that values from the first line of the header I was able to obtain.
Stay safe and best regards,
Tonino