本文整理汇总了Python中shake_event.ShakeEvent.calculateImpacts方法的典型用法代码示例。如果您正苦于以下问题:Python ShakeEvent.calculateImpacts方法的具体用法?Python ShakeEvent.calculateImpacts怎么用?Python ShakeEvent.calculateImpacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shake_event.ShakeEvent
的用法示例。
在下文中一共展示了ShakeEvent.calculateImpacts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testFatalitiesTable
# 需要导入模块: from shake_event import ShakeEvent [as 别名]
# 或者: from shake_event.ShakeEvent import calculateImpacts [as 别名]
def testFatalitiesTable(self):
"""Test rendering a fatalities table."""
myShakeId = '20120726022003'
myShakeEvent = ShakeEvent(myShakeId)
myShakeEvent.calculateImpacts()
myResult = myShakeEvent.impactTable()
# TODO compare actual content of impact table...
myExpectedResult = ('/tmp/inasafe/realtime/shakemaps-extracted/'
'20120726022003/impacts.html')
myMessage = ('Got:\n%s\nExpected:\n%s' %
(myResult, myExpectedResult))
assert myResult == myExpectedResult, myMessage
示例2: testCalculateFatalities
# 需要导入模块: from shake_event import ShakeEvent [as 别名]
# 或者: from shake_event.ShakeEvent import calculateImpacts [as 别名]
def testCalculateFatalities(self):
"""Test that we can calculate fatalities."""
LOGGER.debug(QGISAPP.showSettings())
myShakeId = '20120726022003'
myShakeEvent = ShakeEvent(myShakeId)
myResult, myFatalitiesHtml = myShakeEvent.calculateImpacts()
myExpectedResult = (
'/tmp/inasafe/realtime/shakemaps-extracted'
'/20120726022003/impact-nearest.tif')
myMessage = 'Got:\n%s\nExpected:\n%s\n' % (myResult, myExpectedResult)
assert myResult == myExpectedResult, myMessage
myExpectedResult = (
'/tmp/inasafe/realtime/shakemaps-extracted'
'/20120726022003/impacts.html')
myMessage = 'Got:\n%s\nExpected:\n%s\n' % (
myFatalitiesHtml,
myExpectedResult)
assert myFatalitiesHtml == myExpectedResult, myMessage
myExpectedFatalities = {2: 0.0, # rounded from 0.47386375223673427,
3: 0.0, # rounded from 0.024892573693488258,
4: 0.0,
5: 0.0,
6: 0.0,
7: 0.0,
8: 0.0,
9: 0.0}
myMessage = 'Got:\n%s\nExpected:\n%s\n' % (
myShakeEvent.fatalityCounts, myExpectedFatalities)
assert myShakeEvent.fatalityCounts == myExpectedFatalities, myMessage