11import windpowerlib .modelchain as mc
22import windpowerlib .wind_turbine as wt
33from nose .tools import eq_
4+ from pandas .util .testing import assert_series_equal
5+ import pandas as pd
46
57
68class TestModelchain :
@@ -9,8 +11,8 @@ class TestModelchain:
911 def setUpClass (self ):
1012 self .weather = {'temp_air' : 267 ,
1113 'temp_air_2' : 266 ,
12- 'v_wind' : 5.0 ,
13- 'v_wind_2' : 4.0 ,
14+ 'v_wind' : pd . Series ( data = [ 5.0 ]) ,
15+ 'v_wind_2' : pd . Series ( data = [ 4.0 ]) ,
1416 'pressure' : 101125 ,
1517 'z0' : 0.15 }
1618 self .data_height = {'temp_air' : 2 ,
@@ -27,22 +29,26 @@ def setUpClass(self):
2729 'temperature_model' : 'interpolation' ,
2830 'power_output_model' : 'cp_values' ,
2931 'density_corr' : False }
32+ self .test_mc = mc .Modelchain (self .test_wt , ** self .test_modelchain )
3033
3134 def test_v_wind_hub (self ):
32- v_wind_exp = 5.0
35+ v_wind_exp = pd . Series ( data = [ 5.0 ])
3336 self .data_height ['v_wind' ] = 100
34- eq_ (self .test_mc .v_wind_hub (self .weather , self .data_height ),
37+ assert_series_equal (
38+ self .test_mc .v_wind_hub (self .weather , self .data_height ),
3539 v_wind_exp )
3640
37- v_wind_exp = 4.0
41+ v_wind_exp = pd . Series ( data = [ 4.0 ])
3842 self .data_height ['v_wind' ] = 10
3943 self .data_height ['v_wind_2' ] = 100
40- eq_ (self .test_mc .v_wind_hub (self .weather , self .data_height ),
44+ assert_series_equal (
45+ self .test_mc .v_wind_hub (self .weather , self .data_height ),
4146 v_wind_exp )
4247
43- v_wind_exp = 7.7413652271940308
48+ v_wind_exp = pd . Series ( data = [ 6.947477471865689 ])
4449 self .data_height ['v_wind_2' ] = 8
45- eq_ (self .test_mc .v_wind_hub (self .weather , self .data_height ),
50+ assert_series_equal (
51+ self .test_mc .v_wind_hub (self .weather , self .data_height ),
4652 v_wind_exp )
4753
4854 def test_rho_hub (self ):
@@ -52,24 +58,24 @@ def test_rho_hub(self):
5258 rho_exp )
5359
5460 rho_exp = 1.30795205834766
55- self .data_height ['temp_air' ] = 10
61+ self .data_height ['temp_air' ] = 2
5662 self .data_height ['temp_air_2' ] = 100
5763 eq_ (self .test_mc .rho_hub (self .weather , self .data_height ),
5864 rho_exp )
5965
60- rho_exp = 1.305914635138703
61- self .data_height ['temp_air_2' ] = 8
66+ rho_exp = 1.3657124534660552
67+ self .data_height ['temp_air_2' ] = 10
6268 eq_ (self .test_mc .rho_hub (self .weather , self .data_height ),
6369 rho_exp )
6470
6571 def test_run_model_1 (self ):
66- power_output_exp = 724829.76425940311
72+ power_output_exp = pd . Series ( data = [ 724829.76425940311 ])
6773 test_mc = mc .Modelchain (self .test_wt )
6874 test_mc .run_model (self .weather , self .data_height )
69- eq_ (test_mc .power_output , power_output_exp )
75+ assert_series_equal (test_mc .power_output , power_output_exp )
7076
7177 def test_run_model_2 (self ):
72- power_output_exp = 539948.81543840829
78+ power_output_exp = pd . Series ( data = [ 539948.81543840829 ])
7379 test_mc = mc .Modelchain (self .test_wt , ** self .test_modelchain )
7480 test_mc .run_model (self .weather , self .data_height )
75- eq_ (test_mc .power_output , power_output_exp )
81+ assert_series_equal (test_mc .power_output , power_output_exp )
0 commit comments