-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwrite_multiple_trace.py
More file actions
32 lines (25 loc) · 917 Bytes
/
write_multiple_trace.py
File metadata and controls
32 lines (25 loc) · 917 Bytes
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
# This program writes multiple stream data into one mseed file
#=============================================================
# Imports
import glob
from obspy.core import read
from obspy.core.stream import Stream
from obspy.core.trace import Trace
# Read multiple mSEED files
# st = read("/Users/Proxima/Documents/classes/Fall2015/hacking-measurement/save-seistool/examples/CHILE_M8.3/BDM.BK.LHN.00.D.2015.259.225431.gz")
st = Stream()
i = 0
# glob.glob returns a list of files in the directory
for file in glob.glob("../examples/CHILE_M8.3/*.gz"):
i += 1
if (i>5):
break
else:
st += read(file)
st.write("5_trace.mseed",format="mSEED")
# for stream in st:
# # stream.write("5_trace.mseed",format="mSEED")
# multiplestream += stream
# multiplestream = Stream(traces=[Trace(s) for s in st])
# multiplestream.write("5_trace_test.mseed",format="MSEED")
print("5 streams written into file 5_trace.mseed")