當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。