Align waveform plots to p pock time

Dear Collegues!

I would like to compare waveform data (mseed files) from different earthquake events to each other in order to show that repeating earthquakes at the same fault have similar waveforms.

I am looking for a way to overlay several waveform files in one plot, aligned at p-wave onset or plot several waveforms one below the other, aligned with the p-onset time I have picked for each event.

Has anyone experience producing plots like that with Obspy or an idea how this could be done?

Thank you in advance!


Franz Reiter

PhD Student

Institute for Geology

University of Innsbruck


Hi Franz

Don’t think there’s dedicated method to do so (but then again if I’m wrong it wouldn’t be the first time…), but in principle what you want to achieve should should be doable in obspy. One way (perhaps not the best) would be to

  1. read in all the wave forms into a stream object (see )
  2. select a reference waveform and compute the time difference between the p-picks for all the other waveforms
  3. shift the start time of all waveforms by the time difference computed under point 2., i.e. adjust stream.traces[i].stats.starttime where stream is the object created under point 1.
  4. set the offset of all waveforms to be equal (stream.traces[i].stats.distance)
  5. Plot the waveforms using stream.plot(type=‘section’) (for some more info see and )

Now, I have not tested the above recipe but in principle it should work