Best way to store theoretical arrival times using obspy Event/Pick/Arrival classes

Dear Obspy-users,

Couple of months ago I wrote some functions to plot my picks on top of a stream.plot(), I was happy with that and it worked quite well. But I also want to plot the theoretical arrival times for picks that are not associated to manual or auto picks.

The problem is that the Pick object doesn’t have a “theoretical” arrival time in addition to Pick.time. The theoretical arrival time is stored in the Arrival.residual attributes, but it implies that a Pick.time has already been defined.

How can I specify in the Obspy/QuakeML convention that I have a theoretical pick with no auto/manual pick associated to it? Should I edit the Pick.comment or Pick.evaluation_mode to specify “theoretical” and add a Arrival.residual of “-999” or something like that?

Thanks a lot for your upcoming help,

Hi Christian,

our internal format for all things related events are based on QuakeML so we are limited by its definition. The reason for this is that we want to have a format which can retain all the information. You thus cannot set the evaluation mode to “theoretical”. You could of course set the residual to some magical number and then internally decide that its a theoretical pick. Another option would be to add a custom tag to the picks as described here:

These can be serialized to valid QuakeML files and be read again.

All the best,

Lion

If you’re mainly interested in plotting the theoretical arrival times (as opposed to producing quakeml),
the way I did this was to create an extras{} dictionary with the P,S times and pass this into
WaveformPlotting function, which I hacked to plot dotted lines at the arrival times.
e.g.,

waveform = wp(stream=st, color=‘k’, type=‘relative’, xlabel=‘Seconds’, …, extras=extras)

waveform.plot_waveform()

If instead you’re interested in adding theoretical arrivals to the quakeml, this can be done
by adding picks with either a method id or comment set to indicate their (theoretical) source, and
wrapping these in arrivals.

Or, if you really want to be able to do something like: my_pick.method=‘Computed using IASP91’ …
you can extend the obspy pick class like this (to add a method attribute that plays well with obspy attrib dict):

class Pick(obsevent.Pick):

extra_keys = [‘method’]

def init(self, obspy_obj=None, **kwargs):

_init_handler(self, obspy_obj, **kwargs)

def setattr(self, name, value):

_set_attr_handler(self, name, value)

Let me know if any of these are of interest to you and I can send the necessary code.

Cheers,
-Mike Hagerty
m.hagerty@isti.com

Hi Lion,

Thanks for the advice. I didn’t know about the .extra attribute that could be added, that’s great! I’ll see which one of the two options I’ll use.

Best,

Ch.

Thanks Mike, ideally I would like all the info in the quakeml for exporting purposes also. I’ll probably use the extra feature advised by Lion or edit the Pick.comment as you mentioned to specify that the pick is “theoretical”. This would also be easier to integrate in my plot_picks() function, I guess.

Thanks again! Ch.