Skip to content

Commit 2cd211d

Browse files
committed
Add description and move docstring example to new method
1 parent 2156caa commit 2cd211d

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

windpowerlib/wind_turbine.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,6 @@ class WindTurbine(object):
113113
18000.0
114114
>>> print(e_t_1.nominal_power)
115115
1500000.0
116-
>>> print(e_t_1.to_group(5)['number_of_turbines'])
117-
5
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
124116
"""
125117

126118
def __init__(self, hub_height, nominal_power=None, path='oedb',
@@ -207,6 +199,11 @@ def __repr__(self):
207199

208200
def to_group(self, number_turbines=None, total_capacity=None):
209201
"""
202+
Creates a WindTurbine group as a dictionary with the keys
203+
'number_of_turbines' and 'wind_turbine'. It can be used to calculate
204+
the number of turbines for a given total capacity or to create a
205+
dictionary that can be used to define a WindFarm object.
206+
210207
Parameters
211208
----------
212209
number_turbines : float
@@ -216,7 +213,26 @@ def to_group(self, number_turbines=None, total_capacity=None):
216213
217214
Returns
218215
-------
219-
216+
dict
217+
A dictionary with two keys ('number_of_turbines' and 'wind_turbine'
218+
219+
Examples
220+
--------
221+
>>> from windpowerlib import WindTurbine
222+
>>> enerconE126 = {
223+
... 'hub_height': 135,
224+
... 'turbine_type': 'E-126/4200'}
225+
>>> e126 = WindTurbine(**enerconE126)
226+
>>> e126.to_group(5)['number_of_turbines']
227+
5
228+
>>> e126.to_group()['number_of_turbines']
229+
1
230+
>>> e126.to_group(number_turbines=7)['number_of_turbines']
231+
7
232+
>>> e126.to_group(total_capacity=12600000)['number_of_turbines']
233+
3.0
234+
>>> e126.to_group(total_capacity=14700000)['number_of_turbines']
235+
3.5
220236
"""
221237
if number_turbines is not None and total_capacity is not None:
222238
raise ValueError("The 'number' and the 'total_capacity parameter "

0 commit comments

Comments
 (0)