diff --git a/docs/sphinx/source/whatsnew/v0.15.2.rst b/docs/sphinx/source/whatsnew/v0.15.2.rst index 0f32b734ef..5588026463 100644 --- a/docs/sphinx/source/whatsnew/v0.15.2.rst +++ b/docs/sphinx/source/whatsnew/v0.15.2.rst @@ -14,7 +14,10 @@ Deprecations Bug fixes ~~~~~~~~~ - +* Corrects a bug in :py:func:`pvlib.temperature.fuentes`. If inputs were + data type integer, users can expect modeled cell temperature values to + increase slightly. + (:issue:`2608`, :pull:``) Enhancements ~~~~~~~~~~~~ @@ -46,3 +49,4 @@ Maintenance Contributors ~~~~~~~~~~~~ * :ghuser:`Omesh37` +* Cliff Hansen (:ghuser:`cwhanse`) diff --git a/pvlib/temperature.py b/pvlib/temperature.py index cb487ee77b..55222c0fb1 100644 --- a/pvlib/temperature.py +++ b/pvlib/temperature.py @@ -6,7 +6,6 @@ import numpy as np import pandas as pd from pvlib.tools import sind -from pvlib._deprecation import warn_deprecated from pvlib.tools import _get_sample_intervals import scipy import scipy.constants @@ -883,7 +882,7 @@ def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5, windmod_array = wind_speed * (module_height/wind_height)**0.2 + 1e-4 tmod0 = 293.15 - tmod_array = np.zeros_like(poa_global) + tmod_array = np.zeros_like(poa_global, dtype=float) iterator = zip(tamb_array, sun_array, windmod_array, tsky_array, timedelta_hours) diff --git a/tests/test_pvsystem.py b/tests/test_pvsystem.py index 9257b769f3..267d3b14c9 100644 --- a/tests/test_pvsystem.py +++ b/tests/test_pvsystem.py @@ -711,7 +711,7 @@ def test_PVSystem_fuentes_celltemp(mocker): assert_series_equal(spy.call_args[0][1], temps) assert_series_equal(spy.call_args[0][2], winds) assert spy.call_args[0][3] == noct_installed - assert_series_equal(out, pd.Series([52.85, 55.85, 55.85], index, + assert_series_equal(out, pd.Series([52.884, 56.835, 56.836], index, name='tmod')) diff --git a/tests/test_temperature.py b/tests/test_temperature.py index e238183600..f7cc242477 100644 --- a/tests/test_temperature.py +++ b/tests/test_temperature.py @@ -271,7 +271,16 @@ def test_fuentes_timezone(tz): out = temperature.fuentes(df['poa_global'], df['temp_air'], df['wind_speed'], noct_installed=45) - assert_series_equal(out, pd.Series([47.85, 50.85, 50.85], index=index, + assert_series_equal(out, pd.Series([48.042, 51.845, 51.846], index=index, + name='tmod')) + # GH 2608 + df = pd.DataFrame({'poa_global': 1000., 'temp_air': 20., 'wind_speed': 1.}, + index) + + out = temperature.fuentes(df['poa_global'], df['temp_air'], + df['wind_speed'], noct_installed=45) + + assert_series_equal(out, pd.Series([48.042, 51.845, 51.846], index=index, name='tmod'))