Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion openquake/calculators/preclassical.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from openquake.commonlib import readinput
from openquake.calculators import base

MAX_NUM_RUPTURES = 27_000 # so that the drouet calculation runs
U16 = numpy.uint16
U32 = numpy.uint32
F32 = numpy.float32
Expand Down Expand Up @@ -98,7 +99,8 @@ def _filter_mag(srcs, min_mag):
mmag = getdefault(min_mag, srcs[0].tectonic_region_type)
out = [src for src in srcs if src.get_mags()[-1] >= mmag]
for ss in out:
ss.num_ruptures
if ss.num_ruptures > MAX_NUM_RUPTURES:
raise RuntimeError('%s has too many ruptures' % ss)
return out


Expand Down
2 changes: 1 addition & 1 deletion openquake/hazardlib/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ def estimate_weight(self, src, srcfilter):
# may happen for CollapsedPointSources
return EPS
src.nsites = len(sites)
step = 1 if src.code in b'pP' else 4
step = 1 if src.code in b'pP' else max(src.num_ruptures // 100, 4)
C = sum(len(ctx) for ctx in self.get_ctxs(src, sites, step=step))
src.dt = time.time() - t0
if not C:
Expand Down
4 changes: 2 additions & 2 deletions openquake/hazardlib/source/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ def __repr__(self):
String representation of a source, displaying the source class name
and the source id.
"""
return '<%s %s, weight=%.1f>' % (
self.__class__.__name__, self.source_id, self.weight)
return '<%s %s, rups=%d>' % (
self.__class__.__name__, self.source_id, self.num_ruptures)


class ParametricSeismicSource(BaseSeismicSource, metaclass=abc.ABCMeta):
Expand Down