Skip to content

Commit 3d6d5f6

Browse files
Birgit SchachlerBirgit Schachler
authored andcommitted
Adapt function docstrings to changed names in modelchain
1 parent 907b5e7 commit 3d6d5f6

File tree

3 files changed

+41
-39
lines changed

3 files changed

+41
-39
lines changed

windpowerlib/density.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def barometric(pressure, pressure_height, hub_height, temperature_hub_height):
1313
Calculates the density of air at hub height using the barometric height
1414
equation.
1515
16-
This function is carried out when the parameter `rho_model` of an instance
17-
of the :class:`~.modelchain.ModelChain` class is 'barometric'.
16+
This function is carried out when the parameter `density_model` of an
17+
instance of the :class:`~.modelchain.ModelChain` class is 'barometric'.
1818
1919
Parameters
2020
----------
@@ -70,8 +70,8 @@ def ideal_gas(pressure, pressure_height, hub_height, temperature_hub_height):
7070
r"""
7171
Calculates the density of air at hub height using the ideal gas equation.
7272
73-
This function is carried out when the parameter `rho_model` of an instance
74-
of the :class:`~.modelchain.ModelChain` class is 'ideal_gas'.
73+
This function is carried out when the parameter `density_model` of an
74+
instance of the :class:`~.modelchain.ModelChain` class is 'ideal_gas'.
7575
7676
Parameters
7777
----------

windpowerlib/power_output.py

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@
1111
import pandas as pd
1212

1313

14-
def power_coefficient_curve(wind_speed, cp_values,
15-
rotor_diameter, density, density_corr=False):
14+
def power_coefficient_curve(wind_speed, cp_values, rotor_diameter, density,
15+
density_correction=False):
1616
r"""
1717
Calculates the turbine power output using a power coefficient curve.
1818
1919
This function is carried out when the parameter `power_output_model` of an
20-
instance of the :class:`~.modelchain.ModelChain` class is 'cp_values'. If
21-
the parameter `density_corr` is True the density corrected power curve
22-
(:py:func:`~._p_curve_density_corr`) is used.
20+
instance of the :class:`~.modelchain.ModelChain` class is
21+
'power_coefficient_curve'. If the parameter `density_correction` is True
22+
the density corrected power curve (See
23+
:py:func:`~.power_curve_density_correction`) is used.
2324
2425
Parameters
2526
----------
@@ -32,7 +33,7 @@ def power_coefficient_curve(wind_speed, cp_values,
3233
Rotor diameter in m.
3334
density : pandas.Series or numpy.array
3435
Density of air at hub height in kg/m³.
35-
density_corr : boolean
36+
density_correction : boolean
3637
If the parameter is True the density corrected power curve is used for
3738
the calculation of the turbine power output. Default: False.
3839
@@ -66,20 +67,21 @@ def power_coefficient_curve(wind_speed, cp_values,
6667
Wirtschaftlichkeit". 4. Auflage, Springer-Verlag, 2008, p. 542
6768
6869
"""
69-
if density_corr is False:
70+
if density_correction is False:
7071
cp_time_series = np.interp(wind_speed, cp_values.index, cp_values,
7172
left=0, right=0)
7273
power_output = (1 / 8 * density * rotor_diameter ** 2 * np.pi
7374
* np.power(wind_speed, 3) * cp_time_series)
74-
elif density_corr is True:
75+
elif density_correction is True:
7576
p_values = (1 / 8 * 1.225 * rotor_diameter ** 2 * np.pi *
7677
np.power(cp_values.index, 3) * cp_values)
7778
p_values = pd.Series(np.array(p_values), index=cp_values.index)
78-
power_output = _p_curve_density_corr(wind_speed, p_values, density)
79+
power_output = power_curve_density_correction(wind_speed, p_values,
80+
density)
7981
else:
80-
raise TypeError("'{0}' is an invalid type.".format(type(
81-
density_corr)) + "`density_corr` must be Boolean " +
82-
"(True or False).")
82+
raise TypeError("'{0}' is an invalid type. ".format(type(
83+
density_correction)) + "`density_corr` must be " +
84+
"Boolean (True or False).")
8385

8486
# Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
8587
if isinstance(wind_speed, pd.Series):
@@ -90,14 +92,14 @@ def power_coefficient_curve(wind_speed, cp_values,
9092
return power_output
9193

9294

93-
def power_curve(wind_speed, p_values, density=None, density_corr=False):
95+
def power_curve(wind_speed, p_values, density=None, density_correction=False):
9496
r"""
9597
Calculates the turbine power output using a power curve.
9698
9799
This function is carried out when the parameter `power_output_model` of an
98-
instance of the :class:`~.modelchain.ModelChain` class is 'p_values'. If
99-
the parameter `density_corr` is True the density corrected power curve
100-
(:py:func:`~._p_curve_density_corr`) is used.
100+
instance of the :class:`~.modelchain.ModelChain` class is 'power_curve'. If
101+
the parameter `density_correction` is True the density corrected power
102+
curve (See :py:func:`~.power_curve_density_correction`) is used.
101103
102104
Parameters
103105
----------
@@ -109,7 +111,7 @@ def power_curve(wind_speed, p_values, density=None, density_corr=False):
109111
density : pandas.Series or numpy.array
110112
Density of air at hub height in kg/m³. This parameter is needed
111113
if `density_corr` is True. Default: None.
112-
density_corr : boolean
114+
density_correction : boolean
113115
If the parameter is True the density corrected power curve is used for
114116
the calculation of the turbine power output. In this case `density`
115117
cannot be None. Default: False.
@@ -126,15 +128,16 @@ def power_curve(wind_speed, p_values, density=None, density_corr=False):
126128
and below the minimum wind speed given in the power curve is zero.
127129
128130
"""
129-
if density_corr is False:
131+
if density_correction is False:
130132
power_output = np.interp(wind_speed, p_values.index, p_values,
131133
left=0, right=0)
132-
elif density_corr is True:
133-
power_output = _p_curve_density_corr(wind_speed, p_values, density)
134+
elif density_correction is True:
135+
power_output = power_curve_density_correction(wind_speed, p_values,
136+
density)
134137
else:
135-
raise TypeError("'{0}' is an invalid type.".format(type(
136-
density_corr)) + "`density_corr` must be Boolean " +
137-
"(True or False).")
138+
raise TypeError("'{0}' is an invalid type. ".format(type(
139+
density_correction)) + "`density_corr` must be " +
140+
"Boolean (True or False).")
138141
# Power_output as pd.Series if wind_speed is pd.Series (else: np.array)
139142
if isinstance(wind_speed, pd.Series):
140143
power_output = pd.Series(data=power_output, index=wind_speed.index,
@@ -144,13 +147,13 @@ def power_curve(wind_speed, p_values, density=None, density_corr=False):
144147
return power_output
145148

146149

147-
def _p_curve_density_corr(wind_speed, p_values, density):
150+
def power_curve_density_correction(wind_speed, p_values, density):
148151
r"""
149152
Calculates the turbine power output using a density corrected power curve.
150153
151154
This function is carried out when the parameter `power_output_model` of an
152-
instance of the :class:`~.modelchain.ModelChain` class is 'p_values' and
153-
the parameter `density_corr` is True.
155+
instance of the :class:`~.modelchain.ModelChain` class is 'power_curve'
156+
and the parameter `density_correction` is True.
154157
155158
Parameters
156159
----------
@@ -209,8 +212,8 @@ def _p_curve_density_corr(wind_speed, p_values, density):
209212
"""
210213
if density is None:
211214
raise TypeError("`density` is None. For the calculation with a " +
212-
"density corrected power curve density at hub height" +
213-
"is needed.")
215+
"density corrected power curve density at hub " +
216+
"height is needed.")
214217
return [(np.interp(wind_speed[i],
215218
p_values.index * (1.225 / density[i])**(
216219
np.interp(p_values.index, [7.5, 12.5], [1/3, 2/3])),

windpowerlib/wind_speed.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ def logarithmic_profile(wind_speed, wind_speed_height, hub_height,
1818
1919
The logarithmic height equation is used. There is the possibility of
2020
including the height of the surrounding obstacles in the calculation. This
21-
function is carried out when the parameter `wind_model` of an instance of
22-
the :class:`~.modelchain.ModelChain` class is 'logarithmic' or
23-
'logarithmic_closest'.
21+
function is carried out when the parameter `wind_speed_model` of an
22+
instance of the :class:`~.modelchain.ModelChain` class is 'logarithmic'.
2423
2524
Parameters
2625
----------
@@ -76,9 +75,9 @@ def logarithmic_profile(wind_speed, wind_speed_height, hub_height,
7675
7776
"""
7877
if 0.7 * obstacle_height > wind_speed_height:
79-
raise ValueError("To take an obstacle height of {0} m".format(
80-
obstacle_height) + " into consideration, wind" +
81-
" speed data of a greater height is needed.")
78+
raise ValueError("To take an obstacle height of {0} m ".format(
79+
obstacle_height) + "into consideration, wind " +
80+
"speed data of a greater height is needed.")
8281
# Return np.array if wind_speed is np.array
8382
if (isinstance(wind_speed, np.ndarray) and
8483
isinstance(roughness_length, pd.Series)):
@@ -96,7 +95,7 @@ def hellman(wind_speed, wind_speed_height, hub_height,
9695
Calculates the wind speed at hub height using the hellman equation.
9796
9897
It is assumed that the wind profile follows a power law. This function is
99-
carried out when the parameter `wind_model` of an instance of
98+
carried out when the parameter `wind_speed_model` of an instance of
10099
the :class:`~.modelchain.ModelChain` class is 'hellman'.
101100
102101
Parameters

0 commit comments

Comments
 (0)