Example #1
0
 def test_events_different_time_same_id_not_duplicated(self, tmpdir):
     """ events with different times but the same id should not be
     duplicated; the old path should be used when detected. """
     cat = obspy.read_events()
     path = Path(tmpdir)
     catalog_to_directory(cat, path)
     first_event_path = get_event_path(cat[0], str(path))
     file_event_count = list(path.rglob("*.xml"))
     # modify first event preferred origin time slightly
     event = cat[0]
     origin = get_preferred(event, "origin")
     origin.time += 10
     # save to disk again
     catalog_to_directory(cat, path)
     # ensure event count didnt change
     assert len(file_event_count) == len(list(path.rglob("*.xml")))
     assert Path(first_event_path).exists()
     # read first path and make sure origin time was updated
     cat2 = obspy.read_events(str(first_event_path))
     assert len(cat2) == 1
     assert get_preferred(cat2[0], "origin").time == origin.time
Example #2
0
 def path_from_catalog_no_comment(self, catalog_no_comment):
     """ return the path from the events with no comments """
     return get_event_path(catalog_no_comment)
Example #3
0
 def path_from_catalog_with_comment(self, catalog_with_comment):
     """ return the path generated by the events with comment """
     return get_event_path(catalog_with_comment)