Example #1
0
def bing_ebank(bingham_dataset, tmpdir_factory):
    """
    Create a copy of the bingham_test data set. Then return an inited event bank
    using the temporary bingham_test bank
    """
    new = Path(str(tmpdir_factory.mktemp("bingham_test")))
    copy_dataset("bingham_test", new)
    path = new / "bingham_test" / "events"
    ebank = EventBank(path)
    ebank.update_index()
    return ebank
Example #2
0
 def ebank_low_version(self, tmpdir, monkeypatch):
     """ return the default bank with a negative version number. """
     # monkey patch obsplus version so that a low version is saved to disk
     monkeypatch.setattr(obsplus, "__last_version__", self.low_version_str)
     cat = obspy.read_events()
     ebank = EventBank(tmpdir).put_events(cat, update_index=False)
     # write index with negative version
     with suppress_warnings():
         ebank.update_index()
     monkeypatch.undo()
     assert ebank._index_version == self.low_version_str
     assert obsplus.__last_version__ != self.low_version_str
     return ebank
def ebank(tmpdir):
    """ Create a bank from the default catalog. """
    path = Path(tmpdir) / "events"
    # get catalog, add event descriptions to it
    cat = obspy.read_events()
    descs = ["LR", "LR", "SomeSillyEvent"]
    for event, desc_txt in zip(cat, descs):
        desc = ev.EventDescription(desc_txt)
        event.event_descriptions.insert(0, desc)
    obsplus.events.utils.catalog_to_directory(cat, path)
    ebank = EventBank(path)
    ebank.update_index()
    return ebank
def ebank_with_bad_files(tmpdir):
    """ create an event bank with bad files, ensure it doesn't choke
    indexer. """
    path = Path(tmpdir)
    cat = obspy.read_events()
    catalog_to_directory(cat, path)
    # add stream file
    st = obspy.read()
    st.write(str(path / "not_an_event.xml"), "mseed")
    bank = EventBank(path)
    # should issue warning
    with pytest.warns(UserWarning):
        bank.update_index()
    return bank
Example #5
0
def ebank_with_bad_files(tmpdir):
    """
    Create an event bank with bad files, ensure it doesn't choke indexer.
    """
    bank = EventBank(Path(tmpdir))
    cat = obspy.read_events()
    bank.put_events(cat)
    # add stream file
    st = obspy.read()
    stream_path = Path(bank.bank_path)
    st.write(str(stream_path / "not_an_event.xml"), "mseed")
    bank = EventBank(stream_path)
    # should issue warning
    with pytest.warns(UserWarning):
        bank.update_index()
    return bank