Skip to content

Commit d69814c

Browse files
chahankChahan Kropf
andauthored
Add one test with different impact function (#681)
Co-authored-by: Chahan Kropf <[email protected]>
1 parent e51f92d commit d69814c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

climada/util/test/test_lines_polys_handler.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,33 @@ def test_calc_geom_impact_mixed(self):
515515
])
516516
check_impact(self, imp2, HAZ, exp_mix, aai_agg2, eai_exp2)
517517

518+
# Check non-default impact function id
519+
impfdouble = copy.deepcopy(IMPF2)
520+
impfdouble.mdd *= 2
521+
impf_set = ImpactFuncSet([IMPF, impfdouble])
522+
imp3 = u_lp.calc_geom_impact(
523+
exp_mix, impf_set, HAZ,
524+
res=0.05, to_meters=False, disagg_met=u_lp.DisaggMethod.DIV,
525+
disagg_val=None, agg_met=u_lp.AggMethod.SUM
526+
)
527+
aai_agg3 = 4708604.47775332
528+
eai_exp3 = np.array([
529+
1.73069928e-04, 8.80741357e-04, 1.77657635e-01, 1.06413744e-02,
530+
1.15405492e-02, 3.40097761e-02, 8.91658032e-03, 4.19735141e-02,
531+
1.27160538e-02, 2.43849980e-01, 2.32808488e-02, 5.47043065e-03,
532+
5.44984095e-03, 5.80779958e-03, 1.06361040e-01, 4.67335812e-02,
533+
9.93703142e-02, 8.48207692e-03, 2.95633263e-02, 1.30223646e-01,
534+
3.84600393e-01, 2.05709279e-02, 1.39919480e-01, 1.61239410e-02,
535+
4.46991386e-02, 1.30045513e-02, 1.30045513e-02, 6.91177788e-04,
536+
3.22122197e+04, 2.14840968e+04, 2.89492139e+04, 1.43759256e+05,
537+
5.17612411e+04, 4.02632630e+05, 3.52142916e+05, 7.84964258e+05,
538+
5.80728653e+05, 1.81079871e+06, 3.89456421e+05, 1.02345938e+05,
539+
5.68448588e+02, 4.91876274e+02, 3.81288655e+02, 3.47850159e+02,
540+
3.52183678e+02, 8.86108346e+02, 8.82756302e+02, 9.48633609e+02,
541+
9.67746928e+02, 5.18003590e+02, 4.96400801e+02, 5.25991584e+02
542+
])
543+
check_impact(self, imp3, HAZ, exp_mix, aai_agg3, eai_exp3)
544+
518545
def test_impact_pnt_agg(self):
519546
"""Test impact agreggation method"""
520547
gdf_mix = GDF_LINE.append(GDF_POLY).append(GDF_POINT).reset_index(drop=True)

0 commit comments

Comments
 (0)