keyError for classical_damage

48 views
Skip to first unread message

許銘凱

unread,
Jun 23, 2015, 9:24:33 AM6/23/15
to openqua...@googlegroups.com
Dear admin,

I try to run the oq-engine demonstration about   classical_damage. 
it is fine to run the hazard demonstration,however, appear some error when I try to run the risk.
The attachment is the demonstration file in openquake.
Thank you very much!

------------------------------------------------------------------------------------------------------------------------------------------------------
    kensheu@kensheu-VirtualBox:~/oq-engine$ ./bin/oq-engine --nd --run-risk=./demos/risk/ClassicalDamage/job_risk.ini --hazard-calculation-id 167
Traceback (most recent call last):
  File "./bin/oq-engine", line 576, in <module>
    main()
  File "./bin/oq-engine", line 505, in main
    hazard_calculation_id=args.hazard_calculation_id)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/engine.py", line 352, in run_job
    hazard_calculation_id)
  File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 217, in inner
    res = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/engine.py", line 453, in job_from_file
    check_hazard_risk_consistency(haz_job, params['calculation_mode'])
  File "/usr/lib/python2.7/dist-packages/openquake/engine/engine.py", line 397, in check_hazard_risk_consistency
    expected_mode = RISK_HAZARD_MAP[risk_mode]
KeyError: 'classical_damage'

---------------------------------------------------------------------------------------------------------------------------------------------------------
ClassicalDamage.rar

Michele Simionato

unread,
Jun 23, 2015, 9:55:40 AM6/23/15
to openqua...@googlegroups.com
Are you sure that 167 is the right number when you give `` --hazard-calculation-id 167``?
It should be the number of the associated hazard calculation. If I run the files you sent, everything works for me.

A trick is to use

$ oq-engine --nd --run job_hazard.ini,job_risk.ini

so that you can run hazard and risk together without specifying the --hazard-calculation-id directly.

許銘凱

unread,
Jun 23, 2015, 11:45:15 AM6/23/15
to openqua...@googlegroups.com
Dear admin ,
 I am sure 167 is the right number for  --hazard-calculation-id.
 I install openquake to another PC and this problem doesn't show.
And I use my own exposure file and fragility file to run, it shows such error:
Is there something incorrect in my exposure file and fragility file?
the attachment are my exposure file and fragility file
------------------------------------------------------------------------------------------------------------
kensheu@Ruprure1-X8SAX:~/oq-engine$ ./bin/oq-engine --nd --run-hazard=./CGS141029_m0_5.0/job_hazard.ini

Traceback (most recent call last):
  File "./bin/oq-engine", line 576, in <module>
    main()
  File "./bin/oq-engine", line 489, in main
    log_file, args.exports)
  File "/home/kensheu/oq-engine/openquake/engine/engine.py", line 353, in run_job
    hazard_calculation_id)
  File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 339, in inner
    return func(*args, **kwargs)
  File "/home/kensheu/oq-engine/openquake/engine/engine.py", line 464, in job_from_file
    oqparam = readinput.get_oqparam(params, calculators=calculators)
  File "/home/kensheu/oq-risklib/openquake/commonlib/readinput.py", line 171, in get_oqparam
    oqparam = OqParam(**job_ini)
  File "/home/kensheu/oq-risklib/openquake/commonlib/oqvalidation.py", line 136, in __init__
    ffs = get_fragility_functions(fname, cfd)
  File "/home/kensheu/oq-risklib/openquake/commonlib/riskmodels.py", line 200, in get_fragility_functions
    nodefactory['fragilityModel'])
  File "parser.pxi", line 18, in lxml.etree.ParseError.__init__ (src/lxml/lxml.etree.c:69927)
TypeError: __init__() takes exactly 5 positional arguments (2 given)
--------------------------------------------------------------------------------------------------------------------------------------------------

 
許銘凱於 2015年6月23日星期二 UTC+8下午9時24分33秒寫道:
fragility_curve20150623_P.xml
exposure_apart.xml

Michele Simionato

unread,
Jun 25, 2015, 2:52:15 AM6/25/15
to openqua...@googlegroups.com
Your fragility curve has a syntax error. If you want to get a nice error message I suggest you to use the `oq-lite info` command:

$ oq-lite info fragility_curve20150623_P.xml 
Traceback (most recent call last):
  File "/home/michele/oq-risklib/bin/oq-lite", line 33, in <module>
...
  File "parser.pxi", line 622, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:91757)
lxml.etree.XMLSyntaxError: xmlns: ' http://openquake.org/xmlns/nrml/0.4 ' is not a valid URI, line 2, column 12


Now the problem is clear, you have trailing spaces in the xmlns attribute. Please Remove them, both at beginning and at the end:
Reply all
Reply to author
Forward
0 new messages