@@ -148,7 +148,7 @@ def test_impact_forecast_select_exposure(
148148 impact_fc .imp_mat .todense (), impact_forecast .imp_mat .todense ()[:, exp_col ]
149149 )
150150
151- def test_derived_select (self , impact_forecast , lead_time , member , impact_kwargs ):
151+ def test_derived_select_single (self , impact_forecast , lead_time , member ):
152152 imp_fc_select = impact_forecast .select (member = [2 , 0 ])
153153 idx = np .array ([0 , 2 ])
154154 npt .assert_array_equal (imp_fc_select .event_id , impact_forecast .event_id [idx ])
@@ -160,7 +160,9 @@ def test_derived_select(self, impact_forecast, lead_time, member, impact_kwargs)
160160 npt .assert_array_equal (imp_fc_select .member , member [idx ])
161161 npt .assert_array_equal (imp_fc_select .lead_time , lead_time [idx ])
162162
163- # Test intersections
163+ def test_derived_select_intersections (
164+ self , impact_forecast , lead_time , member , impact_kwargs
165+ ):
164166 imp_fc_select = impact_forecast .select (event_ids = [10 , 14 ], member = [0 , 1 , 2 ])
165167 npt .assert_array_equal (
166168 imp_fc_select .event_id , impact_forecast .event_id [np .array ([0 ])]
@@ -183,6 +185,22 @@ def test_derived_select(self, impact_forecast, lead_time, member, impact_kwargs)
183185 npt .assert_array_equal (imp_fc_select .event_id , [10 , 11 , 13 ])
184186 npt .assert_array_equal (imp_fc_select .member , [0 , 0 , 0 ])
185187
188+ def test_no_select (self , impact_forecast , impact_kwargs ):
189+ imp_fc_select = impact_forecast .select ()
190+ npt .assert_array_equal (
191+ imp_fc_select .imp_mat .todense (), impact_forecast .imp_mat .todense ()
192+ )
193+
194+ num_centroids = len (impact_kwargs ["coord_exp" ])
195+ imp_fc_select = impact_forecast .select (event_names = ["aaaaa" , "foo" ])
196+ assert imp_fc_select .imp_mat .shape == (0 , num_centroids )
197+ imp_fc_select = impact_forecast .select (event_ids = [- 1 , 1002 ])
198+ assert imp_fc_select .imp_mat .shape == (0 , num_centroids )
199+ imp_fc_select = impact_forecast .select (member = [- 1 ])
200+ assert imp_fc_select .imp_mat .shape == (0 , num_centroids )
201+ imp_fc_select = impact_forecast .select (np .timedelta64 ("3" , "Y" ))
202+ assert imp_fc_select .imp_mat .shape == (0 , num_centroids )
203+
186204
187205@pytest .mark .skip ("Concat from base class does not work" )
188206def test_impact_forecast_concat (impact_forecast , member ):
0 commit comments