Changes for page FDSN Guide

Last modified by robert on 2025/03/24 12:02

From version 1.5
edited by robert
on 2025/03/24 10:08
Change comment: There is no comment for this version
To version 2.3
edited by robert
on 2025/03/24 10:21
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -27,7 +27,7 @@
27 27  
28 28  = Station Metadata =
29 29  
30 -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
30 +Information such as site locations, sensor and data logger types, response information, etc are in the station metadata. This can be accessed directly(link) or via the obspy get_stations (link) tool.
31 31  
32 32  
33 33  == Sub-paragraph ==
... ... @@ -41,11 +41,126 @@
41 41  
42 42  = Waveform Data =
43 43  
44 -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
44 +Waveform data (e.g. the actual seismic data) can be accessed directly (link) or via obspy's get_waveforms (link) tool. It can also be accessed via various tools such as seed-vault, pyweed, etc (add links).
45 45  
46 +== How to download waveform data ==
46 46  
48 +{{code language="python"}}
49 +from obspy import UTCDateTime
50 +from obspy.clients.fdsn import Client
51 +
52 +# Initialize the FDSN client (you can also specify other data centers)
53 +client = Client("AUSPASS")
54 +
55 +# Event information
56 +network = "S1"
57 +station = "AUGRF"
58 +starttime = UTCDateTime("2021-09-21T23:15:53") # The time of the earthquake
59 +endtime = starttime + 360 # One hour of data after the earthquake
60 +
61 +# Download the MiniSEED data
62 +st = client.get_waveforms(network=network, station=station, location="*", channel="BHZ",
63 + starttime=starttime, endtime=endtime)
64 +# Save the stream to a MiniSEED file
65 +st.write("Woodspoint_2021.mseed", format="MSEED")
66 +print("Downloaded and saved the MiniSEED file.")
67 +{{/code}}
68 +
69 +== How to remove instrument response ==
70 +
71 +{{code language="python"}}
72 +from obspy import read
73 +from obspy.core.util import AttribDict
74 +
75 +# Load the MiniSEED file
76 +st = read("Woodspoint_2021.mseed")
77 +
78 +# Download the instrument response
79 +inv = client.get_stations(network=network, station=station, location="*",
80 + channel="*", starttime=starttime, endtime=endtime,
81 + level="response")
82 +
83 +# Remove the instrument response
84 +output = 'VEL' # Output unit ('VEL' = velocity (default), 'DISP' = displacement, 'ACC' = acceleration)
85 +
86 +for tr in st:
87 + tr.remove_response(inventory=inv, output=output, plot=True)
88 +
89 +# Save the corrected MiniSEED file
90 +st.write("Woodspoint_2021_corrected.mseed", format="MSEED")
91 +{{/code}}
92 +
93 +== How to apply a bandpass filter ==
94 +
95 +{{code language="python"}}
96 +from obspy import read
97 +
98 +# Load the MiniSEED file
99 +st = read("Woodspoint_2021.mseed")
100 +
101 +# Define the frequency band
102 +freq_min = 0.1 # Minimum frequency in Hz
103 +freq_max = 1.0 # Maximum frequency in Hz
104 +
105 +# Apply the bandpass filter
106 +for tr in st:
107 + tr.filter(type='bandpass', freqmin=freq_min, freqmax=freq_max)
108 +
109 +# Save the filtered MiniSEED file
110 +st.write("Woodspoint_2021_filtered.mseed", format="MSEED")
111 +{{/code}}
112 +
113 +== How to slice a waveform ==
114 +
115 +{{code language="python"}}
116 +from obspy import read, UTCDateTime, Stream # Importing Stream here
117 +
118 +# Load the filtered MiniSEED file
119 +st = read("Woodspoint_2021_filtered.mseed")
120 +
121 +# Define the time window for slicing
122 +slice_start = UTCDateTime("2021-09-21T23:20:00")
123 +slice_end = slice_start +10
124 +
125 +# Slice the waveform for each Trace in the Stream
126 +sliced_st = Stream() # Now Stream is defined
127 +for tr in st:
128 + sliced_tr = tr.slice(starttime=slice_start, endtime=slice_end)
129 + sliced_st.append(sliced_tr)
130 +
131 +# Save the sliced MiniSEED file
132 +sliced_st.write("Woodspoint_2021_filtered_sliced.mseed", format="MSEED")
133 +{{/code}}
134 +
135 +== How to save a waveform ==
136 +
137 +{{code language="python"}}
138 +# Save the sliced file as MiniSEED
139 +sliced_st.write("Woodspoint_2021_filtered_sliced.mseed", format="MSEED")
140 +
141 +# Or, save the sliced SAC file
142 +sliced_st.write("Woodspoint_2021_filtered_sliced.sac", format="SAC")
143 +{{/code}}
144 +
145 +== How to convert miniseed to sac ==
146 +
147 +{{code language="python"}}
148 +from obspy import read
149 +
150 +# Read the MiniSEED file
151 +st = read("Woodspoint_2021.mseed")
152 +
153 +# Take the first Trace from the Stream
154 +tr = st[0]
155 +
156 +# Save that Trace as a SAC file
157 +tr.write("Woodspoint_2021.sac", format="SAC")
158 +{{/code}}
159 +
160 +
47 47  = Earthquake Data =
48 48  
163 +
49 49  == How to download an Earthquake Catalog ==
50 50  
51 51  {{code language="python"}}
... ... @@ -98,4 +98,32 @@
98 98  #catalog.plot(), ObsPy automatically uses the depth information to color the events in the plot
99 99  {{/code}}
100 100  
216 +== How to plot (Local) Earthquakes ==
217 +
218 +{{code language="python"}}
219 +from obspy import UTCDateTime
220 +from obspy.clients.fdsn import Client
221 +
222 +# Initialize FDSN client
223 +client = Client("AUSPASS")
224 +
225 +# Define time range
226 +starttime = UTCDateTime("2023-01-01")
227 +endtime = UTCDateTime()
228 +
229 +# Latitude and longitude bounds for Australia
230 +minlatitude = -44.0
231 +maxlatitude = -10.0
232 +minlongitude = 113.0
233 +maxlongitude = 154.0
234 +
235 +# Fetch event data for Australia with a minimum magnitude
236 +catalog = client.get_events(starttime=starttime, endtime=endtime, minmagnitude=4,
237 + minlatitude=minlatitude, maxlatitude=maxlatitude,
238 + minlongitude=minlongitude, maxlongitude=maxlongitude)
239 +
240 +# Plot the earthquakes
241 +catalog.plot(projection="local", title="Australia Earthquakes", resolution="i")
242 +{{/code}}
243 +
101 101