示例#1
0
 def test_bad_start_endtime_raises(self, waveform_df):
     """ If any starttime is before endtime it should raise. """
     td = np.timedelta64(10, "s")
     df = waveform_df.copy()
     df["starttime"] = df["endtime"] + td
     with pytest.raises(DataFrameContentError):
         upd.get_waveforms_bulk_args(df)
示例#2
0
 def test_enddate_startdate(self, waveform_df):
     """
     enddate and startdate are also valid column names for starttime
     endtime. These occur when getting data from inventories.
     """
     rename = dict(starttime="startdate", endtime="enddate")
     df = waveform_df.rename(columns=rename)
     bulk = upd.get_waveforms_bulk_args(df)
     assert len(bulk) == len(df)
     self.assert_wellformed_bulk_args(bulk)
示例#3
0
 def get_df(self):
     """
     Return the input dataframe for WaveFrame.
     """
     # validate stats dataframe and extract bulk parameters
     bulk = get_waveforms_bulk_args(self.stats)
     # get arrays and stats list
     data_list, stats_list = self._get_data_and_stats(bulk)
     # then get dataframes of stats and arrays
     stats = self._create_stats_df(pd.DataFrame(stats_list))
     data = self._get_data_df(data_list)
     return _combine_stats_and_data(stats, data)
示例#4
0
 def test_bad_seed_id_raises(self, waveform_df):
     """ Seed ids cannot (currently) have wildcards """
     waveform_df.loc[0, "network"] = "B?"
     with pytest.raises(DataFrameContentError):
         upd.get_waveforms_bulk_args(waveform_df)
示例#5
0
 def test_extractra_columns_work(self, waveform_df):
     """ Extra columns shouldn't effect anything. """
     waveform_df["bob"] = 10
     bulk = upd.get_waveforms_bulk_args(waveform_df)
     self.assert_wellformed_bulk_args(bulk)
示例#6
0
 def test_missing_value_raises(self, waveform_df):
     """ Ensure any NaN values raises. """
     waveform_df.loc[0, "starttime"] = np.NaN
     with pytest.raises(DataFrameContentError):
         upd.get_waveforms_bulk_args(waveform_df)
示例#7
0
 def test_missing_column_raises(self, waveform_df):
     """ Test that a missing required column raises. """
     df = waveform_df.drop(columns="starttime")
     with pytest.raises(DataFrameContentError):
         upd.get_waveforms_bulk_args(df)
示例#8
0
 def test_basic_get_nslc(self, waveform_df):
     """ Test bulk args with no only required columns. """
     bulk_args = upd.get_waveforms_bulk_args(waveform_df)
     self.assert_wellformed_bulk_args(bulk_args)