@@ -64,13 +64,11 @@ def cp_curve(v_wind, rho_hub, d_rotor, cp_values):
6464 left = 0 , right = 0 )
6565 power_output = (1 / 8 * rho_hub * d_rotor ** 2 * np .pi
6666 * np .power (v_wind , 3 ) * cp_time_series )
67- # Set index for time series
68- try :
69- series_index = v_wind .index
70- except AttributeError :
71- series_index = range (1 , len (power_output )+ 1 )
72- return pd .Series (data = power_output , index = series_index ,
73- name = 'feedin_wind_turbine' )
67+ # Power_output as pd.Series if v_wind is pd.Series
68+ if isinstance (v_wind , pd .Series ):
69+ power_output = pd .Series (data = power_output , index = v_wind .index ,
70+ name = 'feedin_wind_turbine' )
71+ return power_output
7472
7573
7674def cp_curve_density_corr (v_wind , rho_hub , d_rotor , cp_values ):
@@ -146,13 +144,11 @@ def p_curve(v_wind, p_values):
146144 """
147145 power_output = np .interp (v_wind , p_values .index , p_values .p ,
148146 left = 0 , right = 0 )
149- # Set index for time series
150- try :
151- series_index = v_wind .index
152- except AttributeError :
153- series_index = range (1 , len (power_output )+ 1 )
154- return pd .Series (data = power_output , index = series_index ,
155- name = 'feedin_wind_turbine' )
147+ # Power_output as pd.Series if v_wind is pd.Series
148+ if isinstance (v_wind , pd .Series ):
149+ power_output = pd .Series (data = power_output , index = v_wind .index ,
150+ name = 'feedin_wind_turbine' )
151+ return power_output
156152
157153
158154def p_curve_density_corr (v_wind , rho_hub , p_values ):
@@ -225,11 +221,8 @@ def p_curve_density_corr(v_wind, rho_hub, p_values):
225221 [7.5 , 12.5 ], [1 / 3 , 2 / 3 ])),
226222 p_values .p , left = 0 , right = 0 ))
227223 for i in range (len (v_wind ))]
228-
229- # Set index for time series
230- try :
231- series_index = v_wind .index
232- except AttributeError :
233- series_index = range (1 , len (power_output )+ 1 )
234- return pd .Series (data = power_output , index = series_index ,
235- name = 'feedin_wind_turbine' )
224+ # Power_output as pd.Series if v_wind is pd.Series
225+ if isinstance (v_wind , pd .Series ):
226+ power_output = pd .Series (data = power_output , index = v_wind .index ,
227+ name = 'feedin_wind_turbine' )
228+ return power_output
0 commit comments