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


Python core.read方法代码示例

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


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

示例1: maxAmplitude

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def maxAmplitude(self,Waveform, ttime, Origin, path):
        st = str(Origin.time)[:-1]
    
        ponset = UTCDateTime(st) + ttime
        winamp_start = ponset
        winamp_end = ponset + 10

        winamp = read(path, format="MSEED", starttime=winamp_start, endtime=winamp_end, nearest_sample=True)
    
        id = winamp[0].stats.network+'.'+winamp[0].stats.station+'.'+winamp[0].stats.location+'.'+winamp[0].stats.channel
    
        print 'MAXAMP: ',winamp.max(),id
    
        return abs(winamp.max()[0])
    
    # --------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:18,代码来源:arrayXcorrCross.py

示例2: signoise

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def signoise(Waveform, ttime, Origin, path):
    
    st = str(Origin.time)[:-1]
    
    ponset = UTCDateTime(st) + ttime
    
    winnoise_start = Waveform.stats.starttime
    winnoise_end = ponset - 10
    winsig_start = ponset - 2
    winsig_end = ponset + 5
    
    winnoise = read(path, format="MSEED", starttime=winnoise_start, endtime=winnoise_end, nearest_sample=True)
    winsig   = read(path, format="MSEED", starttime=winsig_start, endtime=winsig_end, nearest_sample=True)
    
    psignal = abs(winsig.max()[0])
    pnoise = abs(winnoise.max()[0])

    signoise = float(psignal) / float(pnoise)
    print psignal, pnoise, signoise
    
    return signoise
# -------------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:24,代码来源:array-xcross.py

示例3: readWaveformsPicker

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def readWaveformsPicker (self,station, tw, Origin, ttime):
    
        t2      = UTCDateTime(self.Origin.time)
        sdspath = os.path.join(self.EventPath,'data', str(t2.year))
        
        if station.loc == '--':
            station.loc = ''

        staName    = station.net + '.'   + station.sta  + '.' + station.loc + '.' + station.comp
        streamData = staName     + '.D.' + str(t2.year) + '.' + str("%03d" % t2.julday)
        entry      = os.path.join (sdspath, station.net, station.sta, station.comp + '.D', streamData)
        st         = read (entry, format="MSEED", starttime=tw['start'], endtime=tw['end'], nearest_sample=True)

        if len(st.getGaps()) > 0:
            st.merge (method=0, fill_value='interpolate', interpolation_samples=0)
        
        stream = self.filterWaveform (st)
        return stream

    # --------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:22,代码来源:array_crosscorrelation_v4.py

示例4: proof_file_v2

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def proof_file_v2(filename,component):
    
    size=0
    streamList = []
    
    if (os.path.isfile(filename) and os.path.getsize(filename) != 0):
          
          try:
              st = read(filename)
              for i in st:
                  streamList.append(i.stats.channel)
              if len(set(streamList)) == len(component):
                  #to_sds(filename)
                  multiplex(filename)
                  size = os.path.getsize(filename)
              else:
                  size = 0
          except:
               size = 0
    
    return size 
开发者ID:braunfuss,项目名称:bat,代码行数:23,代码来源:ev_wave_mt4.py

示例5: load_stream

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def load_stream(path):
    """Loads a Stream object from the file at path.

    Args:
        path: path to the input file, (for supported formats see,
        http://docs.obspy.org/tutorial/code_snippets/reading_seismograms.html)

    Returns:
        an obspy.core.Stream object
        (http://docs.obspy.org/packages/autogen/obspy.core.stream.Stream.html#obspy.core.stream.Stream)
    """

    stream = read(path)
    stream.merge()

    # assert len(stream) == 3  # We need X,Y,Z traces

    return stream 
开发者ID:tperol,项目名称:ConvNetQuake,代码行数:20,代码来源:data_io.py

示例6: signoise

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def signoise(self,Waveform, ttime, path):
    
        st = str(self.Origin.time)[:-1]
    
        ponset = UTCDateTime(st) + ttime
    
        winnoise_start = Waveform.stats.starttime
        winnoise_end   = ponset - 10
        winsig_start   = ponset - 2
        winsig_end     = ponset + 5

        try:
            winnoise = read(path, format="MSEED", starttime=winnoise_start, endtime=winnoise_end, nearest_sample=True)
            winsig   = read(path, format="MSEED", starttime=winsig_start, endtime=winsig_end, nearest_sample=True)
        except Exception, e:
            print e
        

        psignal = abs(winsig.max()[0])
        pnoise = abs(winnoise.max()[0])

        signoise = float(psignal) / float(pnoise)
        print psignal, pnoise, signoise
    
        return signoise

    # --------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:29,代码来源:arrayXcorrCross.py

示例7: parseConfig

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def parseConfig (ofile):

        logger.info('\033[31m Parsing %s File \033[0m \n' % (ofile))
        cDict = {}
        parser = SafeConfigParser()
        parser.read(ofile)
        
        for section_name in parser.sections():
            for name, value in parser.items(section_name):
                cDict[name] = value

        return cDict
# -------------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:15,代码来源:array-xcross.py

示例8: readWaveformsPicker

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def readWaveformsPicker(station, tw, Origin, ttime):
    
    time = Origin.time
    ts   = time.split('T')
    
    datet = ts[0]
    datet = datet.split('-')
    year = datet[0].strip()
    month = datet[1]
    day = datet[2]
    julday = UTCDateTime(int(year), int(month), int(day)).julday
    julday = "%03d" % julday
    sdspath = os.path.join(os.getcwd(), year)

    if station.loc == '--':
        station.loc = ''
    streamData = station.net + '.' + station.sta + '.' + station.loc + '.' + station.comp + '.D.' + str(year) + '.' + str(julday)
    
    entry = os.path.join(sdspath, station.net, station.sta, station.comp + '.D', streamData)
    st = read(entry, format="MSEED", starttime=tw['start'], endtime=tw['end'], nearest_sample=True)
    if len(st.getGaps()) > 0:
        st.merge(method=0, fill_value='interpolate', interpolation_samples=0)
    
    stream = filterWaveform(st)
    print 'OVERALL: ', stream
    return stream
# -------------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:29,代码来源:array-xcross.py

示例9: readWaveformsCross

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def readWaveformsCross (station, tw, EventPath, Origin):
    
    time = Origin.time
    ts   = time.split('T')
    
    datet = ts[0]
    datet = datet.split('-')
    year  = datet[0].strip()
    month = datet[1]
    day   = datet[2]
   #timep = ts[1][:-1]
     
    print time,ts,year,month,day
    julday  = UTCDateTime(int(year),int(month),int(day)).julday
    julday  = "%03d" % julday
    sdspath = os.path.join(EventPath,'data',year)

    #Wdict = {}

    streamData = station.getName()+'.D.'+str(year)+'.'+str(julday)
    entry      = os.path.join (sdspath,station.net,station.sta,station.comp+'.D',streamData)
    print entry
    st         = read (entry,format="MSEED", starttime=tw['start'], endtime=tw['end'], nearest_sample=True)
    print st
    
    if len(st.getGaps()) > 0:
        st.merge(method=0, fill_value='interpolate', interpolation_samples=0)
        
    #Wdict[i.getName()] = st
    stream = st

    return stream
# -------------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:35,代码来源:filterStation.py

示例10: signoise

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def signoise(self,Waveform, ttime, path):
    
        st = str(self.Origin.time)[:-1]
        ponset = UTCDateTime(st) + ttime
    
        winnoise_start = Waveform.stats.starttime+20
        winnoise_end   = ponset - 10
        winsig_start   = ponset - 2
        winsig_end     = ponset + 10
        
        try:
           winnoise = read (path, format="MSEED", starttime=winnoise_start, endtime=winnoise_end, nearest_sample=True)
           #winnoise.write (('%s.mseed')%(path),format='MSEED')
           winsig   = read (path, format="MSEED", starttime=winsig_start, endtime=winsig_end, nearest_sample=True)
           #winsig.write(('s.mseed')%(path),format='MSEED')
            
        #except Exception, e:                          #hs : Syntax error in windows
        #   Logfile.exception (str (e))
        except :
            Logfile.exception ('signoise')

        psignal = abs(winsig.max()[0])
        pnoise  = abs(winnoise.max()[0])

        signoise = float(psignal) / float(pnoise)
#       print psignal, pnoise, signoise
    
        return signoise
    
    # --------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:32,代码来源:array_crosscorrelation_v4.py

示例11: readWaveformsCross

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def readWaveformsCross (self,station, tw, ttime):
    
        t2 = UTCDateTime(self.Origin.time)
        sdspath = os.path.join(self.EventPath,'data', str(t2.year))

        stream = ''
        snr = ''

        if station.loc == '--':
            station.loc = ''

        streamData = station.net + '.' + station.sta + '.' + station.loc + '.' + station.comp + '.D.' + str(t2.year) + '.' + str("%03d" % t2.julday)
        entry      = os.path.join (sdspath, station.net, station.sta, station.comp + '.D', streamData)
        st         = read (entry, format="MSEED", starttime=tw['start'], endtime=tw['end'], nearest_sample=True)
        
        if len(st.getGaps()) > 0:
            st.merge (method=0, fill_value='interpolate', interpolation_samples=0)
        
        snr  = self.signoise     (st[0], ttime, entry)
        #amp = self.maxAmplitude (st[0], ttime, Origin, entry)
        
        stream = self.filterWaveform(st)
        xname  = os.path.join(self.AF,(streamData+'_all.mseed'))
        stream.write (xname,format='MSEED')

        stream.trim (tw['xcorrstart'], tw['xcorrend'])
        stream[0].stats.starttime = UTCDateTime(3600)
        #stream.write(streamData,format='MSEED')
        stream[0].stats.starttime = UTCDateTime(1971, 1, 1, 1, 0)
        
        return stream, snr
   
    # --------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:35,代码来源:array_crosscorrelation_v4.py

示例12: readWaveformsCross

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def readWaveformsCross (self,station,tw):
        
        time = self.Origin.time
        ts   = time.split('T')
    
        datet  = ts[0]
        datet  = datet.split('-')
        year   = datet[0].strip()
        month  = datet[1]
        day    = datet[2]
        #timep = ts[1][:-1]
     
        julday  = UTCDateTime (int(year),int(month),int(day)).julday
        julday  = "%03d" % julday
        sdspath = os.path.join (self.EventPath,'data',year)

        if station.loc =='--':
            station.loc =''

        streamData = station.net+'.'+station.sta+'.'+station.loc+'.'+station.comp+'.D.'+str(year)+'.'+str(julday)
        entry      = os.path.join (sdspath,station.net,station.sta,station.comp+'.D',streamData)
        #print entry
        st = read (entry,format="MSEED", starttime=tw['start'], endtime=tw['end'], nearest_sample=True)
        #print st
        
        if len (st.getGaps()) > 0:
            st.merge (method=0, fill_value='interpolate', interpolation_samples=0)

        st[0].stats.starttime = UTCDateTime(1000)

        stream = self.filterWaveform(st)
        return stream
    # ---------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:35,代码来源:xcorrfilter.py

示例13: proof_file_v3

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def proof_file_v3 (filename,component):
    
    if len(filename) == 0 : return 0          #hs

    print 'PROOF FILE V3 ',filename

    size       = 0
    streamList = []
    t          = filename[0]
    savename   = '{n}.{s}.{l}.ms'.format (n=t.stats.network, s=t.stats.station,l=t.stats.location)

    filename.write (savename, format='MSEED', reclen=512)
          
    try:
       st = read (savename)

       for i in st : streamList.append (i.stats.channel)
 
       print 'CHANNEL: ',len(streamList),len(component)

       if len (set(streamList)) == len(component) :
          #to_sds    (savename)                      #hs
          #multiplex (filename)                      #hs
          multiplex (savename)                       #hs
          size = os.path.getsize (savename)

       else:                                          
          #size = 0                                  #hs
          multiplex (savename)                       #hs
          size = os.path.getsize (savename)          #hs

    except :
       size = 0
       Logfile.exception ('proof_file_v3')           

    os.remove (savename)
    return size

# ------------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:41,代码来源:getStationWaveformData.py

示例14: globalConf

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def globalConf():

    cDict  = {}
    parser = SafeConfigParser()
    parser.read (os.path.join ('..', 'global.conf'))

    for section_name in parser.sections():
        for name, value in parser.items(section_name) : cDict[name] = value

    return cDict

# ------------------------------------------------------------------------------------------------- 
开发者ID:braunfuss,项目名称:bat,代码行数:14,代码来源:getStationWaveformData.py

示例15: globalConf

# 需要导入模块: from obspy import core [as 别名]
# 或者: from obspy.core import read [as 别名]
def globalConf():
    cDict = {}
    parser = SafeConfigParser()
    parser.read('../global.conf')
    for section_name in parser.sections():
        for name, value in parser.items(section_name):
            cDict[name]=value
    return cDict 
开发者ID:braunfuss,项目名称:bat,代码行数:10,代码来源:ev_wave_mt4.py


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