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


Python ShakeEvent.renderMap方法代码示例

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


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

示例1: processEvent

# 需要导入模块: from shake_event import ShakeEvent [as 别名]
# 或者: from shake_event.ShakeEvent import renderMap [as 别名]
def processEvent(theEventId=None, theLocale='en'):
    """Launcher that actually runs the event processing."""
    myPopulationPath = os.path.join(
        dataDir(),
        'exposure',
        'IDN_mosaic',
        'popmap10_all.tif')

    # Use cached data where available
    # Whether we should always regenerate the products
    myForceFlag = False
    if 'INASAFE_FORCE' in os.environ:
        myForceString = os.environ['INASAFE_FORCE']
        if str(myForceString).capitalize() == 'Y':
            myForceFlag = True

    # We always want to generate en products too so we manipulate the locale
    # list and loop through them:
    myLocaleList = [theLocale]
    if 'en' not in myLocaleList:
        myLocaleList.append('en')

    # Now generate the products
    for myLoc in myLocaleList:
        # Extract the event
        # noinspection PyBroadException
        try:
            if os.path.exists(myPopulationPath):
                myShakeEvent = ShakeEvent(
                    theEventId=theEventId,
                    theLocale=myLoc,
                    theForceFlag=myForceFlag,
                    thePopulationRasterPath=myPopulationPath)
            else:
                myShakeEvent = ShakeEvent(
                    theEventId=theEventId,
                    theLocale=myLoc,
                    theForceFlag=myForceFlag)
        except (BadZipfile, URLError):
            # retry with force flag true
            if os.path.exists(myPopulationPath):
                myShakeEvent = ShakeEvent(
                    theEventId=theEventId,
                    theLocale=myLoc,
                    theForceFlag=True,
                    thePopulationRasterPath=myPopulationPath)
            else:
                myShakeEvent = ShakeEvent(
                    theEventId=theEventId,
                    theLocale=myLoc,
                    theForceFlag=True)
        except:
            LOGGER.exception('An error occurred setting up the shake event.')
            return

        LOGGER.info('Event Id: %s', myShakeEvent)
        LOGGER.info('-------------------------------------------')

        myShakeEvent.renderMap(myForceFlag)
开发者ID:jeanette18,项目名称:inasafe,代码行数:61,代码来源:make_map.py

示例2: ShakeEvent

# 需要导入模块: from shake_event import ShakeEvent [as 别名]
# 或者: from shake_event.ShakeEvent import renderMap [as 别名]
# Simple helper for when you already have the grid.xml and you just want a
# map.
#
# Tim Sutton, April 2013

from shake_event import ShakeEvent
myId = '20120118231542_se'
myShakeEvent = ShakeEvent(
    theEventId=myId,
    theLocale='id',
    theForceFlag=False,
    theDataIsLocalFlag=True)
myShakeEvent.renderMap(theForceFlag=False)

myId = '20120118231552_se'
myShakeEvent = ShakeEvent(
    theEventId=myId,
    theLocale='id',
    theForceFlag=False,
    theDataIsLocalFlag=True)
myShakeEvent.renderMap(theForceFlag=False)


myId = '20120118231562_se'
myShakeEvent = ShakeEvent(
    theEventId=myId,
    theLocale='id',
    theForceFlag=False,
    theDataIsLocalFlag=True)
myShakeEvent.renderMap(theForceFlag=False)
开发者ID:nadyaoktaviani,项目名称:inasafe,代码行数:32,代码来源:make_local_map.py


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