本文整理汇总了Python中openquake.baselib.general.AccumDict.siteslice方法的典型用法代码示例。如果您正苦于以下问题:Python AccumDict.siteslice方法的具体用法?Python AccumDict.siteslice怎么用?Python AccumDict.siteslice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openquake.baselib.general.AccumDict
的用法示例。
在下文中一共展示了AccumDict.siteslice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: classical
# 需要导入模块: from openquake.baselib.general import AccumDict [as 别名]
# 或者: from openquake.baselib.general.AccumDict import siteslice [as 别名]
def classical(sources, sitecol, siteidx, rlzs_assoc, monitor):
"""
:param sources:
a non-empty sequence of sources of homogeneous tectonic region type
:param sitecol:
a SiteCollection instance
:param siteidx:
index of the first site (0 if there is a single tile)
:param rlzs_assoc:
a RlzsAssoc instance
:param monitor:
a monitor instance
:returns:
an AccumDict rlz -> curves
"""
truncation_level = monitor.oqparam.truncation_level
imtls = monitor.oqparam.imtls
trt_model_id = sources[0].trt_model_id
# sanity check: the trt_model must be the same for all sources
for src in sources[1:]:
assert src.trt_model_id == trt_model_id
gsims = rlzs_assoc.gsims_by_trt_id[trt_model_id]
trt = sources[0].tectonic_region_type
try:
max_dist = monitor.oqparam.maximum_distance[trt]
except KeyError:
max_dist = monitor.oqparam.maximum_distance['default']
dic = AccumDict()
dic.siteslice = slice(siteidx, siteidx + len(sitecol))
if monitor.oqparam.poes_disagg:
sm_id = rlzs_assoc.get_sm_id(trt_model_id)
dic.bbs = [BoundingBox(sm_id, sid) for sid in sitecol.sids]
else:
dic.bbs = []
# NB: the source_site_filter below is ESSENTIAL for performance inside
# hazard_curves_per_trt, since it reduces the full site collection
# to a filtered one *before* doing the rupture filtering
curves_by_gsim = hazard_curves_per_trt(
sources, sitecol, imtls, gsims, truncation_level,
source_site_filter=source_site_distance_filter(max_dist),
maximum_distance=max_dist, bbs=dic.bbs, monitor=monitor)
dic.calc_times = monitor.calc_times # added by hazard_curves_per_trt
dic.eff_ruptures = {trt_model_id: monitor.eff_ruptures} # idem
for gsim, curves in zip(gsims, curves_by_gsim):
dic[trt_model_id, str(gsim)] = curves
return dic