@@ -78,24 +78,24 @@ def power_coefficient_curve(wind_speed, power_coefficient_curve_wind_speeds,
7878 power_output = (1 / 8 * density * rotor_diameter ** 2 * np .pi *
7979 np .power (wind_speed , 3 ) *
8080 power_coefficient_time_series )
81+ # Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
82+ if isinstance (wind_speed , pd .Series ):
83+ power_output = pd .Series (data = power_output , index = wind_speed .index ,
84+ name = 'feedin_wind_turbine' )
85+ else :
86+ power_output = np .array (power_output )
8187 elif density_correction is True :
8288 power_curve_values = (1 / 8 * 1.225 * rotor_diameter ** 2 * np .pi *
83- np .power (power_coefficient_curve_wind_speeds , 3 ) *
84- power_coefficient_curve_values )
89+ np .power (power_coefficient_curve_wind_speeds ,
90+ 3 ) *
91+ power_coefficient_curve_values )
8592 power_output = power_curve_density_correction (
8693 wind_speed , power_coefficient_curve_wind_speeds ,
8794 power_curve_values , density )
8895 else :
8996 raise TypeError ("'{0}' is an invalid type. " .format (type (
9097 density_correction )) + "`density_correction` must " +
9198 "be Boolean (True or False)." )
92-
93- # Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
94- if isinstance (wind_speed , pd .Series ):
95- power_output = pd .Series (data = power_output , index = wind_speed .index ,
96- name = 'feedin_wind_turbine' )
97- else :
98- power_output = np .array (power_output )
9999 return power_output
100100
101101
@@ -142,19 +142,19 @@ def power_curve(wind_speed, power_curve_wind_speeds, power_curve_values,
142142 if density_correction is False :
143143 power_output = np .interp (wind_speed , power_curve_wind_speeds ,
144144 power_curve_values , left = 0 , right = 0 )
145+ # Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
146+ if isinstance (wind_speed , pd .Series ):
147+ power_output = pd .Series (data = power_output , index = wind_speed .index ,
148+ name = 'feedin_wind_turbine' )
149+ else :
150+ power_output = np .array (power_output )
145151 elif density_correction is True :
146152 power_output = power_curve_density_correction (
147153 wind_speed , power_curve_wind_speeds , power_curve_values , density )
148154 else :
149155 raise TypeError ("'{0}' is an invalid type. " .format (type (
150156 density_correction )) + "`density_correction` must " +
151157 "be Boolean (True or False)." )
152- # Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
153- if isinstance (wind_speed , pd .Series ):
154- power_output = pd .Series (data = power_output , index = wind_speed .index ,
155- name = 'feedin_wind_turbine' )
156- else :
157- power_output = np .array (power_output )
158158 return power_output
159159
160160
@@ -228,9 +228,15 @@ def power_curve_density_correction(wind_speed, power_curve_wind_speeds,
228228 raise TypeError ("`density` is None. For the calculation with a " +
229229 "density corrected power curve density at hub " +
230230 "height is needed." )
231- return [(np .interp (wind_speed [i ],
232- power_curve_wind_speeds * (1.225 / density [i ])** (
233- np .interp (power_curve_wind_speeds , [7.5 , 12.5 ],
234- [1 / 3 , 2 / 3 ])),
235- power_curve_values , left = 0 , right = 0 ))
236- for i in range (len (wind_speed ))]
231+ power_output = [(np .interp (
232+ wind_speed [i ], power_curve_wind_speeds * (1.225 / density [i ]) ** (
233+ np .interp (power_curve_wind_speeds , [7.5 , 12.5 ], [1 / 3 , 2 / 3 ])),
234+ power_curve_values , left = 0 , right = 0 )) for i in range (len (wind_speed ))]
235+
236+ # Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
237+ if isinstance (wind_speed , pd .Series ):
238+ power_output = pd .Series (data = power_output , index = wind_speed .index ,
239+ name = 'feedin_wind_turbine' )
240+ else :
241+ power_output = np .array (power_output )
242+ return power_output
0 commit comments