Skip to content

Commit 0f1f5f7

Browse files
committed
System exit if non-existing curve of existing turbine type is tried to be used
1 parent a26993a commit 0f1f5f7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

windpowerlib/wind_turbine.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,17 @@ def get_turbine_data_from_oedb(turbine_type, fetch_curve):
296296
else fetch_curve)
297297
# Select curve and nominal power of turbine type
298298
try:
299-
df = pd.DataFrame(turbine_data.loc[turbine_type][curve])
299+
df = turbine_data.loc[turbine_type]
300300
except KeyError:
301301
raise KeyError("Turbine type '{}' not in database. ".format(
302302
turbine_type) + "Use 'get_turbine_types()' to see a table of " +
303303
"possible wind turbine types.")
304+
if df[curve] is not None:
305+
df = pd.DataFrame(df[curve])
306+
else:
307+
sys.exit("{} of {} not available in ".format(curve, turbine_type) +
308+
"oedb. Use 'get_turbine_types()' to see for which turbine " +
309+
"types power coefficient curves are available.")
304310
nominal_power = turbine_data.loc[turbine_type][
305311
'installed_capacity_kw'] * 1000
306312
df.columns = ['wind_speed', 'value']

0 commit comments

Comments
 (0)