Skip to content

Commit c19d759

Browse files
committed
Set fetch_curve default to None
1 parent 2b4deaa commit c19d759

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

example/basic_example.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,14 @@
199199
"outputs": [],
200200
"source": [
201201
"# specification of wind turbine where power curve is provided\n",
202-
"# if you want to use the power coefficient curve add\n",
203-
"# {'fetch_curve': 'power_coefficient_curve'} to the dictionary\n",
202+
"# if you want to use the power coefficient curve change the value of\n",
203+
"# 'fetch_curve' to 'power_coefficient_curve'\n",
204204
"enerconE126 = {\n",
205205
" 'turbine_name': 'ENERCON E 126 7500', # turbine name as in register\n",
206206
" 'hub_height': 135, # in m\n",
207-
" 'rotor_diameter': 127 # in m\n",
208-
" }\n",
207+
" 'rotor_diameter': 127, # in m\n",
208+
" 'fetch_curve': 'power_curve' # fetch power curve\n",
209+
"}\n",
209210
"# initialise WindTurbine object\n",
210211
"e126 = WindTurbine(**enerconE126)"
211212
]

example/basic_example.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ def initialise_wind_turbines():
110110
my_turbine = WindTurbine(**myTurbine)
111111

112112
# specification of wind turbine where power curve is provided
113-
# if you want to use the power coefficient curve add
114-
# {'fetch_curve': 'power_coefficient_curve'} to the dictionary
113+
# if you want to use the power coefficient curve change the value of
114+
# 'fetch_curve' to 'power_coefficient_curve'
115115
enerconE126 = {
116116
'turbine_name': 'ENERCON E 126 7500', # turbine name as in register
117117
'hub_height': 135, # in m
118-
'rotor_diameter': 127 # in m
118+
'rotor_diameter': 127, # in m
119+
'fetch_curve': 'power_curve' # fetch power curve
119120
}
120121
# initialise WindTurbine object
121122
e126 = WindTurbine(**enerconE126)

tests/test_modelchain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class TestModelChain:
1313
def setup_class(self):
1414
self.test_turbine = {'hub_height': 100,
1515
'rotor_diameter': 80,
16-
'turbine_name': 'ENERCON E 126 7500'}
16+
'turbine_name': 'ENERCON E 126 7500',
17+
'fetch_curve': 'power_curve'}
1718

1819
def test_temperature_hub(self):
1920
# Test modelchain with temperature_model='linear_gradient'

windpowerlib/wind_turbine.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class WindTurbine(object):
4040
nominal_power : None or float
4141
The nominal output of the wind turbine in W.
4242
fetch_curve : string
43-
Parameter to specify whether the power or power coefficient curve
43+
Parameter to specify whether a power or power coefficient curve
4444
should be retrieved from the provided turbine data. Valid options are
45-
'power_curve' and 'power_coefficient_curve'. Default: 'power_curve'.
45+
'power_curve' and 'power_coefficient_curve'. Default: None.
4646
4747
Attributes
4848
----------
@@ -65,19 +65,27 @@ class WindTurbine(object):
6565
nominal_power : None or float
6666
The nominal output of the wind turbine in W.
6767
fetch_curve : string
68-
Parameter to specify whether the power or power coefficient curve
68+
Parameter to specify whether a power or power coefficient curve
6969
should be retrieved from the provided turbine data. Valid options are
70-
'power_curve' and 'power_coefficient_curve'. Default: 'power_curve'.
70+
'power_curve' and 'power_coefficient_curve'. Default: None.
7171
power_output : pandas.Series
7272
The calculated power output of the wind turbine.
7373
74+
Notes
75+
------
76+
Your wind turbine object should have a power coefficient or power curve.
77+
You can set the `fetch_curve` parameter if you don't want to provide one
78+
yourself but want to automatically fetch a curve from the data set
79+
provided along with the windpowerlib.
80+
7481
Examples
7582
--------
7683
>>> from windpowerlib import wind_turbine
7784
>>> enerconE126 = {
7885
... 'hub_height': 135,
7986
... 'rotor_diameter': 127,
80-
... 'turbine_name': 'ENERCON E 126 7500'}
87+
... 'turbine_name': 'ENERCON E 126 7500',
88+
... 'fetch_curve': 'power_curve'}
8189
>>> e126 = wind_turbine.WindTurbine(**enerconE126)
8290
>>> print(e126.nominal_power)
8391
7500000
@@ -86,7 +94,7 @@ class WindTurbine(object):
8694

8795
def __init__(self, turbine_name, hub_height, rotor_diameter=None,
8896
power_coefficient_curve=None, power_curve=None,
89-
nominal_power=None, fetch_curve='power_curve'):
97+
nominal_power=None, fetch_curve=None):
9098

9199
self.turbine_name = turbine_name
92100
self.hub_height = hub_height
@@ -101,6 +109,7 @@ def __init__(self, turbine_name, hub_height, rotor_diameter=None,
101109
if self.power_coefficient_curve is None and self.power_curve is None:
102110
self.fetch_turbine_data()
103111

112+
# ToDo: Have fetch_curve as an input to this function.
104113
def fetch_turbine_data(self):
105114
r"""
106115
Fetches data of the requested wind turbine.

0 commit comments

Comments
 (0)