Skip to content

Commit 2f26406

Browse files
cwhansekandersolar
andauthored
Correct dtype bug in temperature.fuentes (pvlib#2745)
* fix dtype bug * whatsnew * add new test * Update tests/test_temperature.py Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com> * Update docs/sphinx/source/whatsnew/v0.15.2.rst Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com> * pvsystem test * Update docs/sphinx/source/whatsnew/v0.15.2.rst Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com> --------- Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com>
1 parent 2cf4ee0 commit 2f26406

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

docs/sphinx/source/whatsnew/v0.15.2.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ Deprecations
1414

1515
Bug fixes
1616
~~~~~~~~~
17-
17+
* Corrects a bug in :py:func:`pvlib.temperature.fuentes`. If inputs were
18+
data type integer, users can expect modeled cell temperature values to
19+
increase slightly.
20+
(:issue:`2608`, :pull:`2745`)
1821

1922
Enhancements
2023
~~~~~~~~~~~~
@@ -46,3 +49,4 @@ Maintenance
4649
Contributors
4750
~~~~~~~~~~~~
4851
* :ghuser:`Omesh37`
52+
* Cliff Hansen (:ghuser:`cwhanse`)

pvlib/temperature.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import numpy as np
77
import pandas as pd
88
from pvlib.tools import sind
9-
from pvlib._deprecation import warn_deprecated
109
from pvlib.tools import _get_sample_intervals
1110
import scipy
1211
import scipy.constants
@@ -883,7 +882,7 @@ def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5,
883882
windmod_array = wind_speed * (module_height/wind_height)**0.2 + 1e-4
884883

885884
tmod0 = 293.15
886-
tmod_array = np.zeros_like(poa_global)
885+
tmod_array = np.zeros_like(poa_global, dtype=float)
887886

888887
iterator = zip(tamb_array, sun_array, windmod_array, tsky_array,
889888
timedelta_hours)

tests/test_pvsystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def test_PVSystem_fuentes_celltemp(mocker):
711711
assert_series_equal(spy.call_args[0][1], temps)
712712
assert_series_equal(spy.call_args[0][2], winds)
713713
assert spy.call_args[0][3] == noct_installed
714-
assert_series_equal(out, pd.Series([52.85, 55.85, 55.85], index,
714+
assert_series_equal(out, pd.Series([52.884, 56.835, 56.836], index,
715715
name='tmod'))
716716

717717

tests/test_temperature.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,16 @@ def test_fuentes_timezone(tz):
271271
out = temperature.fuentes(df['poa_global'], df['temp_air'],
272272
df['wind_speed'], noct_installed=45)
273273

274-
assert_series_equal(out, pd.Series([47.85, 50.85, 50.85], index=index,
274+
assert_series_equal(out, pd.Series([48.042, 51.845, 51.846], index=index,
275+
name='tmod'))
276+
# GH 2608
277+
df = pd.DataFrame({'poa_global': 1000., 'temp_air': 20., 'wind_speed': 1.},
278+
index)
279+
280+
out = temperature.fuentes(df['poa_global'], df['temp_air'],
281+
df['wind_speed'], noct_installed=45)
282+
283+
assert_series_equal(out, pd.Series([48.042, 51.845, 51.846], index=index,
275284
name='tmod'))
276285

277286

0 commit comments

Comments
 (0)