Dear Obspy users/developers,
I am a new user of Obspy, and currently using the .io.seg2. module to read a seg2 file and convert it to a mseed file.
My data have GPS time, so the resolution of the time is a microsecond level.
But, I don't know how to extract the microsecond information from a seg2 file and transfer it to the mseed file.
Is anyone can help me by letting me know how to do it?
Thanks again for this very helpful python tool,
Cheers
Joon
Example file
read_seg2.zip
My environment
Obspy version 1.0.3
Python 3.6.1 Anaconda custom 64-bit, Windows platform
Anaconda, conda 4.3.29
No idea about any potential microsecond issues during reading, but in any case you can get some underlying info on your data with:
for key in st[0].stats.seg2.keys():
print('')
print(key)
for tr in st:
print(tr.stats.seg2[key])
print('')
That tells you at least what channels the individual traces are and at what location they where recorded.. hope it helps
@megies Thanks :) Everything is clear.
Good to hear. In case your data headers' logic is always the same, you probably want to use a helper method to set trace headers appropriately after reading..
def set_headers_from_seg2(stream):
for tr in stream:
station, channel = tr.stats.seg2['RECEIVER'].split()
tr.stats.station = station
tr.stats.channel = channel
st = read('....')
set_headers_from_seg2(st)
That way you don't have problems because of all traces having same SEED ID when writing to another format.
@megies No problem for converting SEG2 to MSEED :) I really appreciate that.
Most helpful comment
Good to hear. In case your data headers' logic is always the same, you probably want to use a helper method to set trace headers appropriately after reading..
That way you don't have problems because of all traces having same SEED ID when writing to another format.