When running 'Classical' PSHA using ToroEtAl_2002_AttenRel, the calculation fails with the following message:
oq@oq-VirtualBox:~/openquake$ python bin/openquake --config_file=/home/oq/Documents/hazardDemo/config.gem --output_type=xml --debug=DEBUG
/usr/lib/python2.7/dist-packages/pytz/__init__.py:32: UserWarning: Module openquake was already imported from /home/oq/openquake/openquake/__init__.pyc, but /usr/lib/pymodules/python2.7 is being added to sys.path
from pkg_resources import resource_stream
CRITICAL:root:Job failed with exception: 'Java traceback (most recent call last):
File "HazardCalculator.java", line 125, in org.gem.calc.HazardCalculator.getHazardCurvesAsJson
File "HazardCalculator.java", line 92, in org.gem.calc.HazardCalculator.getHazardCurves
File "HazardCurveCalculator.java", line 398, in org.opensha.sha.calc.HazardCurveCalculator.getHazardCurve
File "TRTUtils.java", line 63, in org.opensha.sha.util.TRTUtils.getIMRForTRT
File "IntensityMeasureRelationship.java", line 477, in org.opensha.sha.imr.IntensityMeasureRelationship.getParameter
org.opensha.commons.exceptions.ParameterException: IntensityMeasureRelationship: getParameter(): Parameter doesn't exist named Tectonic Region'
CRITICAL:root:Job failed with exception: 'Java traceback (most recent call last):
File "HazardCalculator.java", line 125, in org.gem.calc.HazardCalculator.getHazardCurvesAsJson
File "HazardCalculator.java", line 92, in org.gem.calc.HazardCalculator.getHazardCurves
File "HazardCurveCalculator.java", line 398, in org.opensha.sha.calc.HazardCurveCalculator.getHazardCurve
File "TRTUtils.java", line 63, in org.opensha.sha.util.TRTUtils.getIMRForTRT
File "IntensityMeasureRelationship.java", line 477, in org.opensha.sha.imr.IntensityMeasureRelationship.getParameter
org.opensha.commons.exceptions.ParameterException: IntensityMeasureRelationship: getParameter(): Parameter doesn't exist named Tectonic Region'
[2011-11-09 13:06:53,003 #15 oq-VirtualBox CRITICAL MainProcess/4067 root] Job failed with exception: 'Java traceback (most recent call last):
File "HazardCalculator.java", line 125, in org.gem.calc.HazardCalculator.getHazardCurvesAsJson
File "HazardCalculator.java", line 92, in org.gem.calc.HazardCalculator.getHazardCurves
File "HazardCurveCalculator.java", line 398, in org.opensha.sha.calc.HazardCurveCalculator.getHazardCurve
File "TRTUtils.java", line 63, in org.opensha.sha.util.TRTUtils.getIMRForTRT
File "IntensityMeasureRelationship.java", line 477, in org.opensha.sha.imr.IntensityMeasureRelationship.getParameter
org.opensha.commons.exceptions.ParameterException: IntensityMeasureRelationship: getParameter(): Parameter doesn't exist named Tectonic Region'
Traceback (most recent call last):
File "bin/openquake", line 128, in <module>
job.run_job(FLAGS.config_file, FLAGS.output_type)
File "/home/oq/openquake/openquake/job/__init__.py", line 85, in run_job
a_job.launch()
File "/home/oq/openquake/openquake/job/__init__.py", line 474, in launch
self.execute()
File "/home/oq/openquake/openquake/java.py", line 331, in unwrap_exception
return func(*targs, **tkwargs)
File "/home/oq/openquake/openquake/hazard/general.py", line 58, in preloader
return fn(self, *args, **kwargs)
File "/home/oq/openquake/openquake/hazard/opensha.py", line 59, in decorated
return fn(self, *args, **kwargs)
File "/home/oq/openquake/openquake/hazard/opensha.py", line 296, in execute
serializer=self.serialize_hazard_curve_of_realization)
File "/home/oq/openquake/openquake/hazard/opensha.py", line 142, in do_curves
flatten_results=True)
File "/home/oq/openquake/openquake/utils/tasks.py", line 80, in distribute
other_args, flatten_results)
File "/home/oq/openquake/openquake/utils/tasks.py", line 151, in _distribute
the_results = _handle_subtasks(subtasks, flatten_results)
File "/home/oq/openquake/openquake/utils/tasks.py", line 213, in _handle_subtasks
the_results = result.join()
File "/usr/lib/pymodules/python2.7/celery/result.py", line 390, in join
interval=interval))
File "/usr/lib/pymodules/python2.7/celery/result.py", line 87, in wait
return self.get(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/celery/result.py", line 83, in get
interval=interval)
File "/usr/lib/pymodules/python2.7/celery/backends/amqp.py", line 143, in wait_for
raise self.exception_to_python(meta["result"])
openquake.java.JavaException: Java traceback (most recent call last):
File "HazardCalculator.java", line 125, in org.gem.calc.HazardCalculator.getHazardCurvesAsJson
File "HazardCalculator.java", line 92, in org.gem.calc.HazardCalculator.getHazardCurves
File "HazardCurveCalculator.java", line 398, in org.opensha.sha.calc.HazardCurveCalculator.getHazardCurve
File "TRTUtils.java", line 63, in org.opensha.sha.util.TRTUtils.getIMRForTRT
File "IntensityMeasureRelationship.java", line 477, in org.opensha.sha.imr.IntensityMeasureRelationship.getParameter
org.opensha.commons.exceptions.ParameterException: IntensityMeasureRelationship: getParameter(): Parameter doesn't exist named Tectonic Region
The ToroEtAl_2002_AttenRel does not define any tectonic region type parameter (because it does not use it internally) and therefore the method getIMRForTRT in TRTUtils.java (called inside HazardCurveCalculator) fails.
The method getIMRForTRT does the following:
imr.getParameter(TectonicRegionTypeParam.NAME)
.setValueAsDefault();
however there is no reason why a GMPE must provide a tectonic region type param (some GMPEs may require it some others not).
So the call of the method getIMRForTRT in the HazardCurveCalculator (line 398) is inappropriate.
The current line:
ScalarIntensityMeasureRelationshipAPI imr = TRTUtils.getIMRForTRT(imrMap, trt);
should be replaced by:
ScalarIntensityMeasureRelationshipAPI imr = imrMap.get(trt)
without any attempt to set the tectonic region type parameter in the imr object.
I attach the input files to reproduce the bug.
Pull request: https:/ /github. com/gem/ OpenSHA/ pull/12