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


Python Stream._cleanup方法代码示例

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


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

示例1: Stream

# 需要导入模块: from obspy.core import Stream [as 别名]
# 或者: from obspy.core.Stream import _cleanup [as 别名]
from response_spectrum import ResponseSpectrum, NigamJennings, plot_response_spectra, plot_time_series
import sm_utils


#Need to add comments to this code

debug = True

files = glob.glob('data/*')

st = Stream()
for curfile in files:
	st+=read(curfile)

#Make everything overlap and nice
st._cleanup()
st.sort(['network','station','channel','starttime'])


pers = np.linspace(0.01, 20, 300)
for idx, tr in enumerate(st):
	tr.detrend('demean')
	tr.taper(max_percentage=0.05, type='cosine')
	tr.data = tr.data
	tr.filter('highpass',freq=1.0)
	rs = NigamJennings(tr.data,1/tr.stats.sampling_rate,pers,damping=0.5, units="m/s/s")
	spec, ts, acc, vel, dis = rs.evaluate()
	fig = plt.figure(1, figsize=(8,8))
	plt.loglog(spec["Period"],spec["Pseudo-Acceleration"]*0.1/9.81,'k',linewidth=2)
	plt.xlim([.1, 10])
	plt.xlabel('Period (s)', fontsize=18)
开发者ID:aringler-usgs,项目名称:pgapgv,代码行数:33,代码来源:pgapgv.py

示例2: getWaveform

# 需要导入模块: from obspy.core import Stream [as 别名]
# 或者: from obspy.core.Stream import _cleanup [as 别名]
    def getWaveform(self, network, station, location, channel, starttime, endtime, cleanup=True):
        """
        Retrieves waveform data from Earthworm Wave Server and returns an ObsPy
        Stream object.

        :type filename: str
        :param filename: Name of the output file.
        :type network: str
        :param network: Network code, e.g. ``'UW'``.
        :type station: str
        :param station: Station code, e.g. ``'TUCA'``.
        :type location: str
        :param location: Location code, e.g. ``'--'``.
        :type channel: str
        :param channel: Channel code, e.g. ``'BHZ'``. Last character (i.e.
            component) can be a wildcard ('?' or '*') to fetch `Z`, `N` and
            `E` component.
        :type starttime: :class:`~obspy.core.utcdatetime.UTCDateTime`
        :param starttime: Start date and time.
        :type endtime: :class:`~obspy.core.utcdatetime.UTCDateTime`
        :param endtime: End date and time.
        :return: ObsPy :class:`~obspy.core.stream.Stream` object.
        :type cleanup: bool
        :param cleanup: Specifies whether perfectly aligned traces should be
            merged or not. See :meth:`obspy.core.stream.Stream.merge` for
            ``method=-1``.

        .. rubric:: Example

        >>> from obspy.earthworm import Client
        >>> from obspy.core import UTCDateTime
        >>> client = Client("pele.ess.washington.edu", 16017)
        >>> dt = UTCDateTime() - 2000  # now - 2000 seconds
        >>> st = client.getWaveform('UW', 'TUCA', '', 'BHZ', dt, dt + 10)
        >>> st.plot()  # doctest: +SKIP
        >>> st = client.getWaveform('UW', 'TUCA', '', 'BH*', dt, dt + 10)
        >>> st.plot()  # doctest: +SKIP

        .. plot::

            from obspy.earthworm import Client
            from obspy.core import UTCDateTime
            client = Client("pele.ess.washington.edu", 16017)
            dt = UTCDateTime() - 2000  # now - 2000 seconds
            st = client.getWaveform('UW', 'TUCA', '', 'BHZ', dt, dt + 10)
            st.plot()
            st = client.getWaveform('UW', 'TUCA', '', 'BH*', dt, dt + 10)
            st.plot()
        """
        # replace wildcards in last char of channel and fetch all 3 components
        if channel[-1] in "?*":
            st = Stream()
            for comp in ("Z", "N", "E"):
                channel_new = channel[:-1] + comp
                st += self.getWaveform(network, station, location, channel_new, starttime, endtime, cleanup=cleanup)
            return st
        if location == "":
            location = "--"
        scnl = (station, channel, network, location)
        # fetch waveform
        tbl = readWaveServerV(self.host, self.port, scnl, starttime, endtime)
        # create new stream
        st = Stream()
        for tb in tbl:
            st.append(tb.getObspyTrace())
        if cleanup:
            st._cleanup()
        st.trim(starttime, endtime)
        return st
开发者ID:kasra-hosseini,项目名称:obspy,代码行数:71,代码来源:client.py


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