Skip to content

Commit 48e1215

Browse files
committed
Try Norgaard standard deviation
1 parent fe7a4e1 commit 48e1215

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

windpowerlib/power_curves.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import numpy as np
1111
import pandas as pd
1212
from windpowerlib import tools
13+
import os
1314

1415

1516
def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
@@ -39,6 +40,8 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
3940
turbulence intensity : Float, optional
4041
Turbulence intensity at hub height of the wind turbine the power curve
4142
is smoothed for.
43+
area_dimension : Float, optional
44+
Dimension of the area the feed-in is calculated for in km.
4245
4346
Returns
4447
-------
@@ -70,7 +73,13 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
7073
"using 'turbulence_intensity' as " +
7174
"`standard_deviation_method`")
7275
elif standard_deviation_method == 'Norgaard':
73-
pass # TODO add
76+
if 'area_dimension' not in kwargs:
77+
raise ValueError("area_dimension must be defined when " +
78+
"'Norgaard' is being used as method.") # TODO raise error if no TI
79+
standard_deviation_df = pd.read_csv(
80+
os.path.join(os.path.dirname(__file__),
81+
'data/Norgaard_standard_deviation.csv'), index_col=0)
82+
normalized_standard_deviation = 0.09
7483
elif standard_deviation_method == 'Staffell':
7584
normalized_standard_deviation = 0.2
7685
# Initialize list for power curve values
@@ -110,15 +119,15 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
110119
smoothed_power_curve_values]).transpose()
111120
# Rename columns of DataFrame
112121
smoothed_power_curve_df.columns = ['wind_speed', 'power']
113-
# # Plot power curves
114-
# fig = plt.figure()
115-
# plt.plot(power_curve_wind_speeds.values, power_curve_values.values)
116-
# plt.plot(power_curve_wind_speeds.values, smoothed_power_curve_values)
117-
# fig.savefig(os.path.abspath(os.path.join(
118-
# os.path.dirname(__file__), '../Plots/power_curves',
119-
# '{0}_{1}_{2}.png'.format(kwargs['object_name'],
120-
# standard_deviation_method, block_width))))
121-
# plt.close() # TODO: delete plot later
122+
# # Plot power curves
123+
# fig = plt.figure()
124+
# plt.plot(power_curve_wind_speeds.values, power_curve_values.values)
125+
# plt.plot(power_curve_wind_speeds.values, smoothed_power_curve_values)
126+
# fig.savefig(os.path.abspath(os.path.join(
127+
# os.path.dirname(__file__), '../Plots/power_curves',
128+
# '{0}_{1}_{2}.png'.format(kwargs['object_name'],
129+
# standard_deviation_method, block_width))))
130+
# plt.close() # TODO: delete plot later
122131
return smoothed_power_curve_df
123132

124133

0 commit comments

Comments
 (0)