Add consequences command and make consequences more easily extensible #8940
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initial work towards #7162
This is still a work in progress and I would like to discuss about it with @raoanirudh to see if the proposed approach makes sense and to assign better names and descriptions to some variables/parameters.
I updated the consequences script in oq-risk-test to work with the current engine master and I created a new oq command that does the same.
I refactored the functions
consequence
andget_agg_value
in scientific.py in order to centralize the definition of consequences in a single place, changing theKNOWN_CONSEQUENCES
list into a dictionary specifying what is needed to perform consequence calculations and aggregations. It should make it easier to define new consequences when needed.While working on this, I spotted a couple of potential issues in the current master and I added notes about them.
I removed the dependency from tqdm and openpyxl.
Consistently with what discussed with Anirudh, I discarded from data the "no damage" columns.