Skip to content

Commit 3c3e558

Browse files
authored
Merge branch 'dev' into make_windpowerlib_work_offline
2 parents 52728f6 + 74ed6d2 commit 3c3e558

File tree

7 files changed

+19
-21
lines changed

7 files changed

+19
-21
lines changed

doc/model_description.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Wind power plants
88
The windpowerlib provides three classes for modelling wind power as wind turbines (:py:class:`~.wind_turbine.WindTurbine`),
99
wind farms (:py:class:`~.wind_farm.WindFarm`) and wind turbine clusters (:py:class:`~.wind_turbine_cluster.WindTurbineCluster`).
1010

11-
Descisptions can also be found in the sections
11+
Descriptions can also be found in the sections
1212
:ref:`wind_turbine_label`, :ref:`wind_farm_label` and :ref:`wind_turbine_cluster_label`.
1313

1414

doc/whatsnew/v0-1-2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ v0.1.2 ()
44
Other changes
55
#############
66
* Make windpowerlib work offline: turbine data from oedb is stored in a hdf5 file for offline usage
7+
* Make :py:func:`~windpowerlib.wind_turbine.get_turbine_types` also accessible via `get_turbine_types()` --> from windpowerlib import get_turbine_types
78

89

910
Contributors
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
,turbine_id,p_nom,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
2-
0,DUMMY 1,300000,0,,0,,0,,0,0,0.13,,0.38,,0.46,,0.48,,0.47,,0.44,,0.4,,0.36,,0.31,,0.17,,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
2+
0,DUMMY 1,300000,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
1,DUMMY 2,600000,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

example/modelchain_example.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,26 +240,21 @@ def plot_or_print(my_turbine, e126, dummy_turbine):
240240
print(my_turbine.power_output)
241241
print(dummy_turbine.power_output)
242242

243-
# plot or print power (coefficient) curve
243+
# plot or print power curve
244244
if plt:
245-
if e126.power_coefficient_curve is not None:
246-
e126.power_coefficient_curve.plot(
247-
x='wind_speed', y='power coefficient', style='*',
248-
title='Enercon E126 power coefficient curve')
249-
plt.show()
250245
if e126.power_curve is not None:
251246
e126.power_curve.plot(x='wind_speed', y='value', style='*',
252247
title='Enercon E126 power curve')
253248
plt.show()
254-
if my_turbine.power_coefficient_curve is not None:
255-
my_turbine.power_coefficient_curve.plot(
256-
x='wind_speed', y='power coefficient', style='*',
257-
title='myTurbine power coefficient curve')
258-
plt.show()
259249
if my_turbine.power_curve is not None:
260250
my_turbine.power_curve.plot(x='wind_speed', y='value', style='*',
261251
title='myTurbine power curve')
262252
plt.show()
253+
if dummy_turbine.power_coefficient_curve is not None:
254+
dummy_turbine.power_coefficient_curve.plot(
255+
x='wind_speed', y='value', style='*',
256+
title='dummyTurbine power coefficient curve')
257+
plt.show()
263258
else:
264259
if e126.power_coefficient_curve is not None:
265260
print(e126.power_coefficient_curve)

tests/test_wind_turbine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def test_error_raising(self):
3434
def test_get_turbine_data_from_file(self):
3535
# Raise FileNotFoundError due to missing
3636
with pytest.raises(FileNotFoundError):
37-
get_turbine_data_from_file(turbine_type='...', file_='not_existent')
37+
get_turbine_data_from_file(turbine_type='...',
38+
file_='not_existent')
3839

3940
def test_get_turbine_types(self):
4041
get_turbine_types(print_out=False)

windpowerlib/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
from windpowerlib.wind_farm import WindFarm
77
from windpowerlib.wind_turbine_cluster import WindTurbineCluster
88
from windpowerlib.modelchain import ModelChain
9-
from windpowerlib.turbine_cluster_modelchain import TurbineClusterModelChain
9+
from windpowerlib.turbine_cluster_modelchain import TurbineClusterModelChain
10+
from windpowerlib.wind_turbine import get_turbine_types

windpowerlib/wind_turbine.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def isfloat(x):
267267

268268
def get_turbine_data_from_oedb(turbine_type, fetch_curve, overwrite=False):
269269
r"""
270-
Gets turbine data from the OpenEnergy Database (oedb).
270+
Fetches data for one wind turbine type from the OpenEnergy Database (oedb).
271271
272272
If turbine data exists in local repository it is loaded from this file. The
273273
file is created when turbine data was loaded from oedb in
@@ -294,9 +294,9 @@ def get_turbine_data_from_oedb(turbine_type, fetch_curve, overwrite=False):
294294
-------
295295
Tuple (pandas.DataFrame, float)
296296
Power curve or power coefficient curve (pandas.DataFrame) and nominal
297-
power (float). Power (coefficient) curve DataFrame contains power
298-
coefficient curve values (dimensionless) or power curve values in W
299-
with the corresponding wind speeds in m/s.
297+
power (float) of one wind turbine type. Power (coefficient) curve
298+
DataFrame contains power coefficient curve values (dimensionless) or
299+
power curve values in W with the corresponding wind speeds in m/s.
300300
301301
"""
302302
# hdf5 filename
@@ -358,8 +358,8 @@ def load_turbine_data_from_oedb():
358358
schema, table), )
359359
if not result.status_code == 200:
360360
raise ConnectionError("Database connection not successful. "
361-
"Error: {}".format(result.status_code))
362-
# extract data
361+
"Response: [{}]".format(result.status_code))
362+
# extract data to data frame
363363
turbine_data = pd.DataFrame(result.json())
364364
# store data as hdf5
365365
filename = os.path.join(os.path.dirname(__file__), 'data',

0 commit comments

Comments
 (0)