Skip to content

Commit 19fb3aa

Browse files
committed
Move up error raising
1 parent dc42eae commit 19fb3aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

windpowerlib/wind_turbine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ def fetch_turbine_data(self, fetch_curve, data_source):
171171
4200000.0
172172
173173
"""
174+
if fetch_curve not in ['power_curve', 'power_coefficient_curve']:
175+
raise ValueError("'{0}' is an invalid value for ".format(
176+
fetch_curve) + "`fetch_curve`. Must be " +
177+
"'power_curve' or 'power_coefficient_curve'.")
174178
if data_source == 'oedb':
175179
curve_df, nominal_power = get_turbine_data_from_oedb(
176180
turbine_type=self.name, fetch_curve=fetch_curve)
@@ -181,10 +185,6 @@ def fetch_turbine_data(self, fetch_curve, data_source):
181185
self.power_curve = curve_df
182186
elif fetch_curve == 'power_coefficient_curve':
183187
self.power_coefficient_curve = curve_df
184-
else:
185-
raise ValueError("'{0}' is an invalid value. ".format(
186-
fetch_curve) + "`fetch_curve` must be " +
187-
"'power_curve' or 'power_coefficient_curve'.")
188188
if self.nominal_power is None:
189189
self.nominal_power = nominal_power
190190
return self

0 commit comments

Comments
 (0)