Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pvlib/temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
48 changes: 48 additions & 0 deletions tests/test_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,51 @@
"'alpha': 0.9}")

assert glm.__repr__() == expected


@pytest.mark.parametrize('tz', [None, 'Etc/GMT+5'])
def test_fuentes_timezone(tz):

Check failure on line 507 in tests/test_temperature.py

View workflow job for this annotation

GitHub Actions / flake8-linter

F811 redefinition of unused 'test_fuentes_timezone' from line 265
index = pd.date_range('2019-01-01', freq='h', periods=3, tz=tz)

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)

expected = pd.Series(
[48.041843, 51.845471, 51.846428],
index=index,
name='tmod'
)

assert_series_equal(out.round(6), expected.round(6))


def test_fuentes_int_vs_float():
"""Ensure integer and float inputs give identical results."""
index = pd.date_range("2019-01-01", freq="h", periods=2)

inputs = pd.DataFrame({
"poa_global": [1000, 500],
"temp_air": [25, 25],
"wind_speed": [1, 1],
}, index=index)

result_int = temperature.fuentes(
poa_global=inputs["poa_global"],
temp_air=inputs["temp_air"],
wind_speed=inputs["wind_speed"],
noct_installed=45
)

inputs_float = inputs.astype(float)

result_float = temperature.fuentes(
poa_global=inputs_float["poa_global"],
temp_air=inputs_float["temp_air"],
wind_speed=inputs_float["wind_speed"],
noct_installed=45
)

assert_allclose(result_int.values, result_float.values)

Check failure on line 551 in tests/test_temperature.py

View workflow job for this annotation

GitHub Actions / flake8-linter

W292 no newline at end of file
Loading