Skip to content

Commit 6dd290d

Browse files
committed
Change named tuple to normal tupel; no additional package needed
1 parent f912077 commit 6dd290d

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

windpowerlib/modelchain.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def rho_hub(self, weather, data_height):
154154
data_height['temp_air'], data_height['temp_air_2'],
155155
self.wind_turbine.hub_height, weather['temp_air'],
156156
weather['temp_air_2'])
157-
temp_air_height = values.closest_value
158-
temp_air_closest = values.corresp_value
157+
temp_air_height = values[0]
158+
temp_air_closest = values[1]
159159
# Check if temperature data is at hub height.
160160
if temp_air_height == self.wind_turbine.hub_height:
161161
logging.debug('Using given temperature at hub height.')
@@ -232,8 +232,8 @@ def v_wind_hub(self, weather, data_height):
232232
data_height['v_wind'], data_height['v_wind_2'],
233233
self.wind_turbine.hub_height, weather['v_wind'],
234234
weather['v_wind_2'])
235-
v_wind_height = values.closest_value
236-
v_wind_closest = values.corresp_value
235+
v_wind_height = values[0]
236+
v_wind_closest = values[1]
237237
# Check if wind speed data is at hub height.
238238
if v_wind_height == self.wind_turbine.hub_height:
239239
logging.debug('Using given wind speed at hub height.')

windpowerlib/tools.py

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

10-
import collections
11-
1210

1311
def smallest_difference(value_1, value_2, comp_value, corresp_1, corresp_2):
1412
r"""
@@ -40,6 +38,7 @@ def smallest_difference(value_1, value_2, comp_value, corresp_1, corresp_2):
4038
Tuple(float, float)
4139
Value closer to comparing value as float and its corresponding value as
4240
float.
41+
4342
"""
4443
if (value_2 is not None and corresp_2 is not None):
4544
if abs(value_1 - comp_value) <= abs(value_2 - comp_value):
@@ -54,8 +53,4 @@ def smallest_difference(value_1, value_2, comp_value, corresp_1, corresp_2):
5453
corresp_value = corresp_1
5554
else:
5655
corresp_value = corresp_2
57-
# Store values in a named tuple
58-
return_tuple = collections.namedtuple('selected_values',
59-
['closest_value',
60-
'corresp_value'])
61-
return return_tuple(closest_value, corresp_value)
56+
return (closest_value, corresp_value)

0 commit comments

Comments
 (0)