Пример #1
0
 def test_empty_bank_raises(self, tmpdir):
     """
     Test that an empty bank can be inited, but that an error is
     raised when trying to read its index.
     """
     path = Path(tmpdir) / "new"
     bank = WaveBank(path)
     # test that touching the index/meta data raises
     with pytest.raises(BankDoesNotExistError):
         bank.read_index()
     bank.put_waveforms(obspy.read())
     assert len(bank.read_index()) == 3
Пример #2
0
 def test_put_waveforms_to_crandall_copy(self, tmpdir):
     """ ran into issue in docs where putting data into the crandall
     copy didn't work. """
     ds = obsplus.datasets.utils.copy_dataset(dataset="crandall",
                                              destination=Path(tmpdir))
     bank = WaveBank(ds.waveform_client)
     bank.read_index()  # this sets cache
     st = obspy.read()
     bank.put_waveforms(st)
     bank.update_index()
     df = bank.read_index(station="RJOB")
     assert len(df) == len(st)
     assert set(df.station) == {"RJOB"}
Пример #3
0
 def test_pathlib_object(self, tmp_ta_dir):
     """ ensure a pathlib object can be passed as first arg """
     bank = WaveBank(pathlib.Path(tmp_ta_dir) / "waveforms")
     ind = bank.read_index()
     min_start = ind.starttime.min()
     st = bank.get_waveforms(starttime=min_start, endtime=min_start + 600)
     assert isinstance(st, obspy.Stream)