Skip to content

Commit 3ef8b2b

Browse files
authored
Merge pull request #97 from wind-python/features/revise-python-script-examples
Revise py-script examples and copy to oemof-examples
2 parents 89ca403 + 3628279 commit 3ef8b2b

26 files changed

+378
-141
lines changed

README.rst

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
:target: https://mybinder.org/v2/gh/wind-python/windpowerlib/dev?filepath=example
99
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
1010
:target: https://github.com/psf/black
11+
12+
.. image:: https://img.shields.io/lgtm/grade/python/g/wind-python/windpowerlib.svg?logo=lgtm&logoWidth=18
13+
:target: https://lgtm.com/projects/g/wind-python/windpowerlib/context:python
1114

1215
Introduction
1316
=============
@@ -82,8 +85,14 @@ You can also look at the examples in the `Examples section <http://windpowerlib.
8285
Wind turbine data
8386
==================
8487

88+
The windpowerlib provides data of many wind turbines but it is also possible to
89+
use your own turbine data.
90+
91+
Use internal data
92+
~~~~~~~~~~~~~~~~~
93+
8594
The windpowerlib provides `wind turbine data <https://github.com/wind-python/windpowerlib/tree/master/windpowerlib/oedb>`_
86-
(power curves, hub heights, etc.) for a large set of wind turbines. Have a look at the `example <http://windpowerlib.readthedocs.io/en/stable/modelchain_example_notebook.html#Initialize-wind-turbine>`_ on how
95+
(power curves, hub heights, etc.) for a large set of wind turbines. See `Initialize wind turbine` in :ref:`examples_section_label` on how
8796
to use this data in your simulations.
8897

8998
The dataset is hosted and maintained on the `OpenEnergy database <https://openenergy-platform.org/dataedit/>`_ (oedb).
@@ -94,9 +103,61 @@ To update your local files with the latest version of the `oedb turbine library
94103
from windpowerlib.wind_turbine import load_turbine_data_from_oedb
95104
load_turbine_data_from_oedb()
96105
106+
If you find your turbine in the database it is very easy to use it in the
107+
windpowerlib
108+
109+
.. code:: python
110+
111+
from windpowerlib import WindTurbine
112+
enercon_e126 = {
113+
"turbine_type": "E-126/4200", # turbine type as in register
114+
"hub_height": 135, # in m
115+
}
116+
e126 = WindTurbine(**enercon_e126)
117+
97118
We would like to encourage anyone to contribute to the turbine library by adding turbine data or reporting errors in the data.
98119
See `here <https://github.com/OpenEnergyPlatform/data-preprocessing/issues/28>`_ for more information on how to contribute.
99120

121+
Use your own turbine data
122+
~~~~~~~~~~~~~~~~~~~~~~~~~
123+
124+
It is possible to use your own power curve. However, the most sustainable way
125+
is to send us the data to be included in the windpowerlib and to be available
126+
for all users. This may not be possible in all cases.
127+
128+
Assuming the data files looks like this:
129+
130+
.. code::
131+
132+
wind,power
133+
0.0,0.0
134+
3.0,39000.0
135+
5.0,270000.0
136+
10.0,2250000.0
137+
15.0,4500000.0
138+
25.0,4500000.0
139+
140+
You can use pandas to read the file and pass it to the turbine dictionary. I
141+
you have basic knowledge of pandas it is easy to use any kind of data file.
142+
143+
.. code:: python
144+
145+
import pandas as pd
146+
from windpowerlib import WindTurbine, create_power_curve
147+
my_data = pd.read_csv("path/to/my/data/file.csv")
148+
149+
my_turbine_data = {
150+
"nominal_power": 6e6, # in W
151+
"hub_height": 115, # in m
152+
"power_curve": create_power_curve(
153+
wind_speed=my_data["wind"], power=my_data["power"]
154+
),
155+
}
156+
157+
my_turbine = WindTurbine(**my_turbine2)
158+
159+
See the `modelchain_example` for more information.
160+
100161
Contributing
101162
==============
102163

doc/getting_started.rst

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Getting started
1313
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
1414
:target: https://github.com/psf/black
1515

16+
.. image:: https://img.shields.io/lgtm/grade/python/g/wind-python/windpowerlib.svg?logo=lgtm&logoWidth=18
17+
:target: https://lgtm.com/projects/g/wind-python/windpowerlib/context:python
18+
1619
Introduction
1720
=============
1821

@@ -84,6 +87,12 @@ You can also look at the examples in the :ref:`examples_section_label` section.
8487
Wind turbine data
8588
==================
8689

90+
The windpowerlib provides data of many wind turbines but it is also possible to
91+
use your own turbine data.
92+
93+
Use internal data
94+
~~~~~~~~~~~~~~~~~
95+
8796
The windpowerlib provides `wind turbine data <https://github.com/wind-python/windpowerlib/tree/master/windpowerlib/oedb>`_
8897
(power curves, hub heights, etc.) for a large set of wind turbines. See `Initialize wind turbine` in :ref:`examples_section_label` on how
8998
to use this data in your simulations.
@@ -96,9 +105,62 @@ To update your local files with the latest version of the `oedb turbine library
96105
from windpowerlib.wind_turbine import load_turbine_data_from_oedb
97106
load_turbine_data_from_oedb()
98107
108+
If you find your turbine in the database it is very easy to use it in the
109+
windpowerlib
110+
111+
.. code:: python
112+
113+
from windpowerlib import WindTurbine
114+
enercon_e126 = {
115+
"turbine_type": "E-126/4200", # turbine type as in register
116+
"hub_height": 135, # in m
117+
}
118+
e126 = WindTurbine(**enercon_e126)
119+
99120
We would like to encourage anyone to contribute to the turbine library by adding turbine data or reporting errors in the data.
100121
See `here <https://github.com/OpenEnergyPlatform/data-preprocessing/issues/28>`_ for more information on how to contribute.
101122

123+
Use your own turbine data
124+
~~~~~~~~~~~~~~~~~~~~~~~~~
125+
126+
It is possible to use your own power curve. However, the most sustainable way
127+
is to send us the data to be included in the windpowerlib and to be available
128+
for all users. This may not be possible in all cases.
129+
130+
Assuming the data files looks like this:
131+
132+
.. code::
133+
134+
wind,power
135+
0.0,0.0
136+
3.0,39000.0
137+
5.0,270000.0
138+
10.0,2250000.0
139+
15.0,4500000.0
140+
25.0,4500000.0
141+
142+
You can use pandas to read the file and pass it to the turbine dictionary. I
143+
you have basic knowledge of pandas it is easy to use any kind of data file.
144+
145+
.. code:: python
146+
147+
import pandas as pd
148+
from windpowerlib import WindTurbine, create_power_curve
149+
my_data = pd.read_csv("path/to/my/data/file.csv")
150+
151+
my_turbine_data = {
152+
"nominal_power": 6e6, # in W
153+
"hub_height": 115, # in m
154+
"power_curve": create_power_curve(
155+
wind_speed=my_data["wind"], power=my_data["power"]
156+
),
157+
}
158+
159+
my_turbine = WindTurbine(**my_turbine2)
160+
161+
See the `modelchain_example` for more information.
162+
163+
102164
Contributing
103165
==============
104166

example/modelchain_example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
"source": [
289289
"# specification of wind turbine where power coefficient curve and nominal\n",
290290
"# power is provided in an own csv file\n",
291-
"csv_path = 'data'\n",
291+
"csv_path = ''\n",
292292
"dummy_turbine = {\n",
293293
" 'turbine_type': 'DUMMY 1', # turbine type as in file\n",
294294
" 'hub_height': 100, # in m\n",

0 commit comments

Comments
 (0)