Skip to content

Commit 6051ec3

Browse files
committed
Add parameters to display function
1 parent 8ffb900 commit 6051ec3

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

tests/test_turbine_cluster_modelchain.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ def test_run_model(self):
8585
test_tc_mc.run_model(self.weather_df)
8686
assert_series_equal(test_tc_mc.power_output, power_output_exp)
8787

88-
# TODO: Test power efficiency curve?
89-
9088
# Test smoothing
9189
parameters['smoothing'] = 'True'
9290
test_wind_farm = wf.WindFarm(**self.test_farm)

tests/test_wake_losses.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import pytest
44
from pandas.util.testing import assert_series_equal
55

6-
from windpowerlib.wake_losses import reduce_wind_speed
7-
import windpowerlib.wind_turbine as wt
6+
from windpowerlib.wake_losses import (reduce_wind_speed,
7+
display_wind_efficiency_curves)
88

99
class TestWakeLosses:
1010

@@ -30,3 +30,7 @@ def test_reduce_wind_speed(self):
3030
with pytest.raises(ValueError):
3131
parameters['wind_efficiency_curve_name'] = 'dena_misspelled'
3232
reduce_wind_speed(**parameters)
33+
34+
def test_display_wind_efficiency_curves(self):
35+
# This test just runs the function
36+
display_wind_efficiency_curves()

windpowerlib/power_output.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ def power_curve(wind_speed, power_curve_wind_speeds, power_curve_values,
142142

143143
def power_curve_density_correction(wind_speed, power_curve_wind_speeds,
144144
power_curve_values, density):
145-
# possible TODO: add density correction for stall controlled wind turbines
146145
r"""
147146
Calculates the turbine power output using a density corrected power curve.
148147

windpowerlib/wake_losses.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import numpy as np
1111
import pandas as pd
1212
import os
13+
import logging
1314

1415
try:
1516
from matplotlib import pyplot as plt
@@ -117,9 +118,18 @@ def get_wind_efficiency_curve(curve_name='dena_mean'):
117118
return efficiency_curve
118119

119120

120-
def display_wind_efficiency_curves():
121+
def display_wind_efficiency_curves(print_out=False, plot=False):
121122
r"""
122-
Displays all wind efficiency curves available in the windpowerlib.
123+
Displays all names of wind efficiency curves available in the windpowerlib.
124+
125+
Parameters
126+
----------
127+
print_out : Boolean
128+
If True the values of the wind efficiency curves are printed. Default:
129+
False.
130+
plot : Boolean
131+
If True all available wind efficiency curves are plotted - if
132+
matplotlib is installed. Default: False.
123133
124134
Notes
125135
-----
@@ -151,7 +161,9 @@ def display_wind_efficiency_curves():
151161
curves_list.extend([col for col in knorr_df if 'wind_speed' not in col])
152162
print("Names of the provided wind efficiency curves are the " +
153163
"following: {}".format(curves_list))
154-
if plt:
164+
print("To plot the different wind efficiency curves use this function " +
165+
"with the parameter plot=True.")
166+
if plt and plot is True:
155167
# Create data frames for plot
156168
dena_df.set_index('wind_speed', inplace=True)
157169
knorr_df.set_index('wind_speed', inplace=True)
@@ -162,9 +174,10 @@ def display_wind_efficiency_curves():
162174
plt.xlabel('Wind speed m/s')
163175
plt.show()
164176
else:
177+
logging.debug("Matplotlib is not installed.")
178+
if print_out is True:
165179
print(dena_df)
166180
print(knorr_df)
167181

168-
169182
if __name__ == "__main__":
170183
display_wind_efficiency_curves()

0 commit comments

Comments
 (0)