Skip to content

Commit 11a3210

Browse files
authored
Update power_output.py
1 parent 7c386a0 commit 11a3210

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

windpowerlib/power_output.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,17 +236,16 @@ def power_curve_density_correction(
236236
+ "height is needed."
237237
)
238238

239-
# NOTE : CHANGES ARE MADE HERE FOR SPEED IMPROVEMENT
240-
# create a flag for pandas Series type
241-
Panda_series = False
242-
239+
# Convert pandas.Series to a numpy array to speed up the interpolation below.
243240
if isinstance(wind_speed, pd.Series):
244241
# save the indexes for later conversion to pd.Series
245-
indexes = wind_speed.index
242+
wind_speed_indexes = wind_speed.index
246243
# change the wind speed Series to numpy array
247244
wind_speed = wind_speed.values
248-
# Set the panda flag True
249-
Panda_series = True
245+
# Set the panda series flag True
246+
panda_series = True
247+
else:
248+
panda_series = False
250249

251250
power_output = [
252251
(
@@ -268,10 +267,10 @@ def power_curve_density_correction(
268267
]
269268

270269
# Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
271-
if Panda_series: # use the flag to check
270+
if panda_series: # use the flag to check if the data should be converted back to pandas.Series
272271
power_output = pd.Series(
273272
data=power_output,
274-
index=indexes, # Use previously saved indexes
273+
index=wind_speed_indexes, # Use previously saved wind speed indexes
275274
name="feedin_power_plant",
276275
)
277276
else:

0 commit comments

Comments
 (0)