providing several consequence files under "consequence_file"

28 views
Skip to first unread message

Cecilia I. Nievas

unread,
Oct 14, 2025, 3:22:00 AMOct 14
to openqua...@googlegroups.com

Dear OpenQuake community,

I am trying to run an event_based_damage calculation with OpenQuake v3.23.2 providing two consequence files in this way:

consequence_file = {'taxonomy': ['economic_loss_ratios.csv', 'fatality_ratios.csv']}

However, the calculation crashes with the following error:

[2025-10-14 08:58:58 #171 INFO] Building aggrisk from 257.68 KB of risk_by_event
[2025-10-14 08:58:58 #171 INFO] Performing 4 aggregations
[2025-10-14 08:58:58 #171 ERROR] Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/engine/engine.py", line 208, in run_calc
    calc.run(shutdown=True)
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/base.py", line 339, in run
    raise exc from None
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/base.py", line 328, in run
    self.post_execute(self.result)
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/event_based_damage.py", line 236, in post_execute
    res = prc.execute()
          ^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/post_risk.py", line 606, in execute
    self.aggrisk = build_store_agg(
                   ^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/post_risk.py", line 397, in build_store_agg
    aggrisk, aggrisk_quantiles, columns, builder = compute_aggrisk(
                                                   ^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/post_risk.py", line 371, in compute_aggrisk
    aggrisk_quantiles = pandas.DataFrame(out)
                        ^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/pandas/core/frame.py", line 778, in __init__
    mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy, typ=manager)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/pandas/core/internals/construction.py", line 503, in dict_to_mgr
    return arrays_to_mgr(arrays, columns, index, dtype=dtype, typ=typ, consolidate=copy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/pandas/core/internals/construction.py", line 114, in arrays_to_mgr
    index = _extract_index(arrays)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/pandas/core/internals/construction.py", line 677, in _extract_index
    raise ValueError("All arrays must be of the same length")
ValueError: All arrays must be of the same length

Traceback (most recent call last):
  File "/home/user/.pyenv/versions/myvirtualenv/bin/oq", line 7, in <module>
    sys.exit(oq())
             ^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/commands/__main__.py", line 48, in oq
    sap.run(commands, prog='oq')
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/baselib/sap.py", line 212, in run
    return _run(parser(funcdict, **parserkw), argv)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/baselib/sap.py", line 203, in _run
    return func(**dic)
           ^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/commands/engine.py", line 180, in main
    run_jobs(jobs, nodes=nodes, sbatch=True, precalc=not multi)
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/engine/engine.py", line 380, in run_jobs
    run_calc(jobctx)
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/engine/engine.py", line 208, in run_calc
    calc.run(shutdown=True)
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/base.py", line 339, in run
    raise exc from None
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/base.py", line 328, in run
    self.post_execute(self.result)
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/event_based_damage.py", line 236, in post_execute
    res = prc.execute()
          ^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/post_risk.py", line 606, in execute
    self.aggrisk = build_store_agg(
                   ^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/post_risk.py", line 397, in build_store_agg
    aggrisk, aggrisk_quantiles, columns, builder = compute_aggrisk(
                                                   ^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/openquake/calculators/post_risk.py", line 371, in compute_aggrisk
    aggrisk_quantiles = pandas.DataFrame(out)
                        ^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/pandas/core/frame.py", line 778, in __init__
    mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy, typ=manager)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/pandas/core/internals/construction.py", line 503, in dict_to_mgr
    return arrays_to_mgr(arrays, columns, index, dtype=dtype, typ=typ, consolidate=copy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/pandas/core/internals/construction.py", line 114, in arrays_to_mgr
    index = _extract_index(arrays)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.0/envs/myvirtualenv/lib/python3.12/site-packages/pandas/core/internals/construction.py", line 677, in _extract_index
    raise ValueError("All arrays must be of the same length")
ValueError: All arrays must be of the same length


If I run the same calculation but with the line:

consequence_file = {'taxonomy': ['economic_loss_ratios.csv']}

everything works fine (but I don't get the casualties, of course, which I want).

I have tried to follow "openquake/qa_tests_data/scenario_damage/case_17" as an example for this, unsuccessfully.

I am using structural fragilities (structural_fragility_file = myfragilities.xml), with: "<fragilityModel assetCategory="buildings" id="fragility_model" lossCategory="structural">".

Can you please help me understand what is wrong in my input? I am attaching the two consequence CSV files.

Thanks in advance!

Kind regards,

Cecilia


economic_loss_ratios.csv
fatality_ratios.csv

Anirudh Rao

unread,
Oct 15, 2025, 11:59:12 AMOct 15
to OpenQuake Users
Hi Cecilia,

I've attached an event_based_damage example which uses two consequence files, similar to your example, and it seems to be working. Not sure what might be causing the error in your case!

Best wishes,
Anirudh 

event_based_damage.zip
Reply all
Reply to author
Forward
0 new messages