Skip to content

Commit 2f8c453

Browse files
committed
Adapt example turbine data and add paths to fix tests
1 parent adf5c06 commit 2f8c453

File tree

8 files changed

+26
-25
lines changed

8 files changed

+26
-25
lines changed

doc/getting_started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ To run the example you need the example weather and turbine data used:
5757
* :download:`Example weather data file <../example/weather.csv>`
5858
* :download:`Example power curve data file <../example/data/example_power_curves.csv>`
5959
* :download:`Example power coefficient curve data file <../example/data/example_power_coefficient_curves.csv>`
60-
* :download:`Example nominal power data file <../example/data/example_nominal_power.csv>`
60+
* :download:`Example nominal power data file <../example/data/example_turbine_data.csv>`
6161

6262
Furthermore, you have to install the windpowerlib and to run the notebook you also need to install `notebook` using pip3. To launch jupyter notebook type ``jupyter notebook`` in the terminal.
6363
This will open a browser window. Navigate to the directory containing the notebook to open it. See the jupyter notebook quick start guide for more information on `how to install <http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/install.html>`_ and
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24,24.5,25,25.5,26
1+
turbine_type,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24,24.5,25,25.5,26
22
DUMMY 1,0,,0,,0,,0,0,0.13,,0.38,,0.46,,0.48,,0.47,,0.44,,0.4,,0.36,,0.31,,0.26,,0.23,,0.2,,0.18,,0.14,,0.11,,0.1,,0.09,,0.07,,0.05,,0.04,,0.04,,0.03,,0
33
DUMMY 2,0,,0,,0,,0.16,0.29,0.35,0.38,0.4,0.41,0.42,0.43,0.43,0.44,0.44,0.44,0.44,0.43,0.42,0.39,0.36,0.32,0.29,0.26,0.23,0.2,0.18,0.16,0.15,0.14,0.12,0.11,0.1,0.09,0.09,0.08,0.07,0.07,0.06,0.06,0.05,0.05,0.05,0.04,0.04,0.04,0.04,0.03,0.03,0,0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24,24.5,25,25.5,26
1+
turbine_type,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24,24.5,25,25.5,26
22
DUMMY 3,0,0,0,0,0,0,0,18000,34000,70000,10000,150000,190000,260000,330000,420000,510000,620000,740000,880000,1020000,1180000,1330000,1420000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,1500000,0,
33
DUMMY 4,0,,0,,0,,0,,4000,,22000,,46000,,76000,,111000,,147000,,184000,,219000,,249000,,274000,,290000,,297000,,302000,,307000,,307000,,305000,,295000,,280000,,260000,,240000,,230000,,225000,0,

example/modelchain_example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
" 'hub_height': 100, # in m\n",
319319
" 'rotor_diameter': 70, # in m\n",
320320
" 'power_coefficient_curve': 'example_power_coefficient_curves.csv', # data is fetched from file\n",
321-
" 'nominal_power': 'example_nominal_power.csv', # data is fetched from file\n",
321+
" 'nominal_power': 'example_turbine_data.csv', # data is fetched from file\n",
322322
" 'path': csv_path\n",
323323
"}\n",
324324
"# initialize WindTurbine object\n",

example/modelchain_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def initialize_wind_turbines():
135135
'power_coefficient_curve':
136136
'example_power_coefficient_curves.csv', # data is fetched from
137137
# file
138-
'nominal_power': 'example_nominal_power.csv', # data is fetched from
138+
'nominal_power': 'example_turbine_data.csv', # data is fetched from
139139
# file
140140
'path': csv_path
141141
}

tests/test_wind_turbine.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
import pandas as pd
3+
import os
34

45
from windpowerlib.wind_turbine import (get_turbine_data_from_file, WindTurbine,
56
get_turbine_types)
@@ -18,12 +19,12 @@ def test_initialization_power_curve(self):
1819
assert True
1920
except:
2021
assert False
21-
2222
# power curve from self provided csv file
23-
self.test_turbine_data = {'hub_height': 100,
24-
'power_curve': 'example_power_curves.csv',
25-
'turbine_type': 'DUMMY 3',
26-
'path': '../example/data'}
23+
self.test_turbine_data = {
24+
'hub_height': 100,
25+
'power_curve': 'example_power_curves.csv',
26+
'turbine_type': 'DUMMY 3',
27+
'path': os.path.join(os.path.dirname(__file__), '../example/data')}
2728
try:
2829
WindTurbine(**self.test_turbine_data)
2930
assert True
@@ -64,11 +65,11 @@ def test_initialization_power_coefficient_curve(self):
6465
assert False
6566

6667
# power coefficient curve from self provided csv file
67-
self.test_turbine_data = {'hub_height': 100,
68-
'power_coefficient_curve':
69-
'example_power_curves.csv',
70-
'turbine_type': 'DUMMY 3',
71-
'path': '../example/data'}
68+
self.test_turbine_data = {
69+
'hub_height': 100,
70+
'power_coefficient_curve': 'example_power_curves.csv',
71+
'turbine_type': 'DUMMY 3',
72+
'path': os.path.join(os.path.dirname(__file__), '../example/data')}
7273
try:
7374
WindTurbine(**self.test_turbine_data)
7475
assert True
@@ -108,12 +109,12 @@ def test_error_raising(self):
108109
WindTurbine(**self.test_turbine_data)
109110

110111
# Raise KeyError due to turbine type not in file
111-
self.test_turbine_data = {'hub_height': 100,
112-
'power_curve': True,
113-
'turbine_type': 'turbine_not_in_file',
114-
'power_coefficient_curve':
115-
'example_power_curves.csv',
116-
'path': '../example/data'}
112+
self.test_turbine_data = {
113+
'hub_height': 100,
114+
'power_curve': True,
115+
'turbine_type': 'turbine_not_in_file',
116+
'power_coefficient_curve': 'example_power_curves.csv',
117+
'path': os.path.join(os.path.dirname(__file__), '../example/data')}
117118
with pytest.raises(KeyError):
118119
WindTurbine(**self.test_turbine_data)
119120

windpowerlib/wind_turbine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class WindTurbine(object):
9696
File name of self-provided csv file the nominal power is
9797
retrieved from. Additionally, the path pointing to the file's
9898
directory must be provided through the parameter `path`. See
99-
`example_nominal_power.csv` in example/data directory for
99+
`example_turbine_data.csv` in example/data directory for
100100
the required format of the csv file.
101101
* float
102102
@@ -136,7 +136,7 @@ class WindTurbine(object):
136136
the oedb turbine library (a dataset provided in the OpenEnergy Database).
137137
You can also provide your own csv files with power coefficient and power
138138
curves. See `example_power_curves.csv',
139-
`example_power_coefficient_curves.csv` and `example_nominal_power.csv`
139+
`example_power_coefficient_curves.csv` and `example_turbine_data.csv`
140140
in example/data for the required form of such csv files.
141141
142142
Examples
@@ -260,7 +260,7 @@ def get_turbine_data_from_file(turbine_type, file_):
260260
Fetches turbine data from a csv file.
261261
262262
See `example_power_curves.csv', `example_power_coefficient_curves.csv` and
263-
`example_nominal_power_data.csv` in example/data for the required format of
263+
`example_turbine_data.csv` in example/data for the required format of
264264
a csv file. Make sure to provide wind speeds in m/s and power in W or
265265
convert units after loading the data.
266266
@@ -291,7 +291,7 @@ def get_turbine_data_from_file(turbine_type, file_):
291291
... 'rotor_diameter': 70,
292292
... 'turbine_type': 'DUMMY 3',
293293
... 'power_curve': 'example_power_curves.csv',
294-
... 'nominal_power': 'example_nominal_power.csv',
294+
... 'nominal_power': 'example_turbine_data.csv',
295295
... 'path' : path}
296296
>>> e_t_1 = wind_turbine.WindTurbine(**example_turbine)
297297
>>> print(e_t_1.power_curve['value'][7])

0 commit comments

Comments
 (0)