Skip to content

Commit

Permalink
Raised helpful IndexError in disaggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Simionato committed Oct 19, 2023
1 parent 1a3b07a commit 36af30d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Upgraded Django version to version 3.2.21 with a security fix

[Michele Simionato]
* In case of a well known IndexError in disaggregation calculations, solved in
newer versions of the engine, a helpful message is printed
* Backported fix on sanity check for avg_losses and aggrisk
* Backported fix to `avg_gmf`
* Backported a fix to `oq reaggregate`
Expand Down
2 changes: 2 additions & 0 deletions openquake/calculators/disaggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def _collapse_res(rdic):
def _matrix(matrices, num_trts, num_mag_bins):
# convert a dict trti, magi -> matrix into a single matrix
trti, magi = next(iter(matrices))
if trti >= num_trts:
raise IndexError('please upgrade to engine >= 3.17')
mat = numpy.zeros((num_trts, num_mag_bins) + matrices[trti, magi].shape)
for trti, magi in matrices:
mat[trti, magi] = matrices[trti, magi]
Expand Down

0 comments on commit 36af30d

Please sign in to comment.