Changes for page FDSN Guide
Last modified by robert on 2025/03/24 12:02
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -27,7 +27,7 @@ 27 27 28 28 = Station Metadata = 29 29 30 - Lorempsumdolorsitamet,consecteturadipiscing elit, sed do eiusmod temporincididuntutlaboreetdoloremagna aliqua. Utenimad minim veniam, quis nostrud exercitationullamcolaborisnisiut aliquipex eacommodo consequat.Duis aute irure dolor inreprehenderitin voluptatevelit essecillumdoloreeu fugiatnulla pariatur. Excepteur sintoccaecatcupidatatnonproident,suntin culpaquifficia deseruntmollit animid estlaborum.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,10 +41,204 @@ 41 41 42 42 = Waveform Data = 43 43 44 - Loremipsumdolor sitamet,consecteturadipiscing elit,sed do eiusmod temporincididuntut labore etdoloremagna aliqua. Ut enimadminimveniam,quis nostrudexercitation ullamcolaborisnisiutaliquip ex ea commodoconsequat.Duisauteirure dolorin reprehenderitin voluptatevelit essecillumdoloreeu fugiatnullapariatur.Excepteursintoccaecatcupidatatnonproident,suntinculpaqui officiaeseruntmollit 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 -== Sub-paragraph==46 +== How to download waveform data == 47 47 48 -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. 48 +{{code language="python"}} 49 +from obspy import UTCDateTime 50 +from obspy.clients.fdsn import Client 49 49 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 + 50 50 = Earthquake Data = 162 + 163 + 164 +== How to download an Earthquake Catalog == 165 + 166 +{{code language="python"}} 167 +from obspy.clients.fdsn import Client 168 +from obspy import UTCDateTime 169 + 170 +# Initialize the AusPass FDSN client 171 +client = Client("AUSPASS") 172 + 173 +# Define the time range for the earthquake catalog 174 +start_time = UTCDateTime("2021-08-01") 175 +end_time = UTCDateTime("2022-01-01") # End of year 176 + 177 +# Define the geographic region (latitude and longitude for Woodspoint, Victoria, Australia) 178 +latitude = -37.47 179 +longitude = 146.10 180 +max_radius = 5 # in degrees 181 + 182 +# Download the earthquake catalog 183 +catalog = client.get_events(starttime=start_time, endtime=end_time, 184 + minmagnitude=2, latitude=latitude, longitude=longitude, 185 + maxradius=max_radius) 186 + 187 +# Save the catalog to a file (e.g., QuakeML format) 188 +catalog.write("Woodspoint_earthquakes.xml", format="QUAKEML") 189 +{{/code}} 190 + 191 +== How to plot (Global) Earthquakes == 192 + 193 +{{code language="python"}} 194 +from obspy import UTCDateTime 195 +from obspy.clients.fdsn import Client 196 + 197 +# Initialize FDSN client to connect to the IRIS data center 198 +client = Client("IRIS") 199 + 200 +# Set the time range for fetching earthquake data 201 +# Start time: January 1, 2023 202 +# End time: Current time 203 +starttime = UTCDateTime("2023-01-01") 204 +endtime = UTCDateTime() 205 + 206 +# Fetch earthquake events with a minimum magnitude of 7 207 +catalog = client.get_events(starttime=starttime, endtime=endtime, minmagnitude=7) 208 +#client.get_events(). This function returns a Catalog object that contains a list of Event objects. 209 +#Each Event object, in turn, has an Origins attribute that contains the depth information 210 + 211 +# Plot the fetched earthquake data using an orthographic projection 212 +catalog.plot(projection="ortho", title="Global Earthquakes with Magnitude >= 7 since 2023") 213 +#catalog.plot(), ObsPy automatically uses the depth information to color the events in the plot 214 +{{/code}} 215 + 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 + 244 +