Пример #1
0
    def test_power_duration_curve(self):
        power = pd.Series([100] * 120 + ([300] * 60 + [100] * 60) * 4 + [100] * 60)
        rv = mean_max(power)

        assert rv[0] == 300
        assert pytest.approx(rv[-1], 172.8)
        assert not pd.Series(rv).is_monotonic

        rv = mean_max(power, monotonic=True)

        assert rv[0] == 300
        assert pytest.approx(rv[-1], 172.8)
        s = pd.Series(rv)
        assert s.sort_index(ascending=False).is_monotonic
Пример #2
0
    def test_power_duration_curve(self):
        power = np.arange(101)
        rv = mean_max(power)

        assert rv[0] == 100.0
        assert rv[49] == 75.5
        assert rv[-1] == 50.5
Пример #3
0
    def test_power_duration_curve_series(self):
        stream = pd.Series(np.zeros(3))
        expected = pd.Series(np.zeros(2))

        rv = mean_max(stream)

        assert type(rv) == pd.Series
        assert (rv == expected).all()
Пример #4
0
    def test_power_duration_curve_ndarray(self):
        stream = np.zeros(3)
        expected = np.zeros(2)

        rv = mean_max(stream)

        assert type(rv) == np.ndarray
        assert (rv == expected).all()
Пример #5
0
    def test_power_duration_curve_list(self):
        stream = [0, 0, 0]
        expected = [0, 0]

        rv = mean_max(stream)

        assert type(rv) == list
        assert rv == expected
Пример #6
0
 def compute_mean_max_power(self):
     return core.mean_max(self.power)