Skip to content

Commit 2156caa

Browse files
committed
Add and extend docstring to show usage of 'to_group' message.
1 parent f22bb70 commit 2156caa

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

windpowerlib/wind_farm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ class WindFarm(object):
9494
>>> print(example_farm.nominal_power)
9595
31200000.0
9696
>>> # turbine fleet as list of WindTurbine using the 'to_group' method.
97-
>>> wind_turbine_fleet = [e126.to_group(number_turbines=6),
97+
>>> wind_turbine_fleet = [e126.to_group(number_turbines=5),
98+
... e126.to_group(),
9899
... v90.to_group(total_capacity=3 * 2e6)]
99100
>>> example_farm = wind_farm.WindFarm(wind_turbine_fleet)
100101
>>> print(example_farm.nominal_power)

windpowerlib/wind_turbine.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ class WindTurbine(object):
115115
1500000.0
116116
>>> print(e_t_1.to_group(5)['number_of_turbines'])
117117
5
118-
118+
>>> print(e_t_1.to_group()['number_of_turbines'])
119+
1
120+
>>> print(e_t_1.to_group(number_turbines=7)['number_of_turbines'])
121+
7
122+
>>> print(e_t_1.to_group(total_capacity=4500000)['number_of_turbines'])
123+
3.0
119124
"""
120125

121126
def __init__(self, hub_height, nominal_power=None, path='oedb',
@@ -201,6 +206,18 @@ def __repr__(self):
201206
return turbine_repr
202207

203208
def to_group(self, number_turbines=None, total_capacity=None):
209+
"""
210+
Parameters
211+
----------
212+
number_turbines : float
213+
Number of turbines of the defined type.
214+
total_capacity : float
215+
Total capacity of the group of wind turbines of the same type.
216+
217+
Returns
218+
-------
219+
220+
"""
204221
if number_turbines is not None and total_capacity is not None:
205222
raise ValueError("The 'number' and the 'total_capacity parameter "
206223
"are mutually exclusive. Use just one of them.")

0 commit comments

Comments
 (0)