Skip to content

Commit f81dd7e

Browse files
committed
Add test for weather as DataFrame to test_run_model
1 parent 496332a commit f81dd7e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_modelchain.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ 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_df = pd.DataFrame(data={'v_wind': [5.0, 6.5],
112+
'v_wind_2': [4.0, 5.0],
113+
'z0': 0.15,
114+
'temp_air': [267, 268],
115+
'temp_air_2': [267, 266],
116+
'pressure': [101125, 101000]},
117+
index=[0, 1])
111118
weather_arr = {'v_wind': np.array(weather['v_wind']),
112119
'v_wind_2': np.array(weather['v_wind_2']),
113120
'temp_air': np.array(weather['temp_air']),
@@ -165,6 +172,10 @@ def test_run_model(self):
165172
test_mc.run_model(weather, data_height)
166173
assert_series_equal(test_mc.power_output, power_output_exp)
167174

175+
# Test weather as DataFrame
176+
test_mc.run_model(weather_df, data_height)
177+
assert_series_equal(test_mc.power_output, power_output_exp)
178+
168179
# Test weather dictionary with numpy.arrays
169180
power_output_exp = pd.Series(data=[567683.92454, 1485556.96435],
170181
index=[1, 2], name='feedin_wind_turbine')

0 commit comments

Comments
 (0)