1- from windpowerlib .wind_speed import logarithmic_wind_profile , v_wind_hellman
1+ from windpowerlib .wind_speed import logarithmic_profile , hellman
22import pandas as pd
33from pandas .util .testing import assert_series_equal
44import numpy as np
88
99class TestWindSpeed :
1010
11- def test_logarithmic_wind_profile (self ):
11+ def test_logarithmic_profile (self ):
1212 parameters = {'wind_speed' : pd .Series (data = [5.0 , 6.5 ]),
1313 'wind_speed_height' : 10 ,
1414 'hub_height' : 100 ,
@@ -18,43 +18,43 @@ def test_logarithmic_wind_profile(self):
1818 # Test wind_speed as pd.Series with roughness_length as pd.Series,
1919 # np.array and float
2020 v_wind_hub_exp = pd .Series (data = [7.74136523 , 10.0637748 ])
21- assert_series_equal (logarithmic_wind_profile (** parameters ),
21+ assert_series_equal (logarithmic_profile (** parameters ),
2222 v_wind_hub_exp )
2323 parameters ['roughness_length' ] = np .array (
2424 parameters ['roughness_length' ])
25- assert_series_equal (logarithmic_wind_profile (** parameters ),
25+ assert_series_equal (logarithmic_profile (** parameters ),
2626 v_wind_hub_exp )
2727 parameters ['roughness_length' ] = parameters ['roughness_length' ][0 ]
28- assert_series_equal (logarithmic_wind_profile (** parameters ),
28+ assert_series_equal (logarithmic_profile (** parameters ),
2929 v_wind_hub_exp )
3030
3131 # Test wind_speed as np.array with roughness_length as float, pd.Series
3232 # and np.array
3333 v_wind_hub_exp = np .array ([7.74136523 , 10.0637748 ])
3434 parameters ['wind_speed' ] = np .array (parameters ['wind_speed' ])
35- assert_allclose (logarithmic_wind_profile (** parameters ), v_wind_hub_exp )
36- assert isinstance (logarithmic_wind_profile (** parameters ), np .ndarray )
35+ assert_allclose (logarithmic_profile (** parameters ), v_wind_hub_exp )
36+ assert isinstance (logarithmic_profile (** parameters ), np .ndarray )
3737 parameters ['roughness_length' ] = pd .Series (
3838 data = [parameters ['roughness_length' ],
3939 parameters ['roughness_length' ]])
40- assert_allclose (logarithmic_wind_profile (** parameters ), v_wind_hub_exp )
41- assert isinstance (logarithmic_wind_profile (** parameters ), np .ndarray )
40+ assert_allclose (logarithmic_profile (** parameters ), v_wind_hub_exp )
41+ assert isinstance (logarithmic_profile (** parameters ), np .ndarray )
4242 parameters ['roughness_length' ] = np .array (
4343 parameters ['roughness_length' ])
44- assert_allclose (logarithmic_wind_profile (** parameters ), v_wind_hub_exp )
45- assert isinstance (logarithmic_wind_profile (** parameters ), np .ndarray )
44+ assert_allclose (logarithmic_profile (** parameters ), v_wind_hub_exp )
45+ assert isinstance (logarithmic_profile (** parameters ), np .ndarray )
4646
4747 # Test obstacle_height is not zero
4848 v_wind_hub_exp = np .array ([13.54925281 , 17.61402865 ])
4949 parameters ['obstacle_height' ] = 12
50- assert_allclose (logarithmic_wind_profile (** parameters ), v_wind_hub_exp )
50+ assert_allclose (logarithmic_profile (** parameters ), v_wind_hub_exp )
5151
5252 # Raise ValueError due to 0.7 * `obstacle_height` > `wind_speed_height`
5353 with pytest .raises (ValueError ):
5454 parameters ['obstacle_height' ] = 20
55- logarithmic_wind_profile (** parameters )
55+ logarithmic_profile (** parameters )
5656
57- def test_v_wind_hellman (self ):
57+ def test_hellman (self ):
5858 parameters = {'wind_speed' : pd .Series (data = [5.0 , 6.5 ]),
5959 'wind_speed_height' : 10 ,
6060 'hub_height' : 100 ,
@@ -64,37 +64,37 @@ def test_v_wind_hellman(self):
6464 # Test wind_speed is pd.Series with roughness_length is pd.Series,
6565 # np.array and float
6666 v_wind_hub_exp = pd .Series (data = [7.12462437 , 9.26201168 ])
67- assert_series_equal (v_wind_hellman (** parameters ), v_wind_hub_exp )
67+ assert_series_equal (hellman (** parameters ), v_wind_hub_exp )
6868 parameters ['roughness_length' ] = np .array (
6969 parameters ['roughness_length' ])
70- assert_series_equal (v_wind_hellman (** parameters ), v_wind_hub_exp )
70+ assert_series_equal (hellman (** parameters ), v_wind_hub_exp )
7171 parameters ['roughness_length' ] = parameters ['roughness_length' ][0 ]
72- assert_series_equal (v_wind_hellman (** parameters ), v_wind_hub_exp )
72+ assert_series_equal (hellman (** parameters ), v_wind_hub_exp )
7373
7474 # Test wind_speed as np.array with roughness_length is float, pd.Series
7575 # and np.array
7676 v_wind_hub_exp = np .array ([7.12462437 , 9.26201168 ])
7777 parameters ['wind_speed' ] = np .array (parameters ['wind_speed' ])
78- assert_allclose (v_wind_hellman (** parameters ), v_wind_hub_exp )
79- assert isinstance (v_wind_hellman (** parameters ), np .ndarray )
78+ assert_allclose (hellman (** parameters ), v_wind_hub_exp )
79+ assert isinstance (hellman (** parameters ), np .ndarray )
8080 parameters ['roughness_length' ] = pd .Series (
8181 data = (parameters ['roughness_length' ],
8282 parameters ['roughness_length' ]))
83- assert_allclose (v_wind_hellman (** parameters ), v_wind_hub_exp )
84- assert isinstance (v_wind_hellman (** parameters ), np .ndarray )
83+ assert_allclose (hellman (** parameters ), v_wind_hub_exp )
84+ assert isinstance (hellman (** parameters ), np .ndarray )
8585 parameters ['roughness_length' ] = np .array (
8686 parameters ['roughness_length' ])
87- assert_allclose (v_wind_hellman (** parameters ), v_wind_hub_exp )
88- assert isinstance (v_wind_hellman (** parameters ), np .ndarray )
87+ assert_allclose (hellman (** parameters ), v_wind_hub_exp )
88+ assert isinstance (hellman (** parameters ), np .ndarray )
8989
9090 # Test roughness_length is None and hellman_exponent is None
9191 v_wind_hub_exp = pd .Series (data = [6.9474774 , 9.03172 ])
9292 parameters ['wind_speed' ] = pd .Series (data = parameters ['wind_speed' ])
9393 parameters ['roughness_length' ] = None
94- assert_series_equal (v_wind_hellman (** parameters ), v_wind_hub_exp )
94+ assert_series_equal (hellman (** parameters ), v_wind_hub_exp )
9595
9696 # Test hellman_exponent is not None
9797 v_wind_hub_exp = pd .Series (data = [7.92446596 , 10.30180575 ])
9898 parameters ['roughness_length' ] = 0.15
9999 parameters ['hellman_exponent' ] = 0.2
100- assert_series_equal (v_wind_hellman (** parameters ), v_wind_hub_exp )
100+ assert_series_equal (hellman (** parameters ), v_wind_hub_exp )
0 commit comments