def test_none_onset(self): """ Make sure Nones in the data get handled properly """ waveform_id = ev.WaveformStreamID(station_code="A") pick = ev.Pick(time=UTCDateTime(), waveform_id=waveform_id) df = picks_to_dataframe(pick) assert df.onset.iloc[0] == "" assert df.polarity.iloc[0] == ""
def picks_no_origin(self): """ create a events that has picks but no origin """ t0 = UTCDateTime("2016-01-01T10:12:15.222") def wave_id(seed_str): return ev.WaveformStreamID(seed_string=seed_str) picks = [ ev.Pick(time=t0 + 2, waveform_id=wave_id("UU.TMU..HHZ")), ev.Pick(time=t0 + 1.2, waveform_id=wave_id("UU.BOB.01.ELZ")), ev.Pick(time=t0 + 3.2, waveform_id=wave_id("UU.TEX..EHZ")), ] return picks_to_dataframe(ev.Event(picks=picks))
def test_read_uncertainty(self): """ tests that uncertainties in time_errors attribute are read. See #55. """ kwargs = dict(lower_uncertainty=1, upper_uncertainty=2, uncertainty=12) time_error = ev.QuantityError(**kwargs) waveform_id = ev.WaveformStreamID(station_code="A") pick = ev.Pick( time=UTCDateTime(), time_errors=time_error, waveform_id=waveform_id ) df = picks_to_dataframe(pick) assert set(kwargs).issubset(df.columns) assert len(df) == 1 ser = df.iloc[0] assert all([ser[i] == kwargs[i] for i in kwargs])
def test_unique_event_time_no_origin(self, bingham_cat_only_picks): """ Ensure events with no origin don't all return the same time. """ df = picks_to_dataframe(bingham_cat_only_picks) assert len(df["event_time"].unique()) == len(df["event_id"].unique())
def dataframe_output(self, tcat): """ return read_picks result from reading dataframe """ df = picks_to_df(tcat) return picks_to_dataframe(df)
def catalog_output(self, tcat): """ call read_picks on the events, return result """ return picks_to_dataframe(tcat)
def empty_catalog(): """ run an empty events through the picks_to_df function """ event = ev.Event() cat = obspy.Catalog(events=[event]) return picks_to_dataframe(cat)