nhlib: Disaggregation calculation crashes when a source produces no ruptures

Bug #1084025 reported by Lars Butler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake (deprecated)
Fix Released
High
Lars Butler

Bug Description

I encountered this crash while trying to use the nhlib disagg calculator in OQ Engine. This is the error I get:

 ValueError('zero-size array to minimum.reduce without identity',)
Traceback (most recent call last):
  File "/Users/larsbutler/proj/oq-engine/openquake/utils/tasks.py", line 212, in wrapped
    task_func(*args, **kwargs)
  File "/Users/larsbutler/proj/oq-engine/openquake/utils/stats.py", line 288, in wrapper
    result = func(*args, **kwargs)
  File "/Users/larsbutler/proj/oq-engine/openquake/calculators/hazard/disagg/core.py", line 65, in disagg_task
    compute_disagg(job_id, block, lt_rlz_id)
  File "/Users/larsbutler/proj/oq-engine/openquake/calculators/hazard/disagg/core.py", line 167, in compute_disagg
    **calc_kwargs)
  File "/Users/larsbutler/.virtualenvs/openquake/lib/python2.7/site-packages/nhlib/calc/disagg.py", line 109, in disaggregation
    coord_bin_width, truncation_level, n_epsilons)
  File "/Users/larsbutler/.virtualenvs/openquake/lib/python2.7/site-packages/nhlib/calc/disagg.py", line 205, in _define_bins
    int(numpy.floor(mags.min() / mag_bin_width)),
ValueError: zero-size array to minimum.reduce without identity

Doing some debugging, I discovered that this only occurs when a source produces no ruptures.

Revision history for this message
Lars Butler (lars-butler) wrote :

Also: This is only occurs when I use a rupture-to-site distance filter. Removing the filter prevents this error from happening.

Changed in openquake:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Lars Butler (lars-butler)
milestone: none → 0.9.0
Revision history for this message
Lars Butler (lars-butler) wrote :

After a discussion with Dr. Monelli, we have determined that the best way to handle this is

1) Check for empty bins data.
2) If they are empty, throw a runtime warning and return None from the disagg calculator. The warning should explain that no ruptures contributed to the hazard level at this site.

Changed in openquake:
status: Confirmed → In Progress
Revision history for this message
Lars Butler (lars-butler) wrote :
Changed in openquake:
status: In Progress → Fix Committed
Changed in openquake:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.