当前位置: 首页>>代码示例>>Python>>正文


Python Stats.sampling_rate方法代码示例

本文整理汇总了Python中obspy.core.Stats.sampling_rate方法的典型用法代码示例。如果您正苦于以下问题:Python Stats.sampling_rate方法的具体用法?Python Stats.sampling_rate怎么用?Python Stats.sampling_rate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在obspy.core.Stats的用法示例。


在下文中一共展示了Stats.sampling_rate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ascii

# 需要导入模块: from obspy.core import Stats [as 别名]
# 或者: from obspy.core.Stats import sampling_rate [as 别名]
def ascii(path, filenames):
    """ Reads SPECFEM3D-style ascii data
    """
    from numpy import loadtxt
    from obspy.core import Stream, Stats, Trace

    stream = Stream()
    for filename in filenames:
        stats = Stats()
        data = loadtxt(path +'/'+ filename)

        stats.filename = filename
        stats.starttime = data[0,0]
        stats.sampling_rate = data[0,1] - data[0,0]
        stats.npts = len(data[:,0])

        try:
            parts = filename.split('.')
            stats.network = parts[0]
            stats.station = parts[1]
            stats.channel = temp[2]
        except:
            pass

        stream.append(Trace(data=data[:,1], header=stats))

    return stream
开发者ID:PrincetonUniversity,项目名称:seisflows,代码行数:29,代码来源:readers.py

示例2: get_obspy_trace

# 需要导入模块: from obspy.core import Stats [as 别名]
# 或者: from obspy.core.Stats import sampling_rate [as 别名]
 def get_obspy_trace(self):
     """
     Return class contents as obspy.Trace object
     """
     stat = Stats()
     stat.network = self.net.split(b'\x00')[0].decode()
     stat.station = self.sta.split(b'\x00')[0].decode()
     location = self.loc.split(b'\x00')[0].decode()
     if location == '--':
         stat.location = ''
     else:
         stat.location = location
     stat.channel = self.chan.split(b'\x00')[0].decode()
     stat.starttime = UTCDateTime(self.start)
     stat.sampling_rate = self.rate
     stat.npts = len(self.data)
     return Trace(data=self.data, header=stat)
开发者ID:adakite,项目名称:obspy,代码行数:19,代码来源:waveserver.py

示例3: test_pickle_stats

# 需要导入模块: from obspy.core import Stats [as 别名]
# 或者: from obspy.core.Stats import sampling_rate [as 别名]
 def test_pickle_stats(self):
     """
     Test pickling Stats objects. Test case for issue #10.
     """
     stats = Stats()
     stats.muh = 1
     stats['maeh'] = 'hallo'
     # ASCII
     temp = pickle.dumps(stats, protocol=0)
     stats2 = pickle.loads(temp)
     self.assertEqual(stats, stats2)
     # old binary
     temp = pickle.dumps(stats, protocol=1)
     stats2 = pickle.loads(temp)
     self.assertEqual(stats, stats2)
     # new binary
     temp = pickle.dumps(stats, protocol=2)
     stats2 = pickle.loads(temp)
     self.assertEqual(stats, stats2)
     # SOH channels sampling_rate & delta == 0. for #1989
     stats.sampling_rate = 0
     pickle.loads(pickle.dumps(stats, protocol=0))
     pickle.loads(pickle.dumps(stats, protocol=1))
     pickle.loads(pickle.dumps(stats, protocol=2))
开发者ID:QuLogic,项目名称:obspy,代码行数:26,代码来源:test_stats.py


注:本文中的obspy.core.Stats.sampling_rate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。