Skip to content

Commit b9c9e19

Browse files
committed
Merge branch 'dev' into features/wind_farms_and_clusters
2 parents 6092be0 + 242e5a2 commit b9c9e19

File tree

10 files changed

+65
-81
lines changed

10 files changed

+65
-81
lines changed

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# General information about the project.
6262
project = u'windpowerlib'
6363
copyright = u'2016, oemof developer group'
64-
author = u'Uwe Krien, oemof developing group'
64+
author = u'oemof developing group'
6565

6666
import windpowerlib
6767

@@ -285,7 +285,7 @@
285285

286286
# Bibliographic Dublin Core info.
287287
epub_title = u'windpowerlib'
288-
epub_author = u'Uwe Krien, oemof developing group'
288+
epub_author = u'oemof developing group'
289289
epub_publisher = u'oemof developing group'
290290
epub_copyright = u'2016, oemof developing group'
291291

example/basic_example.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
" 'hub_height': 105, # in m\n",
183183
" 'rotor_diameter': 90, # in m\n",
184184
" 'power_curve': pd.DataFrame(\n",
185-
" data={'values': [p * 1000 for p in [\n",
185+
" data={'power': [p * 1000 for p in [\n",
186186
" 0.0, 26.0, 180.0, 1500.0, 3000.0, 3000.0]], # in W\n",
187187
" 'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]}) # in m/s\n",
188188
" } \n",
@@ -313,20 +313,20 @@
313313
"if plt:\n",
314314
" if e126.power_coefficient_curve is not None:\n",
315315
" e126.power_coefficient_curve.plot(\n",
316-
" x='wind_speed', y='values', style='*',\n",
316+
" x='wind_speed', y='power coefficient', style='*',\n",
317317
" title='Enercon E126 power coefficient curve')\n",
318318
" plt.show()\n",
319319
" if e126.power_curve is not None:\n",
320-
" e126.power_curve.plot(x='wind_speed', y='values', style='*',\n",
320+
" e126.power_curve.plot(x='wind_speed', y='power', style='*',\n",
321321
" title='Enercon E126 power curve')\n",
322322
" plt.show()\n",
323323
" if my_turbine.power_coefficient_curve is not None:\n",
324324
" my_turbine.power_coefficient_curve.plot(\n",
325-
" x='wind_speed', y='values', style='*',\n",
325+
" x='wind_speed', y='power coefficient', style='*',\n",
326326
" title='myTurbine power coefficient curve')\n",
327327
" plt.show()\n",
328328
" if my_turbine.power_curve is not None:\n",
329-
" my_turbine.power_curve.plot(x='wind_speed', y='values', style='*',\n",
329+
" my_turbine.power_curve.plot(x='wind_speed', y='power', style='*',\n",
330330
" title='myTurbine power curve')\n",
331331
" plt.show()"
332332
]

example/test_basic_example.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

example/test_examples.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import os
2+
import subprocess
3+
import tempfile
4+
import nbformat
5+
6+
from example import basic_example as be
7+
from numpy.testing import assert_allclose
8+
9+
10+
class TestExamples:
11+
12+
def test_basic_example_flh(self):
13+
# tests full load hours
14+
weather = be.get_weather_data('weather.csv')
15+
my_turbine, e126 = be.initialise_wind_turbines()
16+
be.calculate_power_output(weather, my_turbine, e126)
17+
18+
assert_allclose(1766.6870, (e126.power_output.sum() /
19+
e126.nominal_power), 0.01)
20+
assert_allclose(1882.7567, (my_turbine.power_output.sum() /
21+
my_turbine.nominal_power), 0.01)
22+
23+
def _notebook_run(self, path):
24+
"""
25+
Execute a notebook via nbconvert and collect output.
26+
Returns (parsed nb object, execution errors)
27+
"""
28+
dirname, __ = os.path.split(path)
29+
os.chdir(dirname)
30+
with tempfile.NamedTemporaryFile(suffix=".ipynb") as fout:
31+
args = ["jupyter", "nbconvert", "--to", "notebook", "--execute",
32+
"--ExecutePreprocessor.timeout=60",
33+
"--output", fout.name, path]
34+
subprocess.check_call(args)
35+
36+
fout.seek(0)
37+
nb = nbformat.read(fout, nbformat.current_nbformat)
38+
39+
errors = [output for cell in nb.cells if "outputs" in cell
40+
for output in cell["outputs"]
41+
if output.output_type == "error"]
42+
43+
return nb, errors
44+
45+
def test_basic_example_ipynb(self):
46+
dir_path = os.path.dirname(os.path.realpath(__file__))
47+
nb, errors = self._notebook_run(os.path.join(dir_path,
48+
'basic_example.ipynb'))
49+
assert errors == []

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import os
22
from setuptools import setup
3-
from windpowerlib import __version__
43

54
setup(name='windpowerlib',
6-
version=__version__,
5+
version='0.0.6',
76
description='Creating time series from wind power plants.',
87
url='http://github.com/wind-python/windpowerlib',
98
author='oemof developing group',

windpowerlib/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
from windpowerlib import density
66
from windpowerlib import modelchain
77
from windpowerlib import power_output
8+
from windpowerlib import power_curve
89
from windpowerlib import temperature
910
from windpowerlib import tools
1011
from windpowerlib import wind_speed
1112
from windpowerlib import wind_turbine
13+
from windpowerlib import wind_farm
14+
from windpowerlib import turbine_cluster_modelchain
15+
from windpowerlib import wind_turbine_cluster
1216

1317
from windpowerlib.wind_turbine import WindTurbine
1418
from windpowerlib.modelchain import ModelChain

windpowerlib/power_curve.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import numpy as np
1111
import pandas as pd
1212
from windpowerlib import tools
13-
from matplotlib import pyplot as plt
14-
import os
1513

1614

1715
def smooth_power_curve(power_curve_wind_speeds, power_curve_values,

windpowerlib/tools.py

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def linear_interpolation_extrapolation(df, target_height):
6060
... 'wind_speed']),
6161
... np.array([10, 80])])
6262
>>> round(linear_interpolation_extrapolation(
63-
... weather_df['wind_speed'], 100)[0], 10)
64-
6.8571428571
63+
... weather_df['wind_speed'], 100)[0], 2)
64+
6.86
6565
6666
"""
6767
# find closest heights
@@ -71,53 +71,3 @@ def linear_interpolation_extrapolation(df, target_height):
7171
return ((df[heights_sorted[1]] - df[heights_sorted[0]]) /
7272
(heights_sorted[1] - heights_sorted[0]) *
7373
(target_height - heights_sorted[0]) + df[heights_sorted[0]])
74-
75-
76-
def gaussian_distribution(function_variable, standard_deviation, mean=0):
77-
r"""
78-
Normal distribution or gaussian distribution.
79-
80-
Parameters
81-
----------
82-
function_variable : Float
83-
Variable of the gaussian distribution.
84-
standard_deviation : Float
85-
Standard deviation of the gaussian distribution.
86-
mean : Float
87-
Defines the offset of the gaussian distribution function. Default: 0.
88-
89-
Returns
90-
-------
91-
pandas.Series or numpy.array
92-
Wind speed at hub height. Data type depends on type of `wind_speed`.
93-
94-
Notes
95-
-----
96-
The following equation is used [1]_:
97-
98-
.. math:: f(x) = \frac{1}{\sigma \sqrt{2 \pi}} exp
99-
\left[ -\frac{(x-\mu)^2}{2 \sigma^2} \right]
100-
101-
with:
102-
# TODO: add variables
103-
104-
References
105-
----------
106-
.. [1] Berendsen, H.: "A Student's Guide to Data and Error Analysis".
107-
New York, Cambridge University Press, 2011, p. 37
108-
109-
# TODO: add references
110-
111-
"""
112-
return (1 / (standard_deviation * np.sqrt(2 * np.pi)) *
113-
np.exp(-(function_variable - mean)**2 /
114-
(2 * standard_deviation**2)))
115-
116-
117-
def estimate_turbulence_intensity(height, roughness_length):
118-
"""
119-
Calculate turbulence intensity.
120-
121-
"""
122-
# TODO: Search other possibilities for TI.
123-
return 1 / (np.log(height / roughness_length))

windpowerlib/turbine_cluster_modelchain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
__copyright__ = "Copyright oemof developer group"
88
__license__ = "GPLv3"
99

10-
from . import modelchain, tools, wind_farm, power_curve, wind_turbine_cluster
10+
from windpowerlib import modelchain, tools, wind_farm, power_curve, \
11+
wind_turbine_cluster
1112
import pandas as pd
1213

1314

0 commit comments

Comments
 (0)