Skip to content

Commit 5888817

Browse files
committed
Adapt get_turbine_types() to oedb connection
1 parent 36f82c2 commit 5888817

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

windpowerlib/wind_turbine.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -296,36 +296,32 @@ def load_turbine_data_from_oedb():
296296
def get_turbine_types(print_out=True):
297297
r"""
298298
Get the names of all possible wind turbine types for which the power
299-
coefficient curve or power curve is provided in the data files in
300-
the directory windpowerlib/data.
299+
coefficient curve or power curve is provided in the Open Energy Data Base
300+
(oedb).
301301
302302
Parameters
303303
----------
304304
print_out : boolean
305-
Directly prints the list of types if set to True. Default: True.
306-
307-
Other Parameters
308-
----------------
309-
datapath : string, optional
310-
Path where the data file is stored. Default: './data'
311-
filename : string, optional
312-
Name of data file. Provided data files are 'power_curves.csv' and
313-
'power_coefficient_curves.csv'. Default: 'power_curves.csv'.
305+
Directly prints a tabular containing the turbine types in column
306+
'turbine_type'. Default: True.
314307
315308
Examples
316309
--------
317310
>>> from windpowerlib import wind_turbine
318311
>>> turbines = wind_turbine.get_turbine_types(print_out=False)
319-
>>> print(turbines[turbines["turbine_id"].str.contains("ENERCON")].iloc[0])
312+
>>> print(turbines[turbines["turbine_id"].str.contains("ENERCON")].iloc[0]) # todo adapt example
320313
turbine_id ENERCON E 101 3000
321314
p_nom 3000000
322315
Name: 25, dtype: object
323316
324-
"""
325-
df = read_turbine_data(**kwargs)
317+
""" # todo add cp-curves
318+
df = load_turbine_data_from_oedb()
319+
curves_df = df.iloc[df.loc[df['has_power_curve'] == True].index][
320+
['manufacturer', 'turbine_type']]
326321

327322
if print_out:
328-
pd.set_option('display.max_rows', len(df))
329-
print(df[['turbine_id', 'p_nom']])
323+
pd.set_option('display.max_rows', len(curves_df))
324+
print(curves_df)
330325
pd.reset_option('display.max_rows')
331-
return df[['turbine_id', 'p_nom']]
326+
return curves_df
327+

0 commit comments

Comments
 (0)