本文整理匯總了Python中pyasdf.ASDFDataSet.get_station_list方法的典型用法代碼示例。如果您正苦於以下問題:Python ASDFDataSet.get_station_list方法的具體用法?Python ASDFDataSet.get_station_list怎麽用?Python ASDFDataSet.get_station_list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyasdf.ASDFDataSet
的用法示例。
在下文中一共展示了ASDFDataSet.get_station_list方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: convert_to_sac
# 需要導入模塊: from pyasdf import ASDFDataSet [as 別名]
# 或者: from pyasdf.ASDFDataSet import get_station_list [as 別名]
def convert_to_sac(asdf_fn, outputdir, tag=None, type="sac"):
"""
Convert asdf to different types of file
"""
if not os.path.exists(asdf_fn):
raise ValueError("No asdf file: %s" % asdf_fn)
if not os.path.exists(outputdir):
raise ValueError("No output dir: %s" % outputdir)
ds = ASDFDataSet(asdf_fn)
sta_list = ds.get_station_list()
print sta_list
print "tag",tag
for sta_tag in sta_list:
station_name = sta_tag.replace(".", "_")
station = getattr(ds.waveforms, station_name)
attr_list = dir(station)
attr_list.remove('StationXML')
print station_name, attr_list
if tag is None or tag == "":
if len(attr_list) == 1:
stream = getattr(station, attr_list[0])
else:
stream = getattr(station, tag)
#print sta_tag, stream
for tr in stream:
network = tr.stats.network
station = tr.stats.station
location = tr.stats.location
channel = tr.stats.channel
filename = ".".join([network, station, location, channel, type])
filename = os.path.join(outputdir, filename)
print "output filename:", filename
tr.write(filename, format=type)