Dear obspy users,
I would like to what would be the best approach to store P, Sv and Sh amplitudes into an Event class for further analysis of focal mechanisms.
For polarity, I can associate it to a phase in a "Pick" class. But how and where can I/should I associate an amplitude associated to a phase (P or S) following QuakeMl nomenclature , in a "amplitude" class? Do I need to create a new class?
The Event class has an attribute "amplitudes" which takes a list of obspy.core.event.magnitude.Amplitude class objects. The Amplitude class then has an attribute "pick_id" which is used to associate the Amplitude object with a Pick class object (by assigning a shallow copy of the obspy.core.base.ResourceIdentifier, assigned to Pick.resource_id, to Amplitude.pick_id). For an overview of the classes have a look at the pdf I attached to a post in the thread started by Hicks S.P. 24/2, "Creating an event catalogue"
I took a lot at your scheme, which is really clear by the way. I thought maybe that a better idea would have been to create a new class “Amplitude foc” (pointing to “Amplitude” ref id) that can be put in the class “FocalMechanism”. In that way, for one event, we could have different focal mechanisms with different amplitudes… a bit similar to what “Arrivals” are to “Pick”. Anyway for the moment I’ll directly put the amplitude directly under Event. Thanks for the advise.
Just to clarify and close the loop on this, the ObsPy classes for Event are based on the QuakeML UML and mirror them ALMOST exactly (there are a few minor diffs in naming and style). You can find the schemas and 2 very nice PDF documents of the UML here: https://quake.ethz.ch/quakeml/Documents
I would use those as the canonical reference, along with the ObsPy docstrings.