Skip to content

Commit 974f122

Browse files
committed
Fix doctests
1 parent 5cc0685 commit 974f122

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

example/data/turbine_data.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
turbine_type,nominal_power
22
DUMMY 1,4200000
33
DUMMY 2,4200000
4-
DUMMY 3,150000
4+
DUMMY 3,1500000
55
DUMMY 4,225000

windpowerlib/wind_turbine.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,26 @@ class WindTurbine(object):
9090
9191
Examples
9292
--------
93+
>>> import os
9394
>>> from windpowerlib import wind_turbine
9495
>>> enerconE126 = {
9596
... 'hub_height': 135,
9697
... 'turbine_type': 'E-126/4200'}
9798
>>> e126 = wind_turbine.WindTurbine(**enerconE126)
9899
>>> print(e126.nominal_power)
99100
4200000.0
101+
>>> # Example with own path
102+
>>> path = os.path.join(os.path.dirname(__file__), '../example/data')
103+
>>> example_turbine = {
104+
... 'hub_height': 100,
105+
... 'rotor_diameter': 70,
106+
... 'turbine_type': 'DUMMY 3',
107+
... 'path' : path}
108+
>>> e_t_1 = wind_turbine.WindTurbine(**example_turbine)
109+
>>> print(e_t_1.power_curve['value'][7])
110+
18000.0
111+
>>> print(e_t_1.nominal_power)
112+
1500000.0
100113
101114
"""
102115

@@ -221,17 +234,13 @@ def get_turbine_data_from_file(turbine_type, path):
221234
--------
222235
>>> from windpowerlib import wind_turbine
223236
>>> import os
224-
>>> path = os.path.join(os.path.dirname(__file__), '../example/data')
225-
>>> example_turbine = {
226-
... 'hub_height': 100,
227-
... 'rotor_diameter': 70,
228-
... 'turbine_type': 'DUMMY 3',
229-
... 'path' : path}
230-
>>> e_t_1 = wind_turbine.WindTurbine(**example_turbine)
231-
>>> print(e_t_1.power_curve['value'][7])
237+
>>> path = os.path.join(os.path.dirname(__file__), '../example/data',
238+
... 'power_curves.csv')
239+
>>> d3 = get_turbine_data_from_file('DUMMY 3', path)
240+
>>> print(d3['value'][7])
232241
18000.0
233-
>>> print(e_t_1.nominal_power)
234-
150000.0
242+
>>> print(d3['value'].max())
243+
1500000.0
235244
"""
236245

237246
try:

0 commit comments

Comments
 (0)