GenericMappingTools / GenericMappingTools/pygmt
ObsPy integration
- Dominant language
- Python
- Stars
- 874
- Forks
- 255
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 40
Description
[ObsPy](https://github.com/obspy/obspy/wiki) is the *de facto* standard tool for processing seismological data using Python. GMT is already heavily used by seismologists. It seems natural to make PyGMT integrate better with ObsPy. This issue can serve as a platform for broad discussion of how we might accomplish this.
On the seismology side in general, we already have [`Figure.meca()`](https://www.pygmt.org/latest/api/generated/pygmt.Figure.meca.html#pygmt.Figure.meca) wrapped. Some GMT plotting commands (namely, [`sac`](https://docs.generic-mapping-tools.org/dev/supplements/seis/sac.html)) could be wrapped by PyGMT and integrated with standard ObsPy data objects, such as [`Trace`](https://docs.obspy.org/packages/autogen/obspy.core.trace.Trace.html) and [`Stream`](https://docs.obspy.org/packages/autogen/obspy.core.stream.Stream.html) objects. We could even configure [`Figure.plot()`](https://www.pygmt.org/latest/api/generated/pygmt.Figure.plot) to take [`Inventory`](https://docs.obspy.org/packages/autogen/obspy.core.inventory.inventory.Inventory.html) objects.
For waveform plotting, imagine:
```python
import pygmt
import obspy
tr = obspy.read()[0]
fig = pygmt.Figure()
fig.coast(...) # Make your map
fig.plot(...) # Plot your stations / event / etc.
fig.sac(trace=tr, ...) # Plot your waveform
fig.show()
```
(Of course, perhaps we'd want to rename `Figure.sac()` for this example...)
We'd want to make ObsPy an *optional* dependency if we went down this route. I think that most of the work would be related to I/O, type-checking, etc. — as well as **surveying the seismology community on what'd be useful.**
Do folks have other ideas? Pinging @megies and @krischer in case you have any thoughts on this (thanks).
Contributor guide
Assessment
This issue has not been assessed yet.