Adam and Lion,
Thanks for the feedback. I ended up doing things in a hybrid between your suggestions. See below. Note that in the plotting with the section command, I did some ugly things to get the xlim to be 180 degrees. It may be nice to set a max in the st.plot(‘section’) that offset cannot exceed 180 or $\sim$20,000 km.
I got most my info from the advanced plotting demo, but it may also be nice to have an example (like the one below) in the gallery?!
Anyway, I look forward to getting better at this, and one day making a contribution!
Kasper
#!/usr/bin/python
from obspy import UTCDateTime
from obspy.core.util import gps2DistAzimuth
from datetime import date
from obspy.iris import Client
client = Client()
from obspy import UTCDateTime
import matplotlib.pyplot as plt
read in the dataless information for all stations in the IU network
from obspy.xseed import Parser
parser = Parser(“IU94.885435.dataless”)
bolivia EQ:
starttime = UTCDateTime(“1994-06-09T00:30:00.000”)
endtime = UTCDateTime(“1994-06-10T00:00:00.000”)
find all events between start and endtime above minmag:
cat = client.getEvents(starttime=starttime, endtime=endtime,minmag=7)
print(cat)
epicenter of the first event:
lat=cat[0].origins[0].latitude
lon=cat[0].origins[0].longitude
get MSEED data from network IU, component BHZ:
st = client.getWaveform(“IU”, “”, “”, “BHZ”, starttime, starttime+60606)
for tr in st:
get lat and lon from dataless:
seedid = tr.getId()
tr.stats.coordinates = parser.getCoordinates(seedid,starttime)
compute epicentral distance (not really used in the plot, though):
tr.stats.distance = gps2DistAzimuth(tr.stats.coordinates.latitude,tr.stats.coordinates.longitude,lat,lon)[0]
re-sample (otherwise too many points to plot):
tr.decimate(factor=2)
remove a trace with bad data from the stream:
for tr in st.select(station=“YAK”):
st.remove(tr)
filter the data to highlight the surface waves:
st.filter(‘lowpass’, freq=0.005)
#fig = plt.figure()
fig, ax = plt.subplots()
st.plot(fig=fig, type=‘section’,equal_scale=False, time_down=True, ev_coord=(lat,lon),linewidth=1,alpha=1,scale=1,dist_degree=True)
ugly (manual) way to set limit: 1 would be tight, but I want 180 to be max):
ax.set_xlim(xmax=1.1)
plt.xlabel(‘Epicentral distance [degrees]’)
fig.savefig(‘bolivia.pdf’, transparent=True, bbox_inches=‘tight’, pad_inches=0)
fig.show()