Skip to content

Commit 6b2dfc1

Browse files
committed
Second requirement in if statement
z_0 is only converted to np.array is it is a pd.Series (and v_wind is np.array). z_0 does not have to be converted if it is float or np.array.
1 parent 5da9d6a commit 6b2dfc1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

windpowerlib/wind_speed.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
__license__ = "GPLv3"
99

1010
import numpy as np
11+
import pandas as pd
1112

1213

1314
def logarithmic_wind_profile(v_wind, v_wind_height, hub_height, z_0,
@@ -79,7 +80,7 @@ def logarithmic_wind_profile(v_wind, v_wind_height, hub_height, z_0,
7980
obstacle_height) + " into consideration, wind" +
8081
" speed data of a greater height is needed.")
8182
# Return np.array if v_wind is np.array
82-
if isinstance(v_wind, np.ndarray):
83+
if (isinstance(v_wind, np.ndarray) and isinstance(z_0, pd.Series)):
8384
z_0 = np.array(z_0)
8485
return (v_wind * np.log((hub_height - 0.7 * obstacle_height) / z_0) /
8586
np.log((v_wind_height - 0.7 * obstacle_height) / z_0))
@@ -153,7 +154,7 @@ def v_wind_hellman(v_wind, v_wind_height, hub_height, z_0=None,
153154
if hellman_exp is None:
154155
if z_0 is not None:
155156
# Return np.array if v_wind is np.array
156-
if isinstance(v_wind, np.ndarray):
157+
if (isinstance(v_wind, np.ndarray) and isinstance(z_0, pd.Series)):
157158
z_0 = np.array(z_0)
158159
hellman_exp = 1 / np.log(hub_height / z_0)
159160
else:

0 commit comments

Comments
 (0)