Importing/exporting GMF

96 views
Skip to first unread message

Clotaire Michel

unread,
Sep 29, 2014, 8:55:21 AM9/29/14
to openqua...@googlegroups.com
Dear developers,
I am currently running scenario damage computations. 
The sequence:

openquake --run-hazard job_hazard.ini
openquake --run-risk job_risk.ini --hazard-output-id ID
openquake --export-risk ID ./results

leads to completely different results (order of magnitudes) from 

openquake --run-hazard job_hazard.ini
openquake --export-hazard ID ./results
openquake --load-gmf ./results/calc_ID/gmf_scenario/gmf_scenario.xml
openquake --run-risk job_risk.ini --hazard-output-id ID2
openquake --export-risk ID ./results

The results of the second are clearly not those expected.
Am I doing something wrong when importing the GMF into openquake?

Bonus question: what are the units of the produced GMFs (GMPE=ChiouYoungs2008 in SA(T))? I guess g, but I could not find this information anywhere.

Thanks for the answer

Clotaire Michel

unread,
Sep 29, 2014, 9:36:51 AM9/29/14
to openqua...@googlegroups.com
Update:
Trying to re-export the re-imported GMF leads to the error message:
openquake@ubuntu-64:/media/sf_vbox/scenario_damage_test2$ openquake --export-hazard 130 ./results
Traceback (most recent call last):
  File "/usr/bin/openquake", line 9, in <module>
    load_entry_point('openquake.engine==1.0.0', 'console_scripts', 'openquake')()
  File "/usr/lib/python2.7/dist-packages/openquake/engine/bin/openquake_cli.py", line 473, in main
    export_hazard(output_id, expanduser(target_dir), args.export_type)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/bin/openquake_cli.py", line 313, in export_hazard
    export(hazard_export.export, haz_output_id, target_dir, export_type)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/bin/openquake_cli.py", line 350, in export
    the_file = fn(output_id, target_dir, export_type)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/export/hazard.py", line 65, in export
    return export_fn(output, target)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/export/core.py", line 55, in wrapped
    return fn(output, target, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/export/hazard.py", line 354, in export_gmf_scenario_xml
    writer.serialize(gmfs)
  File "/usr/lib/python2.7/dist-packages/openquake/nrmllib/hazard/writers.py", line 884, in serialize
    node.node_to_nrml(gmfset, dest)
  File "/usr/lib/python2.7/dist-packages/openquake/nrmllib/node.py", line 668, in node_to_nrml
    node_to_xml(root, output)
  File "/usr/lib/python2.7/dist-packages/openquake/nrmllib/node.py", line 630, in node_to_xml
    w.serialize(node)
  File "/usr/lib/python2.7/dist-packages/openquake/nrmllib/writers.py", line 85, in serialize
    self.serialize(subnode)
  File "/usr/lib/python2.7/dist-packages/openquake/nrmllib/writers.py", line 84, in serialize
    for subnode in node:
  File "/usr/lib/python2.7/dist-packages/openquake/nrmllib/hazard/writers.py", line 324, in gen_gmfs
    for gmf in gmf_set:
  File "/usr/lib/python2.7/dist-packages/openquake/engine/db/models.py", line 2300, in get_gmfs_scenario
    imts = distinct(from_string(x) for x in hc.intensity_measure_types)
TypeError: 'NoneType' object is not iterable

Michele Simionato

unread,
Sep 30, 2014, 9:22:39 AM9/30/14
to openqua...@googlegroups.com
We are aware of the problem and working to solve. I will let you know when we have a fix.

Michele Simionato

unread,
Oct 2, 2014, 7:00:41 AM10/2/14
to openqua...@googlegroups.com
I have a branch where the problem is fixed. However the fix was rather nontrivial and involved a change in the database.
I need to write a migration script and then there will be a scrupulous code review. Please expect the fix to be released next week.

Michele Simionato

unread,
Oct 21, 2014, 8:24:36 AM10/21/14
to openqua...@googlegroups.com
Sorry for the late reply. The problem was actually fixed one week ago and it has been available in a nightly builds since them.

Clotaire Michel

unread,
Oct 22, 2014, 5:16:53 AM10/22/14
to openqua...@googlegroups.com
Dear Michele,
thanks for your reply and update of the code. I uploaded the Virtual machine from October 20th. However I got the following error when I tried to upload an exported GMF. I understood that some attributes of the xml file gmf_scenario have been added, but is seems that the attribute ruptureId is not correctly filled during the export (always the same value), which leads to the error when it is uploaded again. My file has actually 1 GMF but 5 different intensity measures.
thanks
clotaire

openquake@ubuntu-64:/media/sf_vbox/scenario_risk_test2$ oq-engine --load-gmf ./results/calc_2/gmf_scenario/gmf_scenario.xml
Traceback (most recent call last):
  File "/usr/bin/oq-engine", line 9, in <module>
    load_entry_point('openquake.engine==1.2.0-1-dev1413752954-8ed039d', 'console_scripts', 'oq-engine')()
  File "/usr/lib/python2.7/dist-packages/openquake/engine/bin/openquake_cli.py", line 517, in main
    out = import_gmf_scenario(f)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/tools/import_gmf_scenario.py", line 161, in import_gmf_scenario
    imts, tags, rows = read_data(fileobj)
  File "/usr/lib/python2.7/dist-packages/openquake/engine/tools/import_gmf_scenario.py", line 83, in read_data
    raise DuplicatedTag(tag)
openquake.engine.tools.import_gmf_scenario.DuplicatedTag: scenario-0000000000

Michele Simionato

unread,
Oct 22, 2014, 5:34:52 AM10/22/14
to openqua...@googlegroups.com
Ah, this is a stupid bug. As you understand, the problem is that you have more than one IMT in your file while in my test file I have a single IMT. The fix is trivial and I will improve the test too. The fix will be available for tomorrow.
Reply all
Reply to author
Forward
0 new messages