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


Python ShakeEvent.eventDict方法代码示例

本文整理汇总了Python中realtime.shake_event.ShakeEvent.eventDict方法的典型用法代码示例。如果您正苦于以下问题:Python ShakeEvent.eventDict方法的具体用法?Python ShakeEvent.eventDict怎么用?Python ShakeEvent.eventDict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在realtime.shake_event.ShakeEvent的用法示例。


在下文中一共展示了ShakeEvent.eventDict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testEventInfoDict

# 需要导入模块: from realtime.shake_event import ShakeEvent [as 别名]
# 或者: from realtime.shake_event.ShakeEvent import eventDict [as 别名]
 def testEventInfoDict(self):
     """Test we can get a dictionary of location info nicely."""
     myShakeId = '20120726022003'
     myShakeEvent = ShakeEvent(myShakeId)
     myResult = myShakeEvent.eventDict()
     myExpectedDict = {'place-name': PyQt4.QtCore.QString(u'n/a'),
                       'depth-name': PyQt4.QtCore.QString(u'Depth'),
                       'fatalities-name': PyQt4.QtCore.QString(
                           u'Estimated fatalities'),
                       'fatalities-count': u'0',  # 44 only after render
                       'elapsed-time': u'',  # empty as it will change
                       'legend-name': PyQt4.QtCore.QString(
                           u'Population density'),
                       'fatalities-range': '0 - 100',
                       'longitude-name': PyQt4.QtCore.QString(u'Longitude'),
                       'located-label': PyQt4.QtCore.QString(u'Located'),
                       'distance-unit': PyQt4.QtCore.QString(u'km'),
                       'bearing-compass': u'n/a',
                       'elapsed-time-name': PyQt4.QtCore.QString(
                           u'Elapsed time since event'),
                       'exposure-table-name': PyQt4.QtCore.QString(
                           u'Estimated number of people affected by each '
                           u'MMI level'),
                       'longitude-value': u'124\xb027\'0.00"E',
                       'city-table-name': PyQt4.QtCore.QString(
                           u'Places Affected'),
                       'bearing-text': PyQt4.QtCore.QString(u'bearing'),
                       'limitations': PyQt4.QtCore.QString(
                           u'This impact estimation is automatically '
                           u'generated and only takes into account the '
                           u'population and cities affected by different '
                           u'levels of ground shaking. The estimate is '
                           u'based on ground shaking data from BMKG, '
                           u'population density data from asiapop.org, '
                           u'place information from geonames.org and '
                           u'software developed by BNPB. Limitations in '
                           u'the estimates of ground shaking, '
                           u'population  data and place names datasets may'
                           u' result in significant misrepresentation of '
                           u'the on-the-ground situation in the figures '
                           u'shown here. Consequently decisions should not'
                           u' be made solely on the information presented '
                           u'here and should always be verified by ground '
                           u'truthing and other reliable information '
                           u'sources. The fatality calculation assumes '
                           u'that no fatalities occur for shake levels '
                           u'below MMI 4. Fatality counts of less than 50 '
                           u'are disregarded.'),
                       'depth-unit': PyQt4.QtCore.QString(u'km'),
                       'latitude-name': PyQt4.QtCore.QString(u'Latitude'),
                       'mmi': '5.0', 'map-name': PyQt4.QtCore.QString(
                       u'Estimated Earthquake Impact'), 'date': '26-7-2012',
                       'bearing-degrees': '0.00\xb0',
                       'formatted-date-time': '26-Jul-12 02:15:35 ',
                       'distance': '0.00',
                       'direction-relation': PyQt4.QtCore.QString(u'of'),
                       'credits': PyQt4.QtCore.QString(
                           u'Supported by the Australia-Indonesia Facility'
                           u' for Disaster Reduction, Geoscience Australia '
                           u'and the World Bank-GFDRR.'),
                       'latitude-value': u'0\xb012\'36.00"S',
                       'time': '2:15:35', 'depth-value': '11.0'}
     myResult['elapsed-time'] = u''
     myMessage = 'Got:\n%s\nExpected:\n%s\n' % (myResult, myExpectedDict)
     self.maxDiff = None
     myDifference = DictDiffer(myResult, myExpectedDict)
     print myDifference.all()
     self.assertDictEqual(myExpectedDict, myResult, myMessage)
开发者ID:dichapabe,项目名称:inasafe,代码行数:70,代码来源:test_shake_event.py


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