Skip to content

Commit

Permalink
Merge pull request #1151 from matley/eb-fixes
Browse files Browse the repository at this point in the history
Fix aggregate loss curve computation
  • Loading branch information
matley committed Apr 22, 2013
2 parents eef5426 + 8430f10 commit 65baf80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions openquake/engine/calculators/risk/event_based/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ def profile(name):
asset.value,
asset.deductible,
asset.ins_limit),
tses,
time_span,
loss_curve_resolution))
tses=tses,
time_span=time_span,
curve_resolution=loss_curve_resolution))

# FIXME(lp). Insured losses are still computed
# as absolute values.
Expand Down Expand Up @@ -328,7 +328,7 @@ def post_process(self):
Compute aggregate loss curves and event loss tables
"""

tses, time_span = self.hazard_times()
time_span, tses = self.hazard_times()

for hazard_output in self.considered_hazard_outputs():

Expand All @@ -344,7 +344,7 @@ def post_process(self):
if aggregate_losses:
aggregate_loss_losses, aggregate_loss_poes = (
scientific.event_based(
aggregate_losses, tses, time_span,
aggregate_losses, tses=tses, time_span=time_span,
curve_resolution=self.rc.loss_curve_resolution))

models.AggregateLossCurveData.objects.create(
Expand Down
5 changes: 3 additions & 2 deletions openquake/engine/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,10 @@ def points_to_compute(self):
if self.pk and self.inputs.filter(input_type='exposure').exists():
assets = self.exposure_model.exposuredata_set.all().order_by(
'asset_ref')

# the points here must be sorted
lons, lats = zip(
*list(
set([(asset.site.x, asset.site.y)
*sorted(set([(asset.site.x, asset.site.y)
for asset in assets])))
# Cache the mesh:
self._points_to_compute = hazardlib_geo.Mesh(
Expand Down

0 comments on commit 65baf80

Please sign in to comment.