-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #445 from PrincetonUniversity/issue-411
Issue 411 -- Follow-up example/cookbook fixes
- Loading branch information
Showing
41 changed files
with
11,900 additions
and
65 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import glob | ||
import os | ||
import numpy as np | ||
import obspy | ||
|
||
|
||
def get_traces(directory): | ||
traces = [] | ||
|
||
files = glob.glob(directory + "/AA.S00??.S2.BX?.semd") | ||
files.sort() | ||
|
||
## iterate over all seismograms | ||
for filename in files: | ||
station_id = os.path.splitext(filename)[0] | ||
station_id = station_id.split("/")[-1] | ||
network, station, location, channel = station_id.split(".")[:4] | ||
trace = np.loadtxt(filename, delimiter=" ") | ||
starttime = trace[0, 0] | ||
dt = trace[1, 0] - trace[0, 0] | ||
traces.append( | ||
obspy.Trace( | ||
trace[:, 1], | ||
{ | ||
"network": network, | ||
"station": station, | ||
"location": location, | ||
"channel": channel, | ||
"starttime": starttime, | ||
"delta": dt, | ||
}, | ||
) | ||
) | ||
|
||
stream = obspy.Stream(traces) | ||
|
||
return stream | ||
|
||
|
||
stream = get_traces("OUTPUT_FILES/seismograms") | ||
stream.select(component="X").plot(size=(1000, 750)) | ||
stream.select(component="Z").plot(size=(1000, 750)) |
Oops, something went wrong.