当前位置: 首页>>代码示例>>Python>>正文


Python ShakeEvent.calculateImpacts方法代码示例

本文整理汇总了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
开发者ID:gijs,项目名称:inasafe,代码行数:14,代码来源:test_shake_event.py

示例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
开发者ID:maning,项目名称:inasafe,代码行数:36,代码来源:test_shake_event.py


注:本文中的shake_event.ShakeEvent.calculateImpacts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。