Skip to content

Commit

Permalink
Fixed a bug with pre-imported risk functions [skip hazardlib][demos]
Browse files Browse the repository at this point in the history
  • Loading branch information
micheles committed Mar 11, 2018
1 parent f0e2aeb commit ee33225
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 0 additions & 4 deletions demos/risk/EventBasedRisk/job_risk.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ concurrent_tasks = 16
[boundaries]
region_constraint = 78.0 31.5, 89.5 31.5, 89.5 25.5, 78.0 25.5

[vulnerability]
structural_vulnerability_file = structural_vulnerability_model.xml
nonstructural_vulnerability_file = nonstructural_vulnerability_model.xml

[risk_calculation]
asset_hazard_distance = 20
conditional_loss_poes = 0.01, 0.02
Expand Down
8 changes: 7 additions & 1 deletion openquake/commonlib/oqvalidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,13 @@ def all_cost_types(self):
Return the cost types of the computation (including `occupants`
if it is there) in order.
"""
return sorted(self.risk_files)
costtypes = sorted(self.risk_files)
if not costtypes and self.hazard_calculation_id:
with datastore.read(self.hazard_calculation_id) as ds:
parent = ds['oqparam']
self._file_type, self._risk_files = get_risk_files(parent.inputs)
costtypes = sorted(self.risk_files)
return costtypes

def set_risk_imtls(self, risk_models):
"""
Expand Down

0 comments on commit ee33225

Please sign in to comment.