|
10 | 10 | import numpy as np |
11 | 11 | import pandas as pd |
12 | 12 | from windpowerlib import tools |
| 13 | +import os |
13 | 14 |
|
14 | 15 |
|
15 | 16 | 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, |
39 | 40 | turbulence intensity : Float, optional |
40 | 41 | Turbulence intensity at hub height of the wind turbine the power curve |
41 | 42 | is smoothed for. |
| 43 | + area_dimension : Float, optional |
| 44 | + Dimension of the area the feed-in is calculated for in km. |
42 | 45 |
|
43 | 46 | Returns |
44 | 47 | ------- |
@@ -70,7 +73,13 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values, |
70 | 73 | "using 'turbulence_intensity' as " + |
71 | 74 | "`standard_deviation_method`") |
72 | 75 | 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 |
74 | 83 | elif standard_deviation_method == 'Staffell': |
75 | 84 | normalized_standard_deviation = 0.2 |
76 | 85 | # Initialize list for power curve values |
@@ -110,15 +119,15 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values, |
110 | 119 | smoothed_power_curve_values]).transpose() |
111 | 120 | # Rename columns of DataFrame |
112 | 121 | 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 |
122 | 131 | return smoothed_power_curve_df |
123 | 132 |
|
124 | 133 |
|
|
0 commit comments