Skip to content

Commit e0448c5

Browse files
committed
Merge branch 'rename_power_cp_curve_column' into release_branch
2 parents 35eaeda + 9e6a870 commit e0448c5

17 files changed

+244
-204
lines changed

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ If you have a working Python 3 environment, use pypi to install the latest windp
3333
The windpowerlib is designed for Python 3 and tested on Python >= 3.5.
3434
Please see the `installation page <http://oemof.readthedocs.io/en/stable/installation_and_setup.html>`_ of the oemof documentation for complete instructions on how to install python and a virtual environment on your operating system.
3535

36+
For retrieving power (coefficient) curves from the OpenEnergy Database (oedb) the python package requests will be installed with your windpowerlib installation. The windpowerlib was tested with requests version 2.20.1 but might work with lower versions.
37+
3638
Optional Packages
3739
~~~~~~~~~~~~~~~~~
3840

doc/getting_started.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ If you have a working Python 3 environment, use pypi to install the latest windp
3232
The windpowerlib is designed for Python 3 and tested on Python >= 3.5.
3333
Please see the `installation page <http://oemof.readthedocs.io/en/stable/installation_and_setup.html>`_ of the oemof documentation for complete instructions on how to install python and a virtual environment on your operating system.
3434

35+
For retrieving power (coefficient) curves from the OpenEnergy Database (oedb) the python package requests will be installed with your windpowerlib installation. The windpowerlib was tested with requests version 2.20.1 but might work with lower versions.
36+
3537
Optional Packages
3638
~~~~~~~~~~~~~~~~~
3739

doc/modelchain_example_notebook.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@
188188
"12 Enercon E-82/2350 True True\n",
189189
"13 Enercon E-82/3000 True True\n",
190190
"14 Enercon E-92/2350 True True\n",
191-
"15 Enercon E48/800 True True\n"
191+
"15 Enercon E/126/7500 True False\n",
192+
"16 Enercon E48/800 True True\n"
192193
]
193194
}
194195
],
@@ -256,7 +257,7 @@
256257
"DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): oep.iks.cs.ovgu.de:80\n",
257258
"DEBUG:urllib3.connectionpool:http://oep.iks.cs.ovgu.de:80 \"GET //api/v0/schema/model_draft/tables/openfred_windpower_powercurve/rows/ HTTP/1.1\" 301 438\n",
258259
"DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): openenergy-platform.org:80\n",
259-
"DEBUG:urllib3.connectionpool:http://openenergy-platform.org:80 \"GET /api/v0/schema/model_draft/tables/openfred_windpower_powercurve/rows/ HTTP/1.1\" 200 149329\n",
260+
"DEBUG:urllib3.connectionpool:http://openenergy-platform.org:80 \"GET /api/v0/schema/model_draft/tables/openfred_windpower_powercurve/rows/ HTTP/1.1\" 200 150623\n",
260261
"INFO:root:Data base connection successful.\n"
261262
]
262263
}
@@ -284,12 +285,13 @@
284285
"source": [
285286
"# specification of wind turbine where power coefficient curve is provided\n",
286287
"# by a csv file\n",
288+
"source = 'data/example_power_coefficient_curves.csv'\n",
287289
"dummy_turbine = {\n",
288290
" 'name': 'DUMMY 1', # turbine type as in file #\n",
289291
" 'hub_height': 100, # in m\n",
290292
" 'rotor_diameter': 70, # in m\n",
291293
" 'fetch_curve': 'power_coefficient_curve', # fetch cp curve #\n",
292-
" 'data_source': 'example_power_coefficient_curves.csv' # data source\n",
294+
" 'data_source': source # data source\n",
293295
"}\n",
294296
"# initialize WindTurbine object\n",
295297
"dummy_turbine = WindTurbine(**dummy_turbine)"

doc/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ sphinx>=1.4
22
ipykernel
33
nbsphinx
44
pandas
5-
numpy
5+
requests

doc/whatsnew/v0-1-0.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
v0.1.0 (January 16, 2019)
1+
v0.1.0 (January 17, 2019)
22
++++++++++++++++++++++++++++++++++
33

4+
ATTENTION: From v0.1.0 on power (coefficient) curves are provided by the OpenEnergy Database (oedb) instead of in csv files (v0.6.0 and lower) due to legal reasons.
5+
Use :py:func:`~wind_turbine.get_turbine_types` to check whether the turbine types you need are included in the database.
6+
If your turbine type is not included you can either use your own csv file or open an issue.
7+
48
New classes
59
###########
610

@@ -17,7 +21,7 @@ New functions
1721
* logarithmic interpolation/extrapolation for wind speed time series
1822
* gauss distribution (needed for power curve smoothing)
1923
* estimation of turbulence intensity by roughness length
20-
* retrieve power curves from Open Energy Database
24+
* retrieve power curves from OpenEnergy Database
2125

2226

2327
Testing
@@ -38,7 +42,7 @@ API changes
3842

3943
* renamed attribute `turbine_name` of WindTurbine class to `name` to match with `name` attribute of WindFarm and WindTurbineCluster class
4044
* renamed `basic_example` to `modelchain_example`
41-
* renamed column 'values' of power curves to 'power' and column 'values' of power coefficient curves to 'power coefficient'
45+
* renamed column 'values' of power (coefficient) curves to 'value' to prevent errors using df.value(s)
4246
* renamed `run_basic_example()` to `run_example()` in `modelchain_example`
4347
* renamed parameter `wind_turbine` of `ModelChain` object to `power_plant`
4448
* removed parameter `density_correction` from `power_plant.power_coefficient()`

example/modelchain_example.ipynb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@
188188
"12 Enercon E-82/2350 True True\n",
189189
"13 Enercon E-82/3000 True True\n",
190190
"14 Enercon E-92/2350 True True\n",
191-
"15 Enercon E48/800 True True\n"
191+
"15 Enercon E/126/7500 True False\n",
192+
"16 Enercon E48/800 True True\n"
192193
]
193194
}
194195
],
@@ -236,7 +237,7 @@
236237
" 'hub_height': 105, # in m\n",
237238
" 'rotor_diameter': 90, # in m\n",
238239
" 'power_curve': pd.DataFrame(\n",
239-
" data={'power': [p * 1000 for p in [\n",
240+
" data={'value': [p * 1000 for p in [\n",
240241
" 0.0, 26.0, 180.0, 1500.0, 3000.0, 3000.0]], # in W\n",
241242
" 'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]}) # in m/s\n",
242243
" } \n",
@@ -256,7 +257,7 @@
256257
"DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): oep.iks.cs.ovgu.de:80\n",
257258
"DEBUG:urllib3.connectionpool:http://oep.iks.cs.ovgu.de:80 \"GET //api/v0/schema/model_draft/tables/openfred_windpower_powercurve/rows/ HTTP/1.1\" 301 438\n",
258259
"DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): openenergy-platform.org:80\n",
259-
"DEBUG:urllib3.connectionpool:http://openenergy-platform.org:80 \"GET /api/v0/schema/model_draft/tables/openfred_windpower_powercurve/rows/ HTTP/1.1\" 200 149329\n",
260+
"DEBUG:urllib3.connectionpool:http://openenergy-platform.org:80 \"GET /api/v0/schema/model_draft/tables/openfred_windpower_powercurve/rows/ HTTP/1.1\" 200 150623\n",
260261
"INFO:root:Data base connection successful.\n"
261262
]
262263
}
@@ -284,13 +285,13 @@
284285
"source": [
285286
"# specification of wind turbine where power coefficient curve is provided\n",
286287
"# by a csv file\n",
287-
"csv_file = '../example/data/example_power_coefficient_curves.csv'\n",
288+
"source = 'data/example_power_coefficient_curves.csv'\n",
288289
"dummy_turbine = {\n",
289290
" 'name': 'DUMMY 1', # turbine type as in file #\n",
290291
" 'hub_height': 100, # in m\n",
291292
" 'rotor_diameter': 70, # in m\n",
292293
" 'fetch_curve': 'power_coefficient_curve', # fetch cp curve #\n",
293-
" 'data_source': csv_file # data source\n",
294+
" 'data_source': source # data source\n",
294295
"}\n",
295296
"# initialize WindTurbine object\n",
296297
"dummy_turbine = WindTurbine(**dummy_turbine)"
@@ -524,20 +525,20 @@
524525
"if plt:\n",
525526
" if e126.power_coefficient_curve is not None:\n",
526527
" e126.power_coefficient_curve.plot(\n",
527-
" x='wind_speed', y='power coefficient', style='*',\n",
528+
" x='wind_speed', y='value', style='*',\n",
528529
" title='Enercon E126 power coefficient curve')\n",
529530
" plt.show()\n",
530531
" if e126.power_curve is not None:\n",
531-
" e126.power_curve.plot(x='wind_speed', y='power', style='*',\n",
532+
" e126.power_curve.plot(x='wind_speed', y='value', style='*',\n",
532533
" title='Enercon E126 power curve')\n",
533534
" plt.show()\n",
534535
" if my_turbine.power_coefficient_curve is not None:\n",
535536
" my_turbine.power_coefficient_curve.plot(\n",
536-
" x='wind_speed', y='power coefficient', style='*',\n",
537+
" x='wind_speed', y='value', style='*',\n",
537538
" title='myTurbine power coefficient curve')\n",
538539
" plt.show()\n",
539540
" if my_turbine.power_curve is not None:\n",
540-
" my_turbine.power_curve.plot(x='wind_speed', y='power', style='*',\n",
541+
" my_turbine.power_curve.plot(x='wind_speed', y='value', style='*',\n",
541542
" title='myTurbine power curve')\n",
542543
" plt.show()"
543544
]

example/modelchain_example.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def initialize_wind_turbines():
9090
9191
Function shows three ways to initialize a WindTurbine object. You can
9292
either specify your own turbine, as done below for 'my_turbine', or fetch
93-
power and/or power coefficient curve data from the Open Energy Database
93+
power and/or power coefficient curve data from the OpenEnergy Database
9494
(oedb), as done for the 'enercon_e126', or provide your turbine data in csv
9595
files as done for 'dummy_turbine' with an example file.
9696
Execute ``windpowerlib.wind_turbine.get_turbine_types()`` to get a table
@@ -111,7 +111,7 @@ def initialize_wind_turbines():
111111
'hub_height': 105, # in m
112112
'rotor_diameter': 90, # in m
113113
'power_curve': pd.DataFrame(
114-
data={'power': [p * 1000 for p in [
114+
data={'value': [p * 1000 for p in [
115115
0.0, 26.0, 180.0, 1500.0, 3000.0, 3000.0]], # in W
116116
'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]}) # in m/s
117117
}
@@ -135,7 +135,6 @@ def initialize_wind_turbines():
135135
# by a csv file
136136
csv_file = os.path.join(os.path.dirname(__file__), 'data',
137137
'example_power_coefficient_curves.csv')
138-
# todo adapt in jupyter notebook!!!
139138
dummy_turbine = {
140139
'name': 'DUMMY 1', # turbine type as in file #
141140
'hub_height': 100, # in m
@@ -168,7 +167,7 @@ def calculate_power_output(weather, my_turbine, e126, dummy_turbine):
168167
my_turbine : WindTurbine
169168
WindTurbine object with self provided power curve.
170169
e126 : WindTurbine
171-
WindTurbine object with power curve from the Open Energy Database.
170+
WindTurbine object with power curve from the OpenEnergy Database.
172171
dummy_turbine : WindTurbine
173172
WindTurbine object with power coefficient curve from example file.
174173
@@ -247,7 +246,7 @@ def plot_or_print(my_turbine, e126, dummy_turbine):
247246
title='Enercon E126 power coefficient curve')
248247
plt.show()
249248
if e126.power_curve is not None:
250-
e126.power_curve.plot(x='wind_speed', y='power', style='*',
249+
e126.power_curve.plot(x='wind_speed', y='value', style='*',
251250
title='Enercon E126 power curve')
252251
plt.show()
253252
if my_turbine.power_coefficient_curve is not None:
@@ -256,7 +255,7 @@ def plot_or_print(my_turbine, e126, dummy_turbine):
256255
title='myTurbine power coefficient curve')
257256
plt.show()
258257
if my_turbine.power_curve is not None:
259-
my_turbine.power_curve.plot(x='wind_speed', y='power', style='*',
258+
my_turbine.power_curve.plot(x='wind_speed', y='value', style='*',
260259
title='myTurbine power curve')
261260
plt.show()
262261
else:

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ def read(fname):
1616
'windpowerlib': [os.path.join('data', '*.csv')]},
1717
long_description=read('README.rst'),
1818
zip_safe=False,
19-
install_requires=['numpy >= 1.7.0',
20-
'pandas >= 0.13.1',
19+
install_requires=['pandas >= 0.19.1',
2120
'requests'])

tests/test_power_curves.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def setup_class(self):
1818
def test_smooth_power_curve(self):
1919
test_curve = wt.WindTurbine(**self.test_turbine).power_curve
2020
parameters = {'power_curve_wind_speeds': test_curve['wind_speed'],
21-
'power_curve_values': test_curve['power'],
21+
'power_curve_values': test_curve['value'],
2222
'standard_deviation_method': 'turbulence_intensity'}
2323

2424
# Raise ValueError - `turbulence_intensity` missing
@@ -32,7 +32,7 @@ def test_smooth_power_curve(self):
3232
name='wind_speed')
3333
power_values_exp = pd.Series([
3434
1141906.9806766496, 1577536.8085282773, 1975480.993355767,
35-
2314059.4022704284, 2590216.6802602503], name='power')
35+
2314059.4022704284, 2590216.6802602503], name='value')
3636
smoothed_curve_exp = pd.DataFrame(data=pd.concat([
3737
wind_speed_values_exp, power_values_exp], axis=1))
3838
smoothed_curve_exp.index = np.arange(5, 10, 1)
@@ -43,7 +43,7 @@ def test_smooth_power_curve(self):
4343
parameters['standard_deviation_method'] = 'Staffell_Pfenninger'
4444
power_values_exp = pd.Series([
4545
929405.1348918702, 1395532.5468724659, 1904826.6851982325,
46-
2402659.118305521, 2844527.1732449625], name='power')
46+
2402659.118305521, 2844527.1732449625], name='value')
4747
smoothed_curve_exp = pd.DataFrame(
4848
data=pd.concat([wind_speed_values_exp, power_values_exp], axis=1))
4949
smoothed_curve_exp.index = np.arange(5, 10, 1)
@@ -58,13 +58,13 @@ def test_smooth_power_curve(self):
5858
def test_wake_losses_to_power_curve(self):
5959
test_curve = wt.WindTurbine(**self.test_turbine).power_curve
6060
parameters = {'power_curve_wind_speeds': test_curve['wind_speed'],
61-
'power_curve_values': test_curve['power'],
61+
'power_curve_values': test_curve['value'],
6262
'wind_farm_efficiency': 0.9,
6363
'wake_losses_model': 'constant_efficiency'}
6464

6565
# Test constant efficiency
6666
power_curve_exp = test_curve.copy(deep=True)
67-
power_curve_exp['power'] = power_curve_exp['power'].values * 0.9
67+
power_curve_exp['value'] = power_curve_exp['value'].values * 0.9
6868
assert_frame_equal(wake_losses_to_power_curve(**parameters),
6969
power_curve_exp)
7070

@@ -85,8 +85,8 @@ def test_wake_losses_to_power_curve(self):
8585
parameters['wind_farm_efficiency'].columns = ['wind_speed',
8686
'efficiency']
8787
power_curve_exp = test_curve.copy(deep=True)
88-
power_curve_exp['power'] = (
89-
power_curve_exp['power'].values * parameters[
88+
power_curve_exp['value'] = (
89+
power_curve_exp['value'].values * parameters[
9090
'wind_farm_efficiency']['efficiency'])
9191
assert_frame_equal(wake_losses_to_power_curve(**parameters),
9292
power_curve_exp)

0 commit comments

Comments
 (0)