Skip to content

Commit 8317442

Browse files
Feature/auto assign centroids (#640)
* assign centroids by default set cover to the full value * input data for San Salvador house assets deleting cover values makes more sense * CostBenefit.plot_waterfall: pydoc, add a note about arguments restriction hazard and haz_future should have common centroids
1 parent cd1b284 commit 8317442

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

climada/engine/cost_benefit.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,8 @@ def plot_waterfall(hazard, entity, haz_future, ent_future,
537537
hazard : climada.Hazard
538538
entity : climada.Entity
539539
haz_future : Hazard
540-
hazard in the future (future year provided at ent_future)
540+
hazard in the future (future year provided at ent_future).
541+
``haz_future`` is expected to have the same centroids as ``hazard``.
541542
ent_future : climada.Entity
542543
entity in the future
543544
risk_func : func, optional
@@ -558,11 +559,11 @@ def plot_waterfall(hazard, entity, haz_future, ent_future,
558559
future_year = ent_future.exposures.ref_year
559560

560561
imp = ImpactCalc(entity.exposures, entity.impact_funcs, hazard)\
561-
.impact(assign_centroids=False)
562+
.impact(assign_centroids=hazard.centr_exp_col not in entity.exposures.gdf)
562563
curr_risk = risk_func(imp)
563564

564565
imp = ImpactCalc(ent_future.exposures, ent_future.impact_funcs, haz_future)\
565-
.impact(assign_centroids=False)
566+
.impact(assign_centroids=hazard.centr_exp_col not in ent_future.exposures.gdf)
566567
fut_risk = risk_func(imp)
567568

568569
if not axis:
Binary file not shown.

0 commit comments

Comments
 (0)