Skip to content

Commit 3b8bac1

Browse files
committed
Add comments
1 parent 3c5998e commit 3b8bac1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

windpowerlib/wind_farm.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,16 @@ def read_wind_efficiency_curve(curve_name='dena_mean', plot=False):
169169
"""
170170
path = os.path.join(os.path.dirname(__file__), 'data',
171171
'wind_efficiency_curves.csv')
172+
# Read all curves from file
172173
wind_efficiency_curves = pd.read_csv(path)
174+
# Create wind speed series with standard wind speeds in 0.5 m/s step size
173175
wind_speed = pd.Series(np.arange(0, 25.5, 0.5))
176+
# Get x values depending on curve name
174177
if 'dena' in curve_name:
175178
x_values = wind_efficiency_curves['x_dena']
176179
if 'knorr' in curve_name:
177180
x_values = wind_efficiency_curves['x_knorr']
181+
# Interpolate between the x values and create data frame
178182
efficiency = np.interp(
179183
wind_speed, x_values.dropna(),
180184
wind_efficiency_curves[curve_name].dropna())
@@ -216,16 +220,21 @@ def display_wind_efficiency_curves():
216220
"""
217221
path = os.path.join(os.path.dirname(__file__), 'data',
218222
'wind_efficiency_curves.csv')
223+
# Read all curves from file
219224
wind_efficiency_curves = pd.read_csv(path)
225+
# Initialize data frame for plot
220226
curves_df = pd.DataFrame()
221227
for curve_name in [col for col in list(wind_efficiency_curves) if
222228
'x_' not in col]:
229+
# Get wind efficiency curve for standard wind speeds from
230+
# read_wind_efficiency_curve() and add to data frame
223231
efficiency_curve = read_wind_efficiency_curve(
224232
curve_name).rename(
225233
columns={'efficiency': curve_name.replace('_', ' '),
226234
'wind_speed': 'wind speed m/s'}).set_index(
227235
'wind speed m/s')
228236
curves_df = pd.concat([curves_df, efficiency_curve], axis=1)
237+
# Create separate data frames for origin of curve
229238
knorr_df = curves_df[[column_name for column_name in curves_df if
230239
'knorr' in column_name]]
231240
dena_df = curves_df[[column_name for column_name in curves_df if

0 commit comments

Comments
 (0)