コード例 #1
0
    def test_getAverageBaseflowUnderflowPerSection(self):
        if self.usepandas:
            for th in range(-10, 10):
                th = th + np.random.uniform(-1, 1, 1)[0]
                sig_val = sig.getAverageBaseflowUnderflowPerSection(
                    self.simulation,
                    self.observation,
                    datetime_series=self.dd_daily,
                    threshold_value=th,
                    mode="get_signature")
                sig_raw = sig.getAverageBaseflowUnderflowPerSection(
                    self.simulation,
                    self.observation,
                    datetime_series=self.dd_daily,
                    threshold_value=th,
                    mode="get_raw_data")
                sig_dev = sig.getAverageBaseflowUnderflowPerSection(
                    self.simulation,
                    self.observation,
                    datetime_series=self.dd_daily,
                    threshold_value=th,
                    mode="calc_Dev")

                self.assertTrue(sig_raw.dtypes[0] == "int64"
                                or sig_raw.dtypes[0] == "float64")
                self.assertEqual(sig_raw["baseflow"].__len__(), 730)

                self.assertEqual(str(type(sig_raw.index.tolist()[0])),
                                 "<class 'pandas.tslib.Timestamp'>")

                self.assertEqual(type(float(sig_dev.astype(float))), type(1.0))

                self.assertEqual(type(float(sig_val.astype(float))), type(1.0))
コード例 #2
0
ファイル: tutorial_signatures.py プロジェクト: p-lauer/spotpy
                                   dd_daily,
                                   threshold_factor=5,
                                   section="day"))

print(
    sig.getAverageBaseflowDuration(simulation,
                                   observation,
                                   dd_daily,
                                   threshold_factor=0.2,
                                   section="day"))
print(
    sig.getAverageBaseflowFrequencyPerSection(simulation, observation,
                                              dd_daily, 3, "day"))
print(
    sig.getAverageBaseflowUnderflowPerSection(simulation,
                                              observation,
                                              dd_daily,
                                              threshold_factor=4,
                                              section="day"))

print(
    sig.getBaseflowIndex(simulation, observation,
                         pd.date_range("2015-05-01", periods=timespanlen)))
print(sig.getSlopeFDC(simulation, observation))
print(
    sig.getLowFlowVar(simulation, observation,
                      pd.date_range("2015-05-01", periods=timespanlen)))
print(
    sig.getHighFlowVar(simulation, observation,
                       pd.date_range("2015-05-01", periods=timespanlen)))