@@ -357,6 +357,30 @@ def test_select_event_id(self):
357357 self .assertIsInstance (sel_haz .intensity , sparse .csr_matrix )
358358 self .assertIsInstance (sel_haz .fraction , sparse .csr_matrix )
359359
360+ def test_select_event_id (self ):
361+ """Test select historical events."""
362+ haz = dummy_hazard ()
363+ sel_haz = haz .select (event_id = np .array ([4 , 1 ]))
364+
365+ self .assertTrue (np .array_equal (sel_haz .centroids .coord , haz .centroids .coord ))
366+ self .assertEqual (sel_haz .tag , haz .tag )
367+ self .assertEqual (sel_haz .units , haz .units )
368+ self .assertTrue (np .array_equal (sel_haz .event_id , np .array ([4 , 1 ])))
369+ self .assertTrue (np .array_equal (sel_haz .date , np .array ([4 , 1 ])))
370+ self .assertTrue (np .array_equal (sel_haz .orig , np .array ([True , True ])))
371+ self .assertTrue (np .array_equal (sel_haz .frequency , np .array ([0.2 , 0.1 ])))
372+ self .assertEqual (sel_haz .frequency_unit , haz .frequency_unit )
373+ self .assertTrue (np .array_equal (sel_haz .fraction .toarray (),
374+ np .array ([[0.3 , 0.2 , 0.0 ],
375+ [0.02 , 0.03 , 0.04 ]])))
376+ self .assertTrue (np .array_equal (sel_haz .intensity .toarray (),
377+ np .array ([[5.3 , 0.2 , 0.0 ],
378+ [0.2 , 0.3 , 0.4 ]])))
379+ self .assertEqual (sel_haz .event_name , ['ev4' , 'ev1' ])
380+ self .assertIsInstance (sel_haz , Hazard )
381+ self .assertIsInstance (sel_haz .intensity , sparse .csr_matrix )
382+ self .assertIsInstance (sel_haz .fraction , sparse .csr_matrix )
383+
360384 def test_select_orig_pass (self ):
361385 """Test select historical events."""
362386 haz = dummy_hazard ()
0 commit comments