Changes for page FDSN Guide

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

From version 2.4
edited by robert
on 2025/03/24 10:30
Change comment: There is no comment for this version
To version 3.1
edited by robert
on 2025/03/24 10:35
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -43,9 +43,7 @@
43 43  
44 44  # Download station information for AUMTC station in S1 network at the response level
45 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)
46 + channel="*", level="response")
49 49  
50 50  # Inventory metadata is stored in a Inventory > Network > Station > Channel hierarchy
51 51  
... ... @@ -67,17 +67,16 @@
67 67  {{/code}}
68 68  
69 69  
70 -=== Sub-sub paragraph ===
71 71  
72 -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.
73 73  
74 -
75 75  = Waveform Data =
76 76  
77 77  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).
78 78  
79 -== How to download waveform data ==
74 +== Downloading and Storing data ==
80 80  
76 +=== How to download waveform data ===
77 +
81 81  {{code language="python"}}
82 82  from obspy import UTCDateTime
83 83  from obspy.clients.fdsn import Client
... ... @@ -99,9 +99,76 @@
99 99  print("Downloaded and saved the MiniSEED file.")
100 100  {{/code}}
101 101  
102 -== How to remove instrument response ==
99 +=== How to download a LOT of waveform data ===
103 103  
104 104  {{code language="python"}}
102 +from obspy import UTCDateTime
103 +from obspy.clients.fdsn import Client
104 +import datetime
105 +
106 +# Initialize client and set parameters
107 +client = Client("IRIS")
108 +start_date = UTCDateTime("2023-07-01")
109 +end_date = UTCDateTime("2023-07-02")
110 +network = "S1"
111 +station = "AUMTS"
112 +channel = "BHZ"
113 +
114 +# Loop to download data one day at a time
115 +while start_date <= end_date:
116 + next_date = start_date + datetime.timedelta(days=1)
117 + try:
118 + st = client.get_waveforms(network, station, "*", channel, start_date, next_date)
119 + st.write(f"{start_date.date}.mseed", format="MSEED")
120 + except:
121 + print(f"Failed for {start_date} to {next_date}")
122 + start_date = next_date
123 +{{/code}}
124 +
125 +=== How to store and archive waveform data in SeisComP Data Structure (SDS) ===
126 +
127 +{{code language="python"}}
128 +import os
129 +from obspy import UTCDateTime, read
130 +from obspy.clients.fdsn import Client
131 +
132 +# Initialize the client
133 +client = Client("AUSPASS") # Replace with the correct client endpoint if different
134 +
135 +# Define event time and time window
136 +event_time = UTCDateTime("2021-09-21T23:15:53")
137 +starttime = event_time - 600 # 10 minutes before the event
138 +endtime = event_time + 1800 # 30 minutes after the event
139 +
140 +# Download the waveform data
141 +st = client.get_waveforms(network="S1", station="AUMTS", location="*", channel="*", starttime=starttime, endtime=endtime)
142 +
143 +# Create SDS structure: ROOT/YEAR/NET/STA/CHAN.TYPE/NET.STA.LOC.CHAN.YEAR.DAY
144 +sds_root = "." # Replace with your desired directory
145 +
146 +for tr in st:
147 + net = tr.stats.network
148 + sta = tr.stats.station
149 + loc = tr.stats.location
150 + chan = tr.stats.channel
151 + year = str(tr.stats.starttime.year)
152 + jday = str(tr.stats.starttime.julday).zfill(3)
153 +
154 + sds_path = os.path.join(sds_root, year, net, sta, f"{chan}.D", f"{net}.{sta}.{loc}.{chan}.{year}.{jday}")
155 +
156 + # Create directories if they don't exist
157 + os.makedirs(os.path.dirname(sds_path), exist_ok=True)
158 +
159 + # Save the trace as a MiniSEED file
160 + tr.write(sds_path, format="MSEED")
161 +{{/code}}
162 +
163 +==
164 +Common Data Operations ==
165 +
166 +=== How to remove instrument response ===
167 +
168 +{{code language="python"}}
105 105  from obspy import read
106 106  from obspy.core.util import AttribDict
107 107  
... ... @@ -123,7 +123,7 @@
123 123  st.write("Woodspoint_2021_corrected.mseed", format="MSEED")
124 124  {{/code}}
125 125  
126 -== How to apply a bandpass filter ==
190 +=== How to apply a bandpass filter ===
127 127  
128 128  {{code language="python"}}
129 129  from obspy import read
... ... @@ -143,7 +143,7 @@
143 143  st.write("Woodspoint_2021_filtered.mseed", format="MSEED")
144 144  {{/code}}
145 145  
146 -== How to slice a waveform ==
210 +=== How to slice a waveform ===
147 147  
148 148  {{code language="python"}}
149 149  from obspy import read, UTCDateTime, Stream # Importing Stream here
... ... @@ -165,7 +165,7 @@
165 165  sliced_st.write("Woodspoint_2021_filtered_sliced.mseed", format="MSEED")
166 166  {{/code}}
167 167  
168 -== How to save a waveform ==
232 +=== How to save a waveform ===
169 169  
170 170  {{code language="python"}}
171 171  # Save the sliced file as MiniSEED
... ... @@ -175,7 +175,7 @@
175 175  sliced_st.write("Woodspoint_2021_filtered_sliced.sac", format="SAC")
176 176  {{/code}}
177 177  
178 -== How to convert miniseed to sac ==
242 +=== How to convert miniSEED to SAC ===
179 179  
180 180  {{code language="python"}}
181 181  from obspy import read
... ... @@ -193,6 +193,7 @@
193 193  
194 194  = Earthquake Data =
195 195  
260 +Earthquake data can be accessed directly or via ObsPy's get_events code
196 196  
197 197  == How to download an Earthquake Catalog ==
198 198  
... ... @@ -274,3 +274,4 @@
274 274  catalog.plot(projection="local", title="Australia Earthquakes", resolution="i")
275 275  {{/code}}
276 276  
342 +