def make_diverse_catalog_list(*args): # NOQA """ Make a list of diverse catalogs. Creates several copies of the diverse catalog, which is returned from :func:`~obspy.core.util.testing.create_diverse_catalog`. Copies are created with the copy method and reading a quakeml representation from a byte string. The unused args is necessary for thread-pool mapping. """ # create a complex catalog cat1 = create_diverse_catalog() bytes_io = io.BytesIO() cat1.write(bytes_io, 'quakeml') # get a few copies from reading from bytes cat2 = read_events(bytes_io) cat3 = read_events(bytes_io) # make more catalogs with copy method cat4 = cat1.copy() cat5 = cat4.copy() # ensure creating a copying and deleting doesnt mess up id tracking cat_to_delete = cat2.copy() del cat_to_delete # pickle and unpickle catalog cat_bytes = pickle.dumps(cat4) cat6 = pickle.loads(cat_bytes) return [cat1, cat2, cat3, cat4, cat5, cat6]
def make_diverse_catalog_list(*args): # NOQA """ Make a list of diverse catalogs. Creates several copies of the diverse catalog, which is returned from :func:`~obspy.core.util.testing.create_diverse_catalog`. Copies are created with the copy method and reading a quakeml representation from a byte string. The unused args is necessary for thread-pool mapping. """ # create a complex catalog cat1 = create_diverse_catalog() bytes_io = io.BytesIO() cat1.write(bytes_io, 'quakeml') # get a few copies from reading from bytes cat2 = read_events(bytes_io) cat3 = read_events(bytes_io) # make more catalogs with copy method cat4 = cat1.copy() cat5 = cat4.copy() # ensure creating a copying and deleting doesnt mess up id tracking cat_to_delete = cat2.copy() del cat_to_delete # pickle and unpickle catalog cat_bytes = pickle.dumps(cat4) cat6 = pickle.loads(cat_bytes) return [cat1, cat2, cat3, cat4, cat5, cat6]
def test_get_pick_from_arrival_on_copied_catalog_doesnt_warn(self): """ Ensure a copied catalog doesn't raise a warning when get_referred_object is called on a resource_id. """ cat = create_diverse_catalog().copy() arrival = cat[0].origins[0].arrivals[0] with WarningsCapture() as w: arrival.pick_id.get_referred_object() self.assertEqual(len(w), 0)
def test_get_pick_from_arrival_on_copied_catalog_doesnt_warn(self): """ Ensure a copied catalog doesn't raise a warning when get_referred_object is called on a resource_id. """ cat = create_diverse_catalog().copy() arrival = cat[0].origins[0].arrivals[0] with WarningsCapture() as w: arrival.pick_id.get_referred_object() self.assertEqual(len(w), 0)