本文整理汇总了Python中obspy.core.event.Catalog.plot方法的典型用法代码示例。如果您正苦于以下问题:Python Catalog.plot方法的具体用法?Python Catalog.plot怎么用?Python Catalog.plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.event.Catalog
的用法示例。
在下文中一共展示了Catalog.plot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mktemplates
# 需要导入模块: from obspy.core.event import Catalog [as 别名]
# 或者: from obspy.core.event.Catalog import plot [as 别名]
def mktemplates(network_code='GEONET',
publicIDs=['2016p008122', '2016p008353', '2016p008155',
'2016p008194']):
"""Functional wrapper to make templates"""
from collections import Counter
from eqcorrscan.core import template_gen
# This import section copes with namespace changes between obspy versions
import obspy
if int(obspy.__version__.split('.')[0]) >= 1:
from obspy.clients.fdsn import Client
from obspy import read_events
else:
from obspy.fdsn import Client
from obspy import readEvents as read_events
from obspy.core.event import Catalog
# We want to download some QuakeML files from the New Zealand GeoNet
# network, GeoNet currently doesn't support FDSN event queries, so we
# have to work around to download quakeml from their quakeml.geonet site.
client = Client(network_code)
# We want to download a few events from an earthquake sequence, these are
# identified by publiID numbers, given as arguments
catalog = Catalog()
for publicID in publicIDs:
if network_code == 'GEONET':
data_stream = client._download('http://quakeml.geonet.org.nz/' +
'quakeml/1.2/' + publicID)
data_stream.seek(0, 0)
catalog += read_events(data_stream, format="quakeml")
data_stream.close()
else:
catalog += client.get_events(eventid=publicID,
includearrivals=True)
# Lets plot the catalog to see what we have
catalog.plot(projection='local', resolution='h')
# We don't need all the picks, lets take the information from the
# five most used stations
all_picks = []
for event in catalog:
all_picks += [(pick.waveform_id.station_code) for pick in event.picks]
all_picks = Counter(all_picks).most_common(5)
all_picks = [pick[0] for pick in all_picks]
for event in catalog:
if len(event.picks) == 0:
raise IOError('No picks found')
event.picks = [pick for pick in event.picks
if pick.waveform_id.station_code in all_picks]
# Now we can generate the templates
templates = template_gen.from_client(catalog=catalog,
client_id=network_code,
lowcut=2.0, highcut=9.0,
samp_rate=20.0, filt_order=4,
length=3.0, prepick=0.15,
swin='all', debug=1, plot=True)
# We now have a series of templates! Using Obspys Stream.write() method we
# can save these to disk for later use. We will do that now for use in the
# following tutorials.
for i, template in enumerate(templates):
template.write('tutorial_template_' + str(i) + '.ms', format='MSEED')
# Note that this will warn you about data types. As we don't care
# at the moment, whatever obspy chooses is fine.
return