Skip to content

Fix oq export "aggrisk-stats" to work also for scenario_damage calculations - #11675

Merged
ptormene merged 6 commits into
masterfrom
aggrisk_tags_dmg
Jul 31, 2026
Merged

Fix oq export "aggrisk-stats" to work also for scenario_damage calculations#11675
ptormene merged 6 commits into
masterfrom
aggrisk_tags_dmg

Conversation

@ptormene

Copy link
Copy Markdown
Member

Fixes #11666

@ptormene ptormene added this to the Engine 3.27.0 milestone Jul 30, 2026
@ptormene
ptormene requested a review from micheles July 30, 2026 15:05
@ptormene ptormene self-assigned this Jul 30, 2026
@ptormene ptormene added the bug label Jul 30, 2026
acc = general.AccumDict(accum=[])
for agg_id, loss_id, loss in zip(
adf.agg_id, adf.loss_id, adf.loss):
for row in adf.itertuples(index=False):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice the zip is excepted to be faster than itertuples. That could be a non-issue, but it would be interesting to measure the performance of the extractor in large calculations. I don't expect serious differences, though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of using itertuples here instead of zip is that the zip approach assumes there are exactly three specific columns (agg_id, loss_id, loss), but for scenario_damage we have a variable number of columns (e.g. dmg0...dmg4), depending on the number of damage states.

@ptormene
ptormene merged commit ce254a3 into master Jul 31, 2026
5 checks passed
@ptormene
ptormene deleted the aggrisk_tags_dmg branch July 31, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error extracting aggrisk-tags from InfrastructureMultiPeril job

2 participants