Skip to content

Commit 40aa3ba

Browse files
Birgit SchachlerBirgit Schachler
authored andcommitted
Merge branch 'dev' into features/revise_example
2 parents 6ec9244 + 4756c97 commit 40aa3ba

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

windpowerlib/wind_turbine.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,15 @@ def fetch_turbine_data(self):
108108
109109
Method fetches nominal power as well as power coefficient curve or
110110
power curve from a data file provided along with the windpowerlib.
111+
You can also use this function to import your own power (coefficient)
112+
curves. Therefore the wind speeds in m/s have to be in the first row
113+
and the corresponding power coefficient curve values or power
114+
curve values in W in a row where the first column contains the turbine
115+
name (See directory windpowerlib/data as reference).
111116
112117
Returns
113118
-------
114-
float
115-
Nominal power of the requested wind turbine.
119+
self
116120
117121
Examples
118122
--------
@@ -139,19 +143,21 @@ def restructure_data():
139143
Returns
140144
-------
141145
Tuple (pd.DataFrame, float)
142-
Power curve or power coefficient curve (pd.DataFrame)
143-
and nominal power (float).
146+
Power curve (values in W) or power coefficient curve as
147+
pd.DataFrame and nominal power as float in W.
144148
145149
"""
146150
df = read_turbine_data(filename=filename)
147151
wpp_df = df[df.turbine_id == self.turbine_name]
152+
# if turbine not in data file
148153
if wpp_df.shape[0] == 0:
149154
pd.set_option('display.max_rows', len(df))
150155
logging.info('Possible types: \n{0}'.format(df.turbine_id))
151156
pd.reset_option('display.max_rows')
152157
sys.exit('Cannot find the wind converter type: {0}'.format(
153158
self.turbine_name))
154-
159+
# if turbine in data file write power (coefficient) curve values
160+
# to 'data' array
155161
ncols = ['turbine_id', 'p_nom', 'source', 'modificationtimestamp']
156162
data = np.array([0, 0])
157163
for col in wpp_df.keys():
@@ -163,12 +169,12 @@ def restructure_data():
163169
data = np.delete(data, 0, 0)
164170
df = pd.DataFrame(data, columns=['v_wind', self.fetch_curve])
165171
df.set_index('v_wind', drop=True, inplace=True)
166-
nominal_power = wpp_df['p_nom'].iloc[0]
172+
nominal_power = wpp_df['p_nom'].iloc[0] * 1000.0
167173
return df, nominal_power
168174
if self.fetch_curve == 'p':
169175
filename = 'p_curves.csv'
170176
p_values, p_nom = restructure_data()
171-
self.p_values = p_values
177+
self.p_values = p_values * 1000.0
172178
else:
173179
filename = 'cp_curves.csv'
174180
self.cp_values, p_nom = restructure_data()

0 commit comments

Comments
 (0)