@@ -1262,34 +1262,38 @@ def test_calc_return_periods_metric(self):
12621262
12631263 def test_calc_risk_components_metric (self ):
12641264 self .calc_risk_period ._groups_id = np .array ([0 ])
1265- self .calc_risk_period .per_date_aai_H0V0 = np .array ([0 , 0 , 0 ])
1266- self .calc_risk_period .per_date_aai_H1V0 = np .array ([1 , 1 , 1 ])
1267- self .calc_risk_period .per_date_aai_H0V1 = np .array ([2 , 2 , 2 ])
1268- self .calc_risk_period .per_date_aai_H1V1 = np .array ([3 , 3 , 3 ])
1269- self .calc_risk_period .per_date_aai = np .array ([0 , 6 / 4 , 3 ])
1265+ self .calc_risk_period .per_date_aai_H0V0 = np .array ([1 , 3 , 5 ])
1266+ self .calc_risk_period .per_date_aai_E0H0V0 = np .array ([1 , 1 , 1 ])
1267+ self .calc_risk_period .per_date_aai_E0H1V0 = np .array (
1268+ [2 , 2 , 2 ]
1269+ ) # Haz change doubles damages in fut
1270+ self .calc_risk_period .per_date_aai_E0H0V1 = np .array (
1271+ [3 , 3 , 3 ]
1272+ ) # Vul change triples damages in fut
1273+ self .calc_risk_period .per_date_aai = np .array ([1 , 6 , 10 ])
12701274
12711275 # Mock the return values of interp_over_hazard_dim
12721276 self .calc_risk_period .interpolation_strategy .interp_over_hazard_dim .return_value = np .array (
1273- [0 , 0 .5 , 1 ]
1277+ [1 , 1 .5 , 2 ]
12741278 )
12751279
12761280 # Mock the return value of interp_over_vulnerability_dim
12771281 self .calc_risk_period .interpolation_strategy .interp_over_vulnerability_dim .return_value = np .array (
1278- [0 , 1 , 2 ]
1282+ [1 , 2 , 3 ]
12791283 )
12801284
12811285 result = self .calc_risk_period .calc_risk_components_metric ()
12821286
12831287 # Assert that interp_over_hazard_dim was called with the correct arguments
12841288 self .calc_risk_period .interpolation_strategy .interp_over_hazard_dim .assert_called_once_with (
1285- self .calc_risk_period .per_date_aai_H0V0 ,
1286- self .calc_risk_period .per_date_aai_H1V0 ,
1289+ self .calc_risk_period .per_date_aai_E0H0V0 ,
1290+ self .calc_risk_period .per_date_aai_E0H1V0 ,
12871291 )
12881292
12891293 # Assert that interp_over_vulnerability_dim was called with the results of interp_over_hazard_dim
12901294 self .calc_risk_period .interpolation_strategy .interp_over_vulnerability_dim .assert_called_once_with (
1291- self .calc_risk_period .per_date_aai_H0V0 ,
1292- self .calc_risk_period .per_date_aai_H0V1 ,
1295+ self .calc_risk_period .per_date_aai_E0H0V0 ,
1296+ self .calc_risk_period .per_date_aai_E0H0V1 ,
12931297 )
12941298
12951299 # Assert the final returned value
@@ -1315,10 +1319,9 @@ def test_calc_risk_components_metric(self):
13151319 )
13161320 self .assertTrue ((result [MEASURE_COL_NAME ] == "dummy_measure" ).all ())
13171321
1318- # Check calculated risk values by rp, date
13191322 np .testing .assert_allclose (
13201323 result [RISK_COL_NAME ].values ,
1321- np .array ([0 , 0 , 0 , 0 , 0 , 0 , 0 , 0.5 , 1.0 , 0 , 1 , 2 , 0 , 0 , 0 ]),
1324+ np .array ([1. 0 , 1. 0 , 1. 0 , 0 , 2. 0 , 4. 0 , 0 , 0.5 , 1.0 , 0 , 1 , 2 , 0 , 1.5 , 2. 0 ]),
13221325 )
13231326
13241327 @patch ("climada.trajectories.riskperiod.CalcRiskMetricsPeriod" )
0 commit comments