from obspy import Trace # create a new Trace object tr = Trace(data=[1.0, 2.0, 3.0], header={'starttime': '2021-01-01T00:00:00', 'sampling_rate': 100}) # print the metadata of the Trace print(tr.stats) # plot the time-series data tr.plot()
from obspy import read # read a seismic waveform data file into a Trace object st = read('seismic_data.mseed') # stack the three components of the seismic data st = st.merge() # determine the peak ground acceleration pga = st.max() # print the peak ground acceleration print('PGA: {} m/s^2'.format(pga))In this example, we read a seismic waveform data file into a Stream object and merge the three components of the seismic data into a single Trace object. Then we determine the peak ground acceleration of the seismic data and print it out. Package library: ObsPy.