本文整理汇总了Python中shake_event.ShakeEvent.render_map方法的典型用法代码示例。如果您正苦于以下问题:Python ShakeEvent.render_map方法的具体用法?Python ShakeEvent.render_map怎么用?Python ShakeEvent.render_map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shake_event.ShakeEvent
的用法示例。
在下文中一共展示了ShakeEvent.render_map方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_event
# 需要导入模块: from shake_event import ShakeEvent [as 别名]
# 或者: from shake_event.ShakeEvent import render_map [as 别名]
def process_event(event_id=None, locale="en"):
"""Launcher that actually runs the event processing.
:param event_id: The event id to process. If None the latest event will
be downloaded and processed.
:type event_id: str
:param locale: The locale that will be used. Default to en.
:type locale: str
"""
population_path = os.path.join(data_dir(), "exposure", "IDN_mosaic", "popmap10_all.tif")
# Use cached data where available
# Whether we should always regenerate the products
force_flag = False
if "INASAFE_FORCE" in os.environ:
force_string = os.environ["INASAFE_FORCE"]
if str(force_string).capitalize() == "Y":
force_flag = True
# We always want to generate en products too so we manipulate the locale
# list and loop through them:
locale_list = [locale]
if "en" not in locale_list:
locale_list.append("en")
# Now generate the products
for locale in locale_list:
# Extract the event
# noinspection PyBroadException
try:
if os.path.exists(population_path):
shake_event = ShakeEvent(
event_id=event_id, locale=locale, force_flag=force_flag, population_raster_path=population_path
)
else:
shake_event = ShakeEvent(event_id=event_id, locale=locale, force_flag=force_flag)
except (BadZipfile, URLError):
# retry with force flag true
if os.path.exists(population_path):
shake_event = ShakeEvent(
event_id=event_id, locale=locale, force_flag=True, population_raster_path=population_path
)
else:
shake_event = ShakeEvent(event_id=event_id, locale=locale, force_flag=True)
except:
LOGGER.exception("An error occurred setting up the shake event.")
return
LOGGER.info("Event Id: %s", shake_event)
LOGGER.info("-------------------------------------------")
shake_event.render_map(force_flag)
示例2: ShakeGridConverter
# 需要导入模块: from shake_event import ShakeEvent [as 别名]
# 或者: from shake_event.ShakeEvent import render_map [as 别名]
# theEventId=myId,
# theLocale='en',
# theForceFlag=False,
# theDataIsLocalFlag=True)
# myShakeEvent.render_map(theForceFlag=False)
#
# myId = '20120118231552_se'
# myShakeEvent = ShakeGridConverter(
# theEventId=myId,
# theLocale='en',
# theForceFlag=False,
# theDataIsLocalFlag=True)
# myShakeEvent.render_map(theForceFlag=False)
#
#
# myId = '20120118231562_se'
# myShakeEvent = ShakeGridConverter(
# theEventId=myId,
# theLocale='en',
# theForceFlag=False,
# theDataIsLocalFlag=True)
# myShakeEvent.render_map(theForceFlag=False)
myId = '20130224200633'
myShakeEvent = ShakeEvent(
event_id=myId,
locale='en',
force_flag=False,
data_is_local_flag=True)
myShakeEvent.render_map(force_flag=False)
示例3: ShakeEvent
# 需要导入模块: from shake_event import ShakeEvent [as 别名]
# 或者: from shake_event.ShakeEvent import render_map [as 别名]
# coding=utf-8
"""Simple helper for when you already have the grid.xml and just want a map."""
#Tim Sutton, April 2013.
from shake_event import ShakeEvent
if __name__ == '__main__':
SHAKE_ID = '20131105060809'
# To ensure that realtime is working for not just en locale, use other
# locale here to test realtime
locales = ['en', 'id']
for locale in locales:
shake_event = ShakeEvent(
event_id=SHAKE_ID,
locale=locale,
force_flag=False,
data_is_local_flag=True)
shake_event.render_map(force_flag=False)