@@ -30,11 +30,11 @@ class WindTurbine(object):
3030 Diameter of the rotor in m. Default: None.
3131 power_coefficient_curve : None, pandas.DataFrame or dictionary
3232 Power coefficient curve of the wind turbine. DataFrame/dictionary must
33- have 'wind_speed' and 'power_coefficient ' columns/keys with wind speeds
33+ have 'wind_speed' and 'value ' columns/keys with wind speeds
3434 in m/s and the corresponding power coefficients. Default: None.
3535 power_curve : None, pandas.DataFrame or dictionary
3636 Power curve of the wind turbine. DataFrame/dictionary must have
37- 'wind_speed' and 'power ' columns/keys with wind speeds in m/s and the
37+ 'wind_speed' and 'value ' columns/keys with wind speeds in m/s and the
3838 corresponding power curve value in W. Default: None.
3939 nominal_power : None or float
4040 The nominal output of the wind turbine in W. Default: None.
@@ -65,11 +65,11 @@ class WindTurbine(object):
6565 Diameter of the rotor in m. Default: None.
6666 power_coefficient_curve : None, pandas.DataFrame or dictionary
6767 Power coefficient curve of the wind turbine. DataFrame/dictionary must
68- have 'wind_speed' and 'power_coefficient ' columns/keys with wind speeds
68+ have 'wind_speed' and 'value ' columns/keys with wind speeds
6969 in m/s and the corresponding power coefficients. Default: None.
7070 power_curve : None, pandas.DataFrame or dictionary
7171 Power curve of the wind turbine. DataFrame/dictionary must have
72- 'wind_speed' and 'power ' columns/keys with wind speeds in m/s and the
72+ 'wind_speed' and 'value ' columns/keys with wind speeds in m/s and the
7373 corresponding power curve value in W. Default: None.
7474 nominal_power : None or float
7575 The nominal output of the wind turbine in W. Default: None.
@@ -164,7 +164,7 @@ def fetch_turbine_data(self, fetch_curve, data_source):
164164 ... 'fetch_curve': 'power_coefficient_curve',
165165 ... 'data_source': 'oedb'}
166166 >>> e126 = wind_turbine.WindTurbine(**enerconE126)
167- >>> print(e126.power_coefficient_curve['power_coefficient '][5])
167+ >>> print(e126.power_coefficient_curve['value '][5])
168168 0.44
169169 >>> print(e126.nominal_power)
170170 4200000.0
@@ -177,13 +177,8 @@ def fetch_turbine_data(self, fetch_curve, data_source):
177177 curve_df , nominal_power = get_turbine_data_from_file (
178178 turbine_type = self .name , file_ = data_source )
179179 if fetch_curve == 'power_curve' :
180- curve_df .columns = ['wind_speed' , 'power' ]
181- if data_source == 'oedb' :
182- # power values in W
183- curve_df ['power' ] = curve_df ['power' ] * 1000
184180 self .power_curve = curve_df
185181 elif fetch_curve == 'power_coefficient_curve' :
186- curve_df .columns = ['wind_speed' , 'power_coefficient' ]
187182 self .power_coefficient_curve = curve_df
188183 else :
189184 raise ValueError ("'{0}' is an invalid value. " .format (
@@ -233,7 +228,7 @@ def get_turbine_data_from_file(turbine_type, file_):
233228 ... 'fetch_curve': 'power_curve',
234229 ... 'data_source': source}
235230 >>> e_t_1 = wind_turbine.WindTurbine(**example_turbine)
236- >>> print(e_t_1.power_curve['power '][7])
231+ >>> print(e_t_1.power_curve['value '][7])
237232 18000.0
238233 >>> print(e_t_1.nominal_power)
239234 150000
@@ -263,7 +258,8 @@ def isfloat(x):
263258 cols = [_ for _ in wpp_df .columns if isfloat (_ )]
264259 curve_data = wpp_df [cols ].dropna (axis = 1 )
265260 df = curve_data .transpose ().reset_index ()
266- df ['index' ] = df ['index' ].apply (lambda x : float (x ))
261+ df .columns = ['wind_speed' , 'value' ]
262+ df ['wind_speed' ] = df ['wind_speed' ].apply (lambda x : float (x ))
267263 nominal_power = wpp_df ['p_nom' ].iloc [0 ]
268264 return df , nominal_power
269265
@@ -307,6 +303,10 @@ def get_turbine_data_from_oedb(turbine_type, fetch_curve):
307303 "possible wind turbine types." )
308304 nominal_power = turbine_data .loc [turbine_type ][
309305 'installed_capacity_kw' ] * 1000
306+ df .columns = ['wind_speed' , 'value' ]
307+ if fetch_curve == 'power_curve' :
308+ # power in W
309+ df ['value' ] = df ['value' ] * 1000
310310 return df , nominal_power
311311
312312
0 commit comments