예제 #1
0
 def gappy_bank(self, gappy_dir):
     """ init a sbank on the gappy data """
     bank = WaveBank(gappy_dir)
     # make sure index is updated after gaps are introduced
     if os.path.exists(bank.index_path):
         os.remove(bank.index_path)
     bank.update_index()
     return bank
예제 #2
0
def default_wbank(tmpdir):
    """ create a  directory out of the traces in default waveforms, init bank """
    base = Path(tmpdir)
    st = obspy.read()
    for num, tr in enumerate(st):
        name = base / f"{(num)}.mseed"
        tr.write(str(name), "mseed")
    bank = WaveBank(base)
    bank.update_index()
    return bank
예제 #3
0
 def bank_null_loc_codes(self, tmpdir):
     """ create a bank that has nullish location codes in its streams. """
     st = obspy.read()
     path = Path(tmpdir)
     for tr in st:
         tr.stats.location = "--"
         time = str(get_reference_time(tr))
         name = time.split(".")[0].replace(":", "-") + f"_{tr.id}"
         tr.write(str(path / name) + ".mseed", "mseed")
     bank = WaveBank(path)
     bank.update_index()
     return bank
예제 #4
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"}
예제 #5
0
 def bank_3(self, tmpdir_factory):
     """ Create a bank with several different types of streams. """
     td = tmpdir_factory.mktemp("waveforms")
     t1, t2 = self.t1, self.t2
     bulk3 = [
         ("TA", "M11A", "01", "CHZ", t1, t2),
         ("RR", "BOB", "", "HHZ", t1, t2),
         ("BB", "BOB", "02", "ENZ", t1, t2),
         ("UU", "SRU", "--", "HHN", t1, t2),
     ]
     ArchiveDirectory(str(td)).create_directory_from_bulk_args(bulk3)
     bank = WaveBank(str(td))
     bank.update_index()
     return bank
예제 #6
0
 def bank(self, df_index, ta_archive):
     """ return a bank with monkeypatched index """
     sbank = WaveBank(ta_archive)
     sbank.update_index = lambda: None
     sbank._index_cache = lambda *args, **kwargs: df_index
     return sbank