本文整理汇总了Python中shake_event.ShakeEvent.eventDict方法的典型用法代码示例。如果您正苦于以下问题:Python ShakeEvent.eventDict方法的具体用法?Python ShakeEvent.eventDict怎么用?Python ShakeEvent.eventDict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shake_event.ShakeEvent
的用法示例。
在下文中一共展示了ShakeEvent.eventDict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testEventInfoDict
# 需要导入模块: from shake_event import ShakeEvent [as 别名]
# 或者: from 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)