def insert_origin_catalog(self, origin_pack): """ insert the origin to overwrite old origin """ cat1, cat2, origin = origin_pack # ensure origin is a modified version of cat2's first origin self.ensure_common_arrivals(origin, cat2[0].origins[0]) attach_new_origin(cat1[0], cat2[0], origin, preferred=True, index=0) validate_catalog(cat1) return cat1
def append_origin_catalog(self, origin_pack): """ attach the new origin to the first event without index """ cat1, cat2, origin = origin_pack # cat1 = cat1.copy() # cat2 = cat2.copy() self.ensure_common_arrivals(origin, cat2[0].origins[0]) attach_new_origin(cat1[0], cat2[0], origin, preferred=True) # validate_catalog(cat1) return cat1
def test_insert_origin_out_of_bounds(self, origin_pack): """ ensure the origin is still found even if bogus index was used """ cat1, cat2, origin = origin_pack # ensure origin is a modified version of cat2's first origin self.ensure_common_arrivals(origin, cat2[0].origins[0]) with pytest.warns(UserWarning) as w: attach_new_origin(cat1[0], cat2[0], origin, preferred=True, index=500) assert len(w) != 0 validate_catalog(cat1) self.origin_is_preferred(cat1, origin) assert origin in cat1[0].origins assert cat1[0].origins[-1] == origin