本文整理汇总了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)