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
-
... ... @@ -30,10 +30,43 @@ 30 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 -== Sub-paragraph==33 +== How to download event, station, instrument response == 34 34 35 -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. 36 36 36 +{{code language="python"}} 37 +import obspy 38 +from obspy.clients.fdsn import Client 39 + 40 +# Use AusPass client for station, waveform, and earthquake information 41 +client = Client("AUSPASS") 42 + 43 + 44 +# Download station information for AUMTC station in S1 network at the response level 45 +inv = client.get_stations(network="S1", station="AUMTC", location="*", 46 + channel="*", starttime=event_time - 60, 47 + endtime=event_time + 1000, level="response") 48 +print(inv) 49 + 50 +# Inventory metadata is stored in a Inventory > Network > Station > Channel hierarchy 51 + 52 +print(inv) #inventory level 53 + 54 +print(inv[0]) # network level (the first network in the inventory) 55 + 56 +print(inv[0][0]) # station level (the first station of the first network in the inventory) 57 + 58 +print(inv[0][0][0]) # channel level (the first channel of the first station of the first network in the inventoy) 59 + 60 +# you can also select items directly 61 + 62 +print(inv.select(station='AUMTC',channel='HHZ')[0][0][0]) 63 + 64 +# instrument response is attached to a channel object 65 + 66 +response = inv.select(station='AUMTC',channel='HHZ')[0][0][0].response 67 +{{/code}} 68 + 69 + 37 37 === Sub-sub paragraph === 38 38 39 39 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. ... ... @@ -43,11 +43,124 @@ 43 43 44 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 79 +== How to download waveform data == 46 46 47 -= Earthquake Data = 81 +{{code language="python"}} 82 +from obspy import UTCDateTime 83 +from obspy.clients.fdsn import Client 48 48 85 +# Initialize the FDSN client (you can also specify other data centers) 86 +client = Client("AUSPASS") 49 49 88 +# Event information 89 +network = "S1" 90 +station = "AUGRF" 91 +starttime = UTCDateTime("2021-09-21T23:15:53") # The time of the earthquake 92 +endtime = starttime + 360 # One hour of data after the earthquake 50 50 94 +# Download the MiniSEED data 95 +st = client.get_waveforms(network=network, station=station, location="*", channel="BHZ", 96 + starttime=starttime, endtime=endtime) 97 +# Save the stream to a MiniSEED file 98 +st.write("Woodspoint_2021.mseed", format="MSEED") 99 +print("Downloaded and saved the MiniSEED file.") 100 +{{/code}} 101 + 102 +== How to remove instrument response == 103 + 104 +{{code language="python"}} 105 +from obspy import read 106 +from obspy.core.util import AttribDict 107 + 108 +# Load the MiniSEED file 109 +st = read("Woodspoint_2021.mseed") 110 + 111 +# Download the instrument response 112 +inv = client.get_stations(network=network, station=station, location="*", 113 + channel="*", starttime=starttime, endtime=endtime, 114 + level="response") 115 + 116 +# Remove the instrument response 117 +output = 'VEL' # Output unit ('VEL' = velocity (default), 'DISP' = displacement, 'ACC' = acceleration) 118 + 119 +for tr in st: 120 + tr.remove_response(inventory=inv, output=output, plot=True) 121 + 122 +# Save the corrected MiniSEED file 123 +st.write("Woodspoint_2021_corrected.mseed", format="MSEED") 124 +{{/code}} 125 + 126 +== How to apply a bandpass filter == 127 + 128 +{{code language="python"}} 129 +from obspy import read 130 + 131 +# Load the MiniSEED file 132 +st = read("Woodspoint_2021.mseed") 133 + 134 +# Define the frequency band 135 +freq_min = 0.1 # Minimum frequency in Hz 136 +freq_max = 1.0 # Maximum frequency in Hz 137 + 138 +# Apply the bandpass filter 139 +for tr in st: 140 + tr.filter(type='bandpass', freqmin=freq_min, freqmax=freq_max) 141 + 142 +# Save the filtered MiniSEED file 143 +st.write("Woodspoint_2021_filtered.mseed", format="MSEED") 144 +{{/code}} 145 + 146 +== How to slice a waveform == 147 + 148 +{{code language="python"}} 149 +from obspy import read, UTCDateTime, Stream # Importing Stream here 150 + 151 +# Load the filtered MiniSEED file 152 +st = read("Woodspoint_2021_filtered.mseed") 153 + 154 +# Define the time window for slicing 155 +slice_start = UTCDateTime("2021-09-21T23:20:00") 156 +slice_end = slice_start +10 157 + 158 +# Slice the waveform for each Trace in the Stream 159 +sliced_st = Stream() # Now Stream is defined 160 +for tr in st: 161 + sliced_tr = tr.slice(starttime=slice_start, endtime=slice_end) 162 + sliced_st.append(sliced_tr) 163 + 164 +# Save the sliced MiniSEED file 165 +sliced_st.write("Woodspoint_2021_filtered_sliced.mseed", format="MSEED") 166 +{{/code}} 167 + 168 +== How to save a waveform == 169 + 170 +{{code language="python"}} 171 +# Save the sliced file as MiniSEED 172 +sliced_st.write("Woodspoint_2021_filtered_sliced.mseed", format="MSEED") 173 + 174 +# Or, save the sliced SAC file 175 +sliced_st.write("Woodspoint_2021_filtered_sliced.sac", format="SAC") 176 +{{/code}} 177 + 178 +== How to convert miniseed to sac == 179 + 180 +{{code language="python"}} 181 +from obspy import read 182 + 183 +# Read the MiniSEED file 184 +st = read("Woodspoint_2021.mseed") 185 + 186 +# Take the first Trace from the Stream 187 +tr = st[0] 188 + 189 +# Save that Trace as a SAC file 190 +tr.write("Woodspoint_2021.sac", format="SAC") 191 +{{/code}} 192 + 193 + 194 += Earthquake Data = 195 + 196 + 51 51 == How to download an Earthquake Catalog == 52 52 53 53 {{code language="python"}} ... ... @@ -128,4 +128,3 @@ 128 128 catalog.plot(projection="local", title="Australia Earthquakes", resolution="i") 129 129 {{/code}} 130 130 131 -