當前位置: 首頁>>代碼示例>>Python>>正文


Python Client.sacpz方法代碼示例

本文整理匯總了Python中obspy.iris.Client.sacpz方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.sacpz方法的具體用法?Python Client.sacpz怎麽用?Python Client.sacpz使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在obspy.iris.Client的用法示例。


在下文中一共展示了Client.sacpz方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_sacpz

# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import sacpz [as 別名]
 def test_sacpz(self):
     """
     Fetches SAC poles and zeros information.
     """
     client = Client()
     # 1
     t1 = UTCDateTime("2005-01-01")
     t2 = UTCDateTime("2008-01-01")
     result = client.sacpz("IU", "ANMO", "00", "BHZ", t1, t2)
     # drop lines with creation date (current time during request)
     result = result.splitlines()
     sacpz_file = os.path.join(self.path, "data", "IU.ANMO.00.BHZ.sacpz")
     expected = open(sacpz_file, "rt").read().splitlines()
     result.pop(5)
     expected.pop(5)
     self.assertEquals(result, expected)
     # 2 - empty location code
     dt = UTCDateTime("2002-11-01")
     result = client.sacpz("UW", "LON", "", "BHZ", dt)
     self.assertTrue("* STATION    (KSTNM): LON" in result)
     self.assertTrue("* LOCATION   (KHOLE):   " in result)
     # 3 - empty location code via '--'
     result = client.sacpz("UW", "LON", "--", "BHZ", dt)
     self.assertTrue("* STATION    (KSTNM): LON" in result)
     self.assertTrue("* LOCATION   (KHOLE):   " in result)
開發者ID:egdorf,項目名稱:obspy,代碼行數:27,代碼來源:test_client.py

示例2: wavesdownloader

# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import sacpz [as 別名]

#.........這裏部分代碼省略.........
       (respFiles, pazFiles) = extractResponse(args.fsfile,args.res,args.outdir)
       if args.res == "2" or args.res == "3":
          dataStreamLoca = addPazStats(dataStreamLoca,args.outdir,pazFiles)
       dataStreamLoca = updateStats(dataStreamLoca,args.outdir,"rdseed.stations",ev_lat,ev_lon)
       dataStreamLoca = purgeListStation(dataStreamLoca,args,'d')
       shutil.move(args.outdir + os.sep + 'rdseed.stations',args.outdir + os.sep + 'local_rdseed.stations')   
    
    # iris - longer
    if args.server[1] == 1:
       pazFiles = []
       temp_iris = open(args.outdir + os.sep + "tmp_iris.station","w")   
       # here store lat lon staz locId for later update of iris stream
    
       for i in range(len(dataStreamIris)):
         n = dataStreamIris[i].stats['network']
         s = dataStreamIris[i].stats['station']
         l = dataStreamIris[i].stats['location']
         c = dataStreamIris[i].stats['channel']
         nameresp = "RESP." + n + "." + s + "." + l + "." + c 
         namepaz  = "SAC.PZs." + n + "." + s + "." + c
    
         # get metadata station latitude and longitude
         meta = irisClient.station(network=n, station=s, location=l, channel=c, starttime=t1, endtime=t2)
         (lat,lon) = getXmlTagData(meta)
         # update temp_iris
         temp_iris.write(s + " " + n + " " + lat + " " + lon + "0.0\n")
    
         # write resp files
         if args.res == "1" or args.res == "3":
             irisClient.saveResponse(filename=args.outdir + os.sep + nameresp ,network=n, station=s, location=args.loc, channel=c,\
                 starttime=t1, endtime=t2, format='RESP')
    
         if args.res == "2" or args.res == "3":
             sacpz = irisClient.sacpz(network=n, station=s, location=args.loc, channel=c, starttime=t1, endtime=t2)
             sacpz = sac4sac(sacpz)
             f = open(args.outdir + os.sep + namepaz, 'w')
             f.write(sacpz)
             f.close()     # close close close!!!! porcoIddio che mi dimentico sempre!!!
             pazFiles.append(namepaz)
    
       # lose temp_iris
       temp_iris.close()
       
       # update stream
       dataStreamIris = updateStats(dataStreamIris,args.outdir,"tmp_iris.station",ev_lat,ev_lon)
       if args.res == '2' or  args.res == '3':
          dataStreamIris = addPazStats(dataStreamIris,args.outdir,pazFiles)

    if args.server[3] == 1:

       # Write webdc.stations file and extract PZ file
       #   and update lat lon and event loc into statz for consistency
       dataStreamWbDc=writeWbDcStation(dataStreamWbDc,args)

       if args.res == "2" or args.res == "3":
           PzFileFromStat(dataStreamWbDc,args)
           print "\nWarning, RESP files can not be downloaded from WebDC vie ArcLink\n"
       if args.res == "1":
           print "\nWarning, RESP files can not be downloaded from WebDC vie ArcLink\n"

    #############################################################
    ## ---- G. Join all traces and write mseed files with original data
    for i in range(len(dataStreamEida)):
           dataStream.append(dataStreamEida[i])
    for i in range(len(dataStreamIris)):
           dataStream.append(dataStreamIris[i])
開發者ID:fabriziobernardi,項目名稱:wavesdownloader,代碼行數:70,代碼來源:func_wd.py


注:本文中的obspy.iris.Client.sacpz方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。