File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -720,6 +720,26 @@ def test_impact_forecast_empty_impmat_error(self):
720720 "Please set save_mat=True." ,
721721 )
722722
723+ def test_impact_forecast_blocked_nonsense_attrs (self ):
724+ """Test that nonsense attributes are blocked when computing impact forecast"""
725+ lead_time = pd .timedelta_range ("1h" , periods = 6 ).to_numpy ()
726+ member = np .arange (6 )
727+ haz = Hazard .from_hdf5 (get_test_file ("test_hazard_US_flood_random_locations" ))
728+ haz_fc = HazardForecast .from_hazard (haz , lead_time = lead_time , member = member )
729+
730+ exp = Exposures .from_hdf5 (
731+ get_test_file ("test_exposure_US_flood_random_locations" )
732+ )
733+ impf_set = ImpactFuncSet .from_excel (
734+ Path (__file__ ).parent / "data" / "flood_imp_func_set.xls"
735+ )
736+ impact = ImpactCalc (exp , impf_set , haz_fc ).impact (
737+ assign_centroids = False , save_mat = True
738+ )
739+ assert np .isnan (impact .aai_agg )
740+ assert np .all (np .isnan (impact .eai_exp ))
741+ assert impact .eai_exp .shape == (len (exp .gdf ),)
742+
723743
724744class TestImpactMatrixCalc (unittest .TestCase ):
725745 """Verify the computation of the impact matrix"""
You can’t perform that action at this time.
0 commit comments