Skip to content

Instantly share code, notes, and snippets.

@ThomasLecocq
Created January 16, 2014 15:45
Show Gist options
  • Save ThomasLecocq/8457113 to your computer and use it in GitHub Desktop.
Save ThomasLecocq/8457113 to your computer and use it in GitHub Desktop.
Obspy Merge
Display the source blob
Display the rendered blob
Raw
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from obspy.core import Stream, Trace, read, UTCDateTime
import numpy as np
# <codecell>
trace1 = Trace(data=np.random.random(1000))
trace1.stats.network = "BE"
trace1.stats.station = "TST"
trace1.stats.starttime = UTCDateTime(2014,1,1)
trace1.stats.sampling_rate=100
print trace1
# <codecell>
trace2 = Trace(data=np.random.random(1000))
trace2.stats.network = "BE"
trace2.stats.station = "TST"
trace2.stats.starttime = UTCDateTime(2014,1,1,0,0,10,4000)
trace2.stats.sampling_rate=100
print trace2
# <codecell>
trace3 = Trace(data=np.random.random(1000))
trace3.stats.network = "BE"
trace3.stats.station = "TST"
trace3.stats.starttime = UTCDateTime(2014,1,1,0,0,20,8000)
trace3.stats.sampling_rate=100
print trace3
# <codecell>
st = Stream(traces=[trace1,trace2,trace3])
# <codecell>
print st
# <codecell>
st.merge()
st = st.split()
# <codecell>
print st
# <codecell>
# <codecell>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment