Hi Coralie,
Perhaps there is a more streamlined method, but I approached this problem by first appending the station locations into the trace stats, then I looped over each station trace in the stream to compute the epicentral distance and then plotting the station label using plt.text:
from obspy.core import read, AttribDict
# Put station location in header
for tr in st:
with open(sta_locs, 'r') as station_file:
for station_line in station_file:
if tr.stats.station == station_line.split(',')[0]:
tr.stats.coordinates = AttribDict({
'latitude': float(station_line.split(',')[1]),
'longitude': float(station_line.split(',')[2])})
# Make basic section plot
fig = plt.figure(figsize=(14, 16))
st.plot(type='section', ev_coord=(evt_lat,evt_lon),
dist_degree='False', offset_min=min_degree,
offset_max=max_degree, orientation='horizontal',
scale=0.88, alpha=0.9, fig=fig, size=(1400, 1600),
dpi=300)
# Plot label with station name
for tr in st:
dist = locations2degrees(evt_lat, evt_lon, tr.stats.coordinates.latitude,
tr.stats.coordinates.longitude)
plt.text(2, dist+0.02, tr.stats.station, fontsize = 16)
Hope that helps!
Steve
Dr. Stephen Hicks
Postdoctoral Research Fellow in Passive Source Seismology
University of Southampton
T +44 (0)23 8059 9082 (ext: 29239) M +44 (0) 7775 694766
E s.hicks@soton.ac.uk Twitter @seismo_steve <http://www.twitter.com/seismo_steve>
W UoS profile <http://www.southampton.ac.uk/oes/about/staff/sphr1r17.page>
Room 786/14
Ocean and Earth Science, National Oceanography Centre Southampton