def test_getAverageFloodDuration(self): if self.usepandas: for th in range(-10, 10): th = th + np.random.uniform(-1, 1, 1)[0] sig_val = sig.getAverageFloodDuration( self.simulation, self.observation, datetime_series=self.dd_daily, threshold_value=th, mode="get_signature") sig_raw = sig.getAverageFloodDuration( self.simulation, self.observation, datetime_series=self.dd_daily, threshold_value=th, mode="get_raw_data") sig_dev = sig.getAverageFloodDuration( self.simulation, self.observation, datetime_series=self.dd_daily, threshold_value=th, mode="calc_Dev") self.assertEqual(sig_raw.dtypes[0], "float64") self.assertEqual(sig_raw["flood"].__len__(), 730) self.assertEqual(str(type(sig_raw.index.tolist()[0])), "<class 'pandas.tslib.Timestamp'>") self.assertEqual(type(sig_dev), type(1.0)) self.assertEqual(type(sig_val), type(1.0))
print( sig.getFloodFrequency(simulation, observation, pd.date_range("2015-05-01", periods=timespanlen), 3, "day")) sig.__calcFloodDuration(simulation, ddd, 3, "year", "drought") print( sig.getAverageFloodOverflowPerSection(simulation, observation, dd_daily, threshold_factor=1, section="day")) print( sig.getAverageFloodDuration(simulation, observation, dd_daily, threshold_factor=3, section="day")) print( sig.getAverageBaseflowDuration(simulation, observation, dd_daily, threshold_factor=5, section="day")) print( sig.getAverageBaseflowDuration(simulation, observation, dd_daily, threshold_factor=0.2, section="day"))