@@ -440,17 +440,23 @@ def load_turbine_data_from_oedb():
440440 return turbine_data
441441
442442
443- def get_turbine_types (print_out = True , filter_ = True ):
443+ def get_turbine_types (turbine_library = 'local' , print_out = True , filter_ = True ):
444444 r"""
445- Get all wind turbine types provided in the oedb turbine library .
445+ Get all provided wind turbine types provided.
446446
447+ Choose by `turbine_library` whether to get wind turbine types provided by
448+ the OpenEnergy Database ('oedb') or wind turbine types provided in your
449+ local file(s) ('local').
447450 By default only turbine types for which a power coefficient curve or power
448451 curve is provided are returned. Set `filter_=False` to see all turbine
449452 types for which any data (e.g. hub height, rotor diameter, ...) is
450453 provided.
451454
452455 Parameters
453456 ----------
457+ turbine_library : str
458+ Specifies if the oedb turbine library ('oedb') or your local turbine
459+ data file ('local') is evaluated. Default: 'local'.
454460 print_out : bool
455461 Directly prints a tabular containing the turbine types in column
456462 'turbine_type', the manufacturer in column 'manufacturer' and
@@ -496,8 +502,15 @@ def get_turbine_types(print_out=True, filter_=True):
496502 Name: 1, dtype: object
497503
498504 """
499- # ToDo Use local csv files instead of querying the oedb
500- df = load_turbine_data_from_oedb ()
505+ if turbine_library == 'local' :
506+ filename = os .path .join (os .path .dirname (__file__ ), 'data' ,
507+ 'oedb_turbine_data.csv' )
508+ df = pd .read_csv (filename , index_col = 0 ).reset_index ()
509+ elif turbine_library == 'oedb' :
510+ df = load_turbine_data_from_oedb ()
511+ else :
512+ raise ValueError ("`turbine_library` is {} " .format (turbine_library ) +
513+ "but must be 'local' or 'oedb'." )
501514 if filter_ :
502515 cp_curves_df = df .loc [df ['has_cp_curve' ]][
503516 ['manufacturer' , 'turbine_type' , 'has_cp_curve' ]]
@@ -513,3 +526,6 @@ def get_turbine_types(print_out=True, filter_=True):
513526 print (curves_df )
514527 pd .reset_option ('display.max_rows' )
515528 return curves_df
529+
530+
531+ if __name__ == "__main__" :
0 commit comments