Chapter 6 Waveform QC
A visual inspection of the waveforms can be done either using Snuffler application or Python scripts using Obspy.
6.1 Snuffler
Activate virtual environment using:
conda activate gmtobsrocko
Navigate into the folder containing the waveform files and use a command to visualise them with Snuffler:
snuffler *
To show the waveforms only from the specific network, use
snuffler GR.*
Figure 6.1: A waveforms vieving for GR network waveforms using Snuffler.
A comprehensive Snuffler tutorial can be found online.
6.2 Obspy
Activate virtual environment using:
conda activate gmtobsrocko
Open the scipt QC_the_waveforms.ipynb and import the required Python dependencies.
import os
from obspy import read
from obspy.clients.fdsn import Client
import numpy as np
from obspy import read_inventory
from obspy.core import UTCDateTime
from datetime import datetime, timedelta
Set the location of the waveforms for the specific event:
folder_path = '/Users/localadmin/SHARPSeisTools/Northsea_grond_project/data/events/event_2022-03-21_05-32-55/waveforms/*[!.xml]'
Read the data into a stream object:
# read waveform data is returned as a Stream object.
st = read(folder_path)
print(st)
Create an event object and set the event’s time, latitude and longitude.
#create an event object
event={}
time=UTCDateTime('2022-03-21 05:32:56.440')
event['time']=time
event['lat']=61.53
event['lon']=2.53
event['loc']=(float(event['lat']),float(event['lon']))
Set the time boundaries for the waveform data selection:
# set the time boundaries, for the waveform data selection
delta_t=20 # minutes
t1= time - timedelta(hours=0, minutes=delta_t)
t2=time + timedelta(hours=0, minutes=delta_t)
To visualise the data run the following script:
for tr in st:
try:
tr=tr.trim(t1, t2)
tr.detrend("linear")
tr.filter('bandpass', freqmin=0.01, freqmax=0.05, zerophase=True)
tr.plot()
except Exception as e:
string = tr.stats.network + '.'+tr.stats.station+'.'+tr.stats.location+'.'+tr.stats.channel
print(string)
print(e)
This will create a plot with 40 minutes (20 minutes before the event’s time and 20 minutes after) waveform plots for each of the traces from the stream object:
Figure 6.2: An example of the waveforms plots for the selected 40 minutes time interval.
Figure 6.3) shows an example of a waveform plot with a low signal-to-noise ratio, which we want to exclude from the moment tensor optimisation’s waveform fitting process. The selection of the waveforms for the retrieval of the focal mechanisms in the North Sea was performed manually.
Figure 6.3: An example of the waveforms plots for the selected 40 minutes time interval with a bad data quality.