@@ -148,34 +148,40 @@ 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 , haz_fc , lead_time , member , haz_kwargs ):
152- haz_fc_select = haz_fc .select (member = [3 , 0 ])
153- idx = np .array ([0 , 3 ])
154- npt .assert_array_equal (haz_fc_select .event_id , haz_fc .event_id [idx ])
155- npt .assert_array_equal (haz_fc_select .member , member [idx ])
156- npt .assert_array_equal (haz_fc_select .lead_time , lead_time [idx ])
157-
158- haz_fc_select = haz_fc .select (lead_time = lead_time [np .array ([3 , 0 ])])
159- npt .assert_array_equal (haz_fc_select .event_id , haz_fc .event_id [idx ])
160- npt .assert_array_equal (haz_fc_select .member , member [idx ])
161- npt .assert_array_equal (haz_fc_select .lead_time , lead_time [idx ])
151+ def test_derived_select (self , impact_forecast , lead_time , member , impact_kwargs ):
152+ imp_fc_select = impact_forecast .select (member = [2 , 0 ])
153+ idx = np .array ([0 , 2 ])
154+ npt .assert_array_equal (imp_fc_select .event_id , impact_forecast .event_id [idx ])
155+ npt .assert_array_equal (imp_fc_select .member , member [idx ])
156+ npt .assert_array_equal (imp_fc_select .lead_time , lead_time [idx ])
157+
158+ imp_fc_select = impact_forecast .select (lead_time = lead_time [np .array ([2 , 0 ])])
159+ npt .assert_array_equal (imp_fc_select .event_id , impact_forecast .event_id [idx ])
160+ npt .assert_array_equal (imp_fc_select .member , member [idx ])
161+ npt .assert_array_equal (imp_fc_select .lead_time , lead_time [idx ])
162162
163163 # Test intersections
164- haz_fc_select = haz_fc .select (event_id = [1 , 4 ], member = [0 , 1 , 2 ])
165- npt .assert_array_equal (haz_fc_select .event_id , haz_fc .event_id [np .array ([0 ])])
164+ imp_fc_select = impact_forecast .select (event_ids = [10 , 14 ], member = [0 , 1 , 2 ])
165+ npt .assert_array_equal (
166+ imp_fc_select .event_id , impact_forecast .event_id [np .array ([0 ])]
167+ )
166168
167- haz_fc_select = haz_fc .select (
168- event_id = [1 , 2 , 4 ], member = [0 , 1 , 2 ], lead_time = lead_time [1 :3 ]
169+ imp_fc_select = impact_forecast .select (
170+ event_ids = [10 , 11 , 13 ], member = [0 , 1 , 2 ], lead_time = lead_time [1 :3 ]
171+ )
172+ npt .assert_array_equal (
173+ imp_fc_select .event_id , impact_forecast .event_id [np .array ([1 ])]
169174 )
170- npt .assert_array_equal (haz_fc_select .event_id , haz_fc .event_id [np .array ([1 ])])
171175
172176 # Test "outer"
173- haz_fc2 = HazardForecast (
174- lead_time = lead_time , member = np .zeros_like (member , dtype = "int" ), ** haz_kwargs
177+ impact_forecast2 = ImpactForecast (
178+ lead_time = lead_time ,
179+ member = np .zeros_like (member , dtype = "int" ),
180+ ** impact_kwargs ,
175181 )
176- haz_fc_select = haz_fc2 .select (event_id = [ 1 , 2 , 4 ], member = [0 ])
177- npt .assert_array_equal (haz_fc_select .event_id , [1 , 2 , 4 ])
178- npt .assert_array_equal (haz_fc_select .member , [0 , 0 , 0 ])
182+ imp_fc_select = impact_forecast2 .select (event_ids = [ 10 , 11 , 13 ], member = [0 ])
183+ npt .assert_array_equal (imp_fc_select .event_id , [10 , 11 , 13 ])
184+ npt .assert_array_equal (imp_fc_select .member , [0 , 0 , 0 ])
179185
180186
181187@pytest .mark .skip ("Concat from base class does not work" )
0 commit comments