本文整理匯總了Python中obspy.iris.Client.evalresp方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.evalresp方法的具體用法?Python Client.evalresp怎麽用?Python Client.evalresp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類obspy.iris.Client
的用法示例。
在下文中一共展示了Client.evalresp方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_evalresp
# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import evalresp [as 別名]
def test_evalresp(self):
"""
Tests evaluating instrument response information.
"""
client = Client()
dt = UTCDateTime("2005-01-01")
# plot as PNG file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU", station="ANMO", location="00", channel="BHZ", time=dt, output="plot", filename=tempfile
)
self.assertEqual(open(tempfile, "rb").read(4)[1:4], "PNG")
os.remove(tempfile)
# plot-amp as PNG file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU", station="ANMO", location="00", channel="BHZ", time=dt, output="plot-amp", filename=tempfile
)
self.assertEqual(open(tempfile, "rb").read(4)[1:4], "PNG")
os.remove(tempfile)
# plot-phase as PNG file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU", station="ANMO", location="00", channel="BHZ", time=dt, output="plot-phase", filename=tempfile
)
self.assertEqual(open(tempfile, "rb").read(4)[1:4], "PNG")
os.remove(tempfile)
# fap as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU", station="ANMO", location="00", channel="BHZ", time=dt, output="fap", filename=tempfile
)
self.assertEqual(open(tempfile, "rt").readline(), "1.000000E-05 1.202802E+04 1.792007E+02\n")
os.remove(tempfile)
# cs as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU", station="ANMO", location="00", channel="BHZ", time=dt, output="cs", filename=tempfile
)
self.assertEqual(open(tempfile, "rt").readline(), "1.000000E-05 -1.202685E+04 1.677835E+02\n")
os.remove(tempfile)
# fap & def as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU",
station="ANMO",
location="00",
channel="BHZ",
time=dt,
output="fap",
units="def",
filename=tempfile,
)
self.assertEqual(open(tempfile, "rt").readline(), "1.000000E-05 1.202802E+04 1.792007E+02\n")
os.remove(tempfile)
# fap & dis as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU",
station="ANMO",
location="00",
channel="BHZ",
time=dt,
output="fap",
units="dis",
filename=tempfile,
)
self.assertEqual(open(tempfile, "rt").readline(), "1.000000E-05 7.557425E-01 2.692007E+02\n")
os.remove(tempfile)
# fap & vel as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU",
station="ANMO",
location="00",
channel="BHZ",
time=dt,
output="fap",
units="vel",
filename=tempfile,
)
self.assertEqual(open(tempfile, "rt").readline(), "1.000000E-05 1.202802E+04 1.792007E+02\n")
os.remove(tempfile)
# fap & acc as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(
network="IU",
station="ANMO",
location="00",
channel="BHZ",
time=dt,
output="fap",
units="acc",
filename=tempfile,
)
self.assertEqual(open(tempfile, "rt").readline(), "1.000000E-05 1.914318E+08 8.920073E+01\n")
os.remove(tempfile)
# fap as NumPy ndarray
data = client.evalresp(network="IU", station="ANMO", location="00", channel="BHZ", time=dt, output="fap")
np.testing.assert_array_equal(data[0], [1.00000000e-05, 1.20280200e04, 1.79200700e02])
#.........這裏部分代碼省略.........
示例2: Client
# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import evalresp [as 別名]
from obspy.iris import Client
import numpy as np
import matplotlib.pyplot as plt
from obspy.core import UTCDateTime
from obspy.signal import cornFreq2Paz, seisSim
client = Client()
# dt = UTCDateTime(2005, 4, 26, 21, 0, 0, 31225480)
dt = UTCDateTime("2006-5-26")
data = client.evalresp("TA", "M03C", "--", "BHE", dt)
# data[0]
示例3: test_evalresp
# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import evalresp [as 別名]
def test_evalresp(self):
"""
Tests evaluating instrument response information.
"""
client = Client()
dt = UTCDateTime("2005-01-01")
# plot as PNG file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='plot',
filename=tempfile)
self.assertEqual(open(tempfile, 'rb').read(4)[1:4], 'PNG')
os.remove(tempfile)
# plot-amp as PNG file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='plot-amp',
filename=tempfile)
self.assertEqual(open(tempfile, 'rb').read(4)[1:4], 'PNG')
os.remove(tempfile)
# plot-phase as PNG file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='plot-phase',
filename=tempfile)
self.assertEqual(open(tempfile, 'rb').read(4)[1:4], 'PNG')
os.remove(tempfile)
# fap as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap',
filename=tempfile)
self.assertEqual(open(tempfile, 'rt').readline(),
'1.000000E-05 1.202802E+04 1.792007E+02\n')
os.remove(tempfile)
# cs as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='cs',
filename=tempfile)
self.assertEqual(open(tempfile, 'rt').readline(),
'1.000000E-05 -1.202685E+04 1.677835E+02\n')
os.remove(tempfile)
# fap & def as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap', units='def',
filename=tempfile)
self.assertEqual(open(tempfile, 'rt').readline(),
'1.000000E-05 1.202802E+04 1.792007E+02\n')
os.remove(tempfile)
# fap & dis as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap', units='dis',
filename=tempfile)
self.assertEqual(open(tempfile, 'rt').readline(),
'1.000000E-05 7.557425E-01 2.692007E+02\n')
os.remove(tempfile)
# fap & vel as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap', units='vel',
filename=tempfile)
self.assertEqual(open(tempfile, 'rt').readline(),
'1.000000E-05 1.202802E+04 1.792007E+02\n')
os.remove(tempfile)
# fap & acc as ASCII file
tempfile = NamedTemporaryFile().name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap', units='acc',
filename=tempfile)
self.assertEqual(open(tempfile, 'rt').readline(),
'1.000000E-05 1.914318E+08 8.920073E+01\n')
os.remove(tempfile)
# fap as NumPy ndarray
data = client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap')
np.testing.assert_array_equal(data[0],
[1.00000000e-05, 1.20280200e+04, 1.79200700e+02])
# cs as NumPy ndarray
data = client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='cs')
np.testing.assert_array_equal(data[0],
[1.00000000e-05, -1.20268500e+04, 1.67783500e+02])
示例4: test_evalresp
# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import evalresp [as 別名]
def test_evalresp(self):
"""
Tests evaluating instrument response information.
"""
client = Client()
dt = UTCDateTime("2005-01-01")
# plot as PNG file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='plot',
filename=tempfile)
with open(tempfile, 'rb') as fp:
self.assertEqual(fp.read(4)[1:4], b'PNG')
# plot-amp as PNG file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='plot-amp',
filename=tempfile)
with open(tempfile, 'rb') as fp:
self.assertEqual(fp.read(4)[1:4], b'PNG')
# plot-phase as PNG file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='plot-phase',
filename=tempfile)
with open(tempfile, 'rb') as fp:
self.assertEqual(fp.read(4)[1:4], b'PNG')
# fap as ASCII file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap',
filename=tempfile)
with open(tempfile, 'rt') as fp:
self.assertEqual(fp.readline(),
'1.000000E-05 1.055999E+04 1.792007E+02\n')
# cs as ASCII file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='cs',
filename=tempfile)
with open(tempfile, 'rt') as fp:
self.assertEqual(fp.readline(),
'1.000000E-05 -1.055896E+04 1.473054E+02\n')
# fap & def as ASCII file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap', units='def',
filename=tempfile)
with open(tempfile, 'rt') as fp:
self.assertEqual(fp.readline(),
'1.000000E-05 1.055999E+04 1.792007E+02\n')
# fap & dis as ASCII file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap', units='dis',
filename=tempfile)
with open(tempfile, 'rt') as fp:
self.assertEqual(fp.readline(),
'1.000000E-05 6.635035E-01 2.692007E+02\n')
# fap & vel as ASCII file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap', units='vel',
filename=tempfile)
with open(tempfile, 'rt') as fp:
self.assertEqual(fp.readline(),
'1.000000E-05 1.055999E+04 1.792007E+02\n')
# fap & acc as ASCII file
with NamedTemporaryFile() as tf:
tempfile = tf.name
client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap', units='acc',
filename=tempfile)
with open(tempfile, 'rt') as fp:
self.assertEqual(fp.readline(),
'1.000000E-05 1.680674E+08 8.920073E+01\n')
# fap as NumPy ndarray
data = client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='fap')
np.testing.assert_array_equal(
data[0], [1.00000000e-05, 1.05599900e+04, 1.79200700e+02])
# cs as NumPy ndarray
data = client.evalresp(network="IU", station="ANMO", location="00",
channel="BHZ", time=dt, output='cs')
np.testing.assert_array_equal(
data[0], [1.00000000e-05, -1.05589600e+04, 1.47305400e+02])