本文整理汇总了Python中realtime.shake_data.ShakeData.fetch_event方法的典型用法代码示例。如果您正苦于以下问题:Python ShakeData.fetch_event方法的具体用法?Python ShakeData.fetch_event怎么用?Python ShakeData.fetch_event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类realtime.shake_data.ShakeData
的用法示例。
在下文中一共展示了ShakeData.fetch_event方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_remote_shake_map
# 需要导入模块: from realtime.shake_data import ShakeData [as 别名]
# 或者: from realtime.shake_data.ShakeData import fetch_event [as 别名]
def test_get_remote_shake_map(self):
"""Check that we can retrieve both input and output from ftp at once.
"""
shake_data = ShakeData(SHAKE_ID)
expected_input_file = os.path.join(
shakemap_zip_dir(), SHAKE_ID + '.inp.zip')
expected_output_file = os.path.join(
shakemap_zip_dir(), SHAKE_ID + '.out.zip')
if os.path.exists(expected_input_file):
os.remove(expected_input_file)
if os.path.exists(expected_output_file):
os.remove(expected_output_file)
input_file, output_file = shake_data.fetch_event()
message = ('Expected path for downloaded shakemap INP not received'
'\nExpected: %s\nGot: %s' %
(expected_output_file, output_file))
self.assertEqual(input_file, expected_input_file, message)
message = ('Expected path for downloaded shakemap OUT not received'
'\nExpected: %s\nGot: %s' %
(expected_output_file, output_file))
self.assertEqual(output_file, expected_output_file, message)
self.assertTrue(os.path.exists(expected_input_file))
self.assertTrue(os.path.exists(expected_output_file))
示例2: test_get_latest_shake_map
# 需要导入模块: from realtime.shake_data import ShakeData [as 别名]
# 或者: from realtime.shake_data.ShakeData import fetch_event [as 别名]
def test_get_latest_shake_map(self):
"""Check that we can retrieve the latest shake event."""
# Simply dont set the event id in the ctor to get the latest
shake_data = ShakeData()
input_file, output_file = shake_data.fetch_event()
event_id = shake_data.event_id
expected_input_file = os.path.join(shakemap_zip_dir(),
event_id + '.inp.zip')
expected_output_file = os.path.join(shakemap_zip_dir(),
event_id + '.out.zip')
message = ('Expected path for downloaded shakemap INP not received'
'\nExpected: %s\nGot: %s' %
(expected_output_file, output_file))
self.assertEqual(input_file, expected_input_file, message)
message = ('Expected path for downloaded shakemap OUT not received'
'\nExpected: %s\nGot: %s' %
(expected_output_file, output_file))
self.assertEqual(output_file, expected_output_file, message)
示例3: test_get_cached_shake_map
# 需要导入模块: from realtime.shake_data import ShakeData [as 别名]
# 或者: from realtime.shake_data.ShakeData import fetch_event [as 别名]
def test_get_cached_shake_map(self):
"""Check that we can retrieve both input and output from ftp at once"""
shake_event = '20120726022003'
expected_input_file = os.path.join(shakemap_zip_dir(),
shake_event + '.inp.zip')
expected_output_file = os.path.join(shakemap_zip_dir(),
shake_event + '.out.zip')
shake_data = ShakeData(shake_event)
input_file, output_file = shake_data.fetch_event()
message = ('Expected path for downloaded shakemap INP not received'
'\nExpected: %s\nGot: %s' %
(expected_output_file, output_file))
self.assertEqual(input_file, expected_input_file, message)
message = ('Expected path for downloaded shakemap OUT not received'
'\nExpected: %s\nGot: %s' %
(expected_output_file, output_file))
self.assertEqual(output_file, expected_output_file, message)