-
Notifications
You must be signed in to change notification settings - Fork 107
/
Copy pathtest_temperature.py
34 lines (29 loc) · 1.1 KB
/
test_temperature.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
SPDX-FileCopyrightText: 2019 oemof developer group <contact@oemof.org>
SPDX-License-Identifier: MIT
"""
import pandas as pd
import numpy as np
from pandas.util.testing import assert_series_equal
from numpy.testing import assert_array_equal
from windpowerlib.temperature import linear_gradient
class TestTemperature:
def test_linear_gradient(self):
"""Test temperature as pd.Series"""
parameters = {
"temperature": pd.Series(data=[267, 268]),
"temperature_height": 2,
"hub_height": 100,
}
temp_hub_exp = pd.Series(data=[266.363, 267.36300])
assert_series_equal(linear_gradient(**parameters), temp_hub_exp)
def test_temperature_as_np_array(self):
"""Test temperature as np.array"""
parameters = {
"temperature": np.array([267, 268]),
"temperature_height": 2,
"hub_height": 100,
}
temp_hub_exp = np.array([266.363, 267.36300])
assert_array_equal(linear_gradient(**parameters), temp_hub_exp)
assert isinstance(linear_gradient(**parameters), np.ndarray)