Basic Questionabout plotting Seismograms

Hello,

I have a basic question about plotting waveforms. So when using the plot function, I hope to plot a seismogram file that has multiple traces, but I am slightly confused about how to use the starttime and endtime functions. Say my seismogram runs from 201306240600 to 201306240700, but I only want to look at 20130624064445 to 20130624064510. How would I implement that in the code?
Here’s what I have so far:

from obspy import read
seismogram = read(“path\to\seismogram”)
seismogram.plot(color= ‘red’)

Thanks for the help,
Greg

Hi Greg,

the start- and end time parameters are obspy.UTCDateTime objects.

http://docs.obspy.org/packages/autogen/obspy.core.utcdatetime.UTCDateTime.html#obspy.core.utcdatetime.UTCDateTime

You can use them for example like this:

import obspy
st = obspy.read(“some_file”)
st.plot(starttime=obspy.UTCDateTime(2013, 1, 1, 2), endtime=obspy.UTCDateTime(2013, 1, 1, 3)

In this case it will only plot the timeframe specified. Otherwise it will plot the whole seismogram.

Cheers!

Lion

Another basic seismogram plotting question. If I read a Seisan file which contains 19 traces, and then try to plot it, only the first 4 traces are plotted.

Is there a single parameter I can change to make it plot all the traces?

Below you will see my workaround which is to create a streamplot function, and then call it from the mulplt2 script, which is just an example of how to use it.

streamplot.py (1.87 KB)

mulplt2.py (608 Bytes)

Could it be that some of the traces have the same channel etc?
The preview plot merges traces of the same channel together before
plotting (can be deactivated (option is called "automerge" I think).

best,
Tobias