pyrocko.obspy_compat.base¶
This module provides basic compatibility between ObsPy and Pyrocko.
The functions defined here can be used to translate back and forth some of the
basic objects in Pyrocko and ObsPy. It also provides shortcuts to quickly look
at ObsPy waveforms with the Pyrocko’s Snuffler
application (snuffle(), fiddle()).
With plant() several new methods are attached
to Pyrocko and ObsPy classes.
Example, visualize ObsPy stream object with Snuffler:
import obspy
from pyrocko import obspy_compat
obspy_compat.plant()
stream = obspy.read() # returns some example data
stream.snuffle()
– With best wishes to the ObsPy Team from the Pyrocko Developers!
Functions
|
Manipulate ObsPy stream object interactively. |
|
Add conversion functions as methods to ObsPy and Pyrocko classes. |
|
Explore ObsPy data with Snuffler. |
|
Convert Pyrocko pile to ObsPy stream. |
|
Convert Pyrocko trace to ObsPy trace. |
|
Convert ObsPy catalog object to list of Pyrocko event objects. |
|
Convert ObsPy inventory to list of Pyrocko traces. |
|
Convert ObsPy trace object to Pyrocko trace object. |
|
Convert ObsPy stream object to list of Pyrocko trace objects. |
- to_pyrocko_trace(trace)[source]¶
Convert ObsPy trace object to Pyrocko trace object.
- Parameters:
trace –
obspy.Traceobject- Returns:
pyrocko.trace.Traceobject
- to_pyrocko_traces(stream)[source]¶
Convert ObsPy stream object to list of Pyrocko trace objects.
- Parameters:
stream –
obspy.Streamobject- Returns:
list of
pyrocko.trace.Traceobjects
- to_pyrocko_events(catalog)[source]¶
Convert ObsPy catalog object to list of Pyrocko event objects.
- Parameters:
catalog –
obspy.Catalogobject- Returns:
list of
pyrocko.model.event.Eventobjects orNoneif catalog isNone
- to_pyrocko_stations(inventory)[source]¶
Convert ObsPy inventory to list of Pyrocko traces.
- Parameters:
inventory –
obspy.Inventoryobject- Returns:
list of
pyrocko.model.station.Stationobjects orNoneif inventory isNone
- to_obspy_stream(pile)[source]¶
Convert Pyrocko pile to ObsPy stream.
- Parameters:
pile –
pyrocko.pile.Pileobject- Returns:
obspy.Streamobject
- to_obspy_trace(trace)[source]¶
Convert Pyrocko trace to ObsPy trace.
- Parameters:
trace –
pyrocko.trace.Trace
- snuffle(stream_or_trace, inventory=None, catalog=None, **kwargs)[source]¶
Explore ObsPy data with Snuffler.
- Parameters:
stream_or_trace –
obspy.Streamorobspy.Traceobjectinventory –
obspy.Inventoryobjectcatalog –
obspy.Catalogobjectkwargs – extra arguments passed to
pyrocko.trace.Trace.snuffle().
- Returns:
(return_tag, markers), wherereturn_tagis the a string to flag how the Snuffler window has been closed andmarkersis a list ofpyrocko.gui.snuffler.marker.Markerobjects.
This function displays an ObsPy stream object in Snuffler. It returns to the caller once the window has been closed. The
return_tagreturned by the function can be used as a primitive way to communicate a user decision to the calling script. By default it returns the key pressed to close the window (if any), either'q'or'x', but the value could be customized when the exit is triggered from within a Snuffling.See also
fiddle()for a variant of this function returning an interactively modified ObsPy stream object.
- fiddle(stream_or_trace, inventory=None, catalog=None, **kwargs)[source]¶
Manipulate ObsPy stream object interactively.
- Parameters:
stream_or_trace –
obspy.Streamorobspy.Traceobjectinventory –
obspy.Inventoryobjectcatalog –
obspy.Catalogobjectkwargs – extra arguments passed to
pyrocko.trace.Trace.snuffle().
- Returns:
obspy.Streamobject with changes applied interactively (orobspy.Traceif called with a trace as first argument).
This function displays an ObsPy stream object in Snuffler like
snuffle(), but additionally adds a Snuffling panel to apply some basic ObsPy signal processing to the contained traces. The applied changes are handed back to the caller as a modified copy of the stream object.import obspy from pyrocko import obspy_compat obspy_compat.plant() stream = obspy.read() stream_filtered = stream.fiddle() # returns once window has been # closed