Skip to content

Commit 496332a

Browse files
committed
Add test for numpy.array in weather dictionary to test_run_model
1 parent 1ef8a74 commit 496332a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_modelchain.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ def test_run_model(self):
108108
'v_wind_2': pd.Series(data=[4.0, 5.0]),
109109
'pressure': pd.Series(data=[101125, 101000]),
110110
'z0': 0.15}
111+
weather_arr = {'v_wind': np.array(weather['v_wind']),
112+
'v_wind_2': np.array(weather['v_wind_2']),
113+
'temp_air': np.array(weather['temp_air']),
114+
'temp_air_2': np.array(weather['temp_air_2']),
115+
'pressure': np.array(weather['pressure']),
116+
'z0': np.array([0.15, 0.15])}
111117
data_height = {'temp_air': 2,
112118
'temp_air_2': 10,
113119
'v_wind': 10,
@@ -159,6 +165,12 @@ def test_run_model(self):
159165
test_mc.run_model(weather, data_height)
160166
assert_series_equal(test_mc.power_output, power_output_exp)
161167

168+
# Test weather dictionary with numpy.arrays
169+
power_output_exp = pd.Series(data=[567683.92454, 1485556.96435],
170+
index=[1, 2], name='feedin_wind_turbine')
171+
test_mc.run_model(weather_arr, data_height)
172+
assert_series_equal(test_mc.power_output, power_output_exp)
173+
162174
# Raise ValueErrors due to wrong spelling of parameters
163175
with pytest.raises(ValueError):
164176
test_modelchain['power_output_model'] = 'wrong_spelling'

0 commit comments

Comments
 (0)