Skip to content

Commit 207569d

Browse files
committed
Rename and change type of WindTurbine attributes p_values and cp_values
1 parent e17295c commit 207569d

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

windpowerlib/wind_turbine.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,20 @@ class WindTurbine(object):
2929
Hub height of the wind turbine in m.
3030
rotor_diameter : None or float
3131
Diameter of the rotor in m.
32-
cp_values : None or pandas.DataFrame
33-
Power coefficient curve of the wind turbine.
34-
The indices of the DataFrame are the corresponding wind speeds of the
35-
power coefficient curve, the power coefficient values are listed in
36-
the column 'cp'. Default: None.
37-
p_values : None or pandas.DataFrame
38-
Power curve of the wind turbine.
39-
The indices of the DataFrame are the corresponding wind speeds of the
40-
power curve, the power values are listed in the column 'p'.
41-
Default: None.
32+
power_coefficient_curve : None, pandas.DataFrame or dictionary
33+
Power coefficient curve of the wind turbine. DataFrame/dictionary must
34+
have 'wind_speed' and 'values' columns/keys with wind speeds in m/s
35+
and the corresponding power coefficients. Default: None.
36+
power_curve : None, pandas.DataFrame or dictionary
37+
Power curve of the wind turbine. DataFrame/dictionary must have
38+
'wind_speed' and 'values' columns/keys with wind speeds in m/s and the
39+
corresponding power curve value in W. Default: None.
4240
nominal_power : None or float
4341
The nominal output of the wind turbine in W.
4442
fetch_curve : string
4543
Parameter to specify whether the power or power coefficient curve
46-
should be retrieved from the provided turbine data. Default: 'p'.
44+
should be retrieved from the provided turbine data. Valid options are
45+
'power_curve' and 'power_coefficient_curve'. Default: 'power_curve'.
4746
4847
Attributes
4948
----------
@@ -55,21 +54,20 @@ class WindTurbine(object):
5554
Hub height of the wind turbine in m.
5655
rotor_diameter : None or float
5756
Diameter of the rotor in m.
58-
cp_values : None or pandas.DataFrame
59-
Power coefficient curve of the wind turbine.
60-
The indices of the DataFrame are the corresponding wind speeds of the
61-
power coefficient curve, the power coefficient values are listed in
62-
the column 'cp'. Default: None.
63-
p_values : None or pandas.DataFrame
64-
Power curve of the wind turbine.
65-
Indices are the wind speeds of the power curve in m/s, the
66-
corresponding power values in W are in the column 'p'.
67-
Default: None.
57+
power_coefficient_curve : None, pandas.DataFrame or dictionary
58+
Power coefficient curve of the wind turbine. DataFrame/dictionary must
59+
have 'wind_speed' and 'values' columns/keys with wind speeds in m/s
60+
and the corresponding power coefficients. Default: None.
61+
power_curve : None, pandas.DataFrame or dictionary
62+
Power curve of the wind turbine. DataFrame/dictionary must have
63+
'wind_speed' and 'values' columns/keys with wind speeds in m/s and the
64+
corresponding power curve value in W. Default: None.
6865
nominal_power : None or float
6966
The nominal output of the wind turbine in W.
7067
fetch_curve : string
7168
Parameter to specify whether the power or power coefficient curve
72-
should be retrieved from the provided turbine data. Default: 'p'.
69+
should be retrieved from the provided turbine data. Valid options are
70+
'power_curve' and 'power_coefficient_curve'. Default: 'power_curve'.
7371
power_output : pandas.Series
7472
The calculated power output of the wind turbine.
7573
@@ -87,20 +85,20 @@ class WindTurbine(object):
8785
"""
8886

8987
def __init__(self, turbine_name, hub_height, rotor_diameter=None,
90-
cp_values=None, p_values=None, nominal_power=None,
91-
fetch_curve='p'):
88+
power_coefficient_curve=None, power_curve=None,
89+
nominal_power=None, fetch_curve='power_curve'):
9290

9391
self.turbine_name = turbine_name
9492
self.hub_height = hub_height
9593
self.rotor_diameter = rotor_diameter
96-
self.cp_values = cp_values
97-
self.p_values = p_values
94+
self.power_coefficient_curve = power_coefficient_curve
95+
self.power_curve = power_curve
9896
self.nominal_power = nominal_power
9997
self.fetch_curve = fetch_curve
10098

10199
self.power_output = None
102100

103-
if self.cp_values is None and self.p_values is None:
101+
if self.power_coefficient_curve is None and self.power_curve is None:
104102
self.fetch_turbine_data()
105103

106104
def fetch_turbine_data(self):
@@ -112,7 +110,7 @@ def fetch_turbine_data(self):
112110
You can also use this function to import your own power (coefficient)
113111
curves. Therefore the wind speeds in m/s have to be in the first row
114112
and the corresponding power coefficient curve values or power
115-
curve values in kW in a row where the first column contains the turbine
113+
curve values in W in a row where the first column contains the turbine
116114
name (See directory windpowerlib/data as reference).
117115
118116
Returns
@@ -149,7 +147,7 @@ def restructure_data():
149147
and nominal power (float).
150148
Power (coefficient) curve DataFrame contains power coefficient
151149
curve values (dimensionless) or power curve values in W with
152-
the corresponding wind speeds in m/s as indices.
150+
the corresponding wind speeds in m/s.
153151
154152
"""
155153
df = read_turbine_data(filename=filename)
@@ -208,14 +206,16 @@ def read_turbine_data(**kwargs):
208206
-------
209207
pandas.DataFrame
210208
Power coefficient curve values (dimensionless) or power curve values
211-
in kW with the corresponding wind speeds in m/s as indices.
209+
in kW with corresponding wind speeds in m/s of all available wind
210+
turbines with turbine name in column 'turbine_id', turbine nominal
211+
power in column 'p_nom'.
212212
213213
"""
214214
if 'datapath' not in kwargs:
215215
kwargs['datapath'] = os.path.join(os.path.dirname(__file__), 'data')
216216

217217
if 'filename' not in kwargs:
218-
kwargs['filename'] = 'p_curves.csv'
218+
kwargs['filename'] = 'power_curves.csv'
219219

220220
df = pd.read_csv(os.path.join(kwargs['datapath'], kwargs['filename']),
221221
index_col=0)
@@ -231,7 +231,7 @@ def get_turbine_types(print_out=True, **kwargs):
231231
Parameters
232232
----------
233233
print_out : boolean
234-
Directly prints the list of types if set to True. Default: True
234+
Directly prints the list of types if set to True. Default: True.
235235
236236
Examples
237237
--------
@@ -249,4 +249,4 @@ def get_turbine_types(print_out=True, **kwargs):
249249
pd.set_option('display.max_rows', len(df))
250250
print(df[['turbine_id', 'p_nom']])
251251
pd.reset_option('display.max_rows')
252-
return df[['turbine_id', 'p_nom']]
252+
return df[['turbine_id', 'p_nom']]

0 commit comments

Comments
 (0)