Skip to content

Commit fb4f10b

Browse files
committed
Fixing style errors.
1 parent dda3b45 commit fb4f10b

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

windpowerlib/power_output.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,37 @@ def power_curve_density_correction(
237237
238238
"""
239239
if density is None:
240-
raise TypeError("`density` is None. For the calculation with a " +
241-
"density corrected power curve density at hub " +
242-
"height is needed.")
243-
power_output=[(np.interp(
244-
wind_speed[i], power_curve_wind_speeds * (1.225 / density[i]) ** (
245-
np.interp(power_curve_wind_speeds, [7.5, 12.5], [1/3, 2/3])),
246-
power_curve_values, left=0, right=0)) for i in range(len(wind_speed))]
240+
raise TypeError(
241+
"`density` is None. For the calculation with a "
242+
+ "density corrected power curve density at hub "
243+
+ "height is needed."
244+
)
245+
power_output = [
246+
(
247+
np.interp(
248+
wind_speed[i],
249+
power_curve_wind_speeds
250+
* (1.225 / density[i])
251+
** (
252+
np.interp(
253+
power_curve_wind_speeds, [7.5, 12.5], [1 / 3, 2 / 3]
254+
)
255+
),
256+
power_curve_values,
257+
left=0,
258+
right=0,
259+
)
260+
)
261+
for i in range(len(wind_speed))
262+
]
247263

248264
# Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
249265
if isinstance(wind_speed, pd.Series):
250-
power_output=pd.Series(data=power_output, index=wind_speed.index,
251-
name='feedin_power_plant')
266+
power_output = pd.Series(
267+
data=power_output,
268+
index=wind_speed.index,
269+
name="feedin_power_plant",
270+
)
252271
else:
253-
power_output=np.array(power_output)
272+
power_output = np.array(power_output)
254273
return power_output

windpowerlib/wind_speed.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,11 @@ def hellman(
171171
if hellman_exponent is None:
172172
if roughness_length is not None:
173173
# Return np.array if wind_speed is np.array
174-
if (isinstance(wind_speed, np.ndarray) and
175-
isinstance(roughness_length, pd.Series)):
176-
roughness_length=np.array(roughness_length)
177-
hellman_exponent=1 / np.log(hub_height / roughness_length)
174+
if isinstance(wind_speed, np.ndarray) and isinstance(
175+
roughness_length, pd.Series
176+
):
177+
roughness_length = np.array(roughness_length)
178+
hellman_exponent = 1 / np.log(hub_height / roughness_length)
178179
else:
179-
hellman_exponent=1/7
180+
hellman_exponent = 1 / 7
180181
return wind_speed * (hub_height / wind_speed_height) ** hellman_exponent

0 commit comments

Comments
 (0)