From c92a90731ee01126ac8550f87304ec603f238e03 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Sat, 22 Jun 2024 12:40:43 +0200 Subject: [PATCH 01/19] stream_temperature_function --- docs/sphinx/source/reference/floating.rst | 12 +++++ docs/sphinx/source/reference/index.rst | 1 + pvlib/__init__.py | 1 + pvlib/floating.py | 59 +++++++++++++++++++++++ pvlib/tests/test_floating.py | 33 +++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 docs/sphinx/source/reference/floating.rst create mode 100644 pvlib/floating.py create mode 100644 pvlib/tests/test_floating.py diff --git a/docs/sphinx/source/reference/floating.rst b/docs/sphinx/source/reference/floating.rst new file mode 100644 index 0000000000..a78ead10ae --- /dev/null +++ b/docs/sphinx/source/reference/floating.rst @@ -0,0 +1,12 @@ +.. currentmodule:: pvlib + +Floating +======== + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + floating.daily_stream_temperature_stefan diff --git a/docs/sphinx/source/reference/index.rst b/docs/sphinx/source/reference/index.rst index 8a990ac923..92de6cc6fe 100644 --- a/docs/sphinx/source/reference/index.rst +++ b/docs/sphinx/source/reference/index.rst @@ -21,3 +21,4 @@ API reference scaling location transformer + floating diff --git a/pvlib/__init__.py b/pvlib/__init__.py index b5b07866a4..74f39a075a 100644 --- a/pvlib/__init__.py +++ b/pvlib/__init__.py @@ -8,6 +8,7 @@ atmosphere, bifacial, clearsky, + floating, iam, inverter, iotools, diff --git a/pvlib/floating.py b/pvlib/floating.py new file mode 100644 index 0000000000..5cec8932c5 --- /dev/null +++ b/pvlib/floating.py @@ -0,0 +1,59 @@ +""" +The ``floating`` module contains functions for calculating parameters related +to floating PV systems. +""" + +import numpy as np +import pandas as pd + + +def daily_stream_temperature_stefan(temp_air): + r""" + Estimation of daily stream water temperature based on ambient temperature. + + Parameters + ---------- + temp_air : numeric + Ambient dry bulb temperature. [degrees C] + + Returns + ------- + daily_stream_temperature : numeric + Daily average stream water temperature. [degrees C] + + Notes + ----- + The equation for calculating the daily average stream water temperature + :math:`T_w` using the ambient air temperature :math:`T_{air}` is given by: + + .. math:: + :label: stream + + T_w = 5 + 0.75 * T_{air} + + The predicted daily stream water temperatrues of this equation had a + standard deviation of 2.7 ^oC compared to measurements. Small, shallow + streams had smaller deviations than large, deep rivers. + + It should be noted that this equation is limited to streams, i.e., water + bodies that are well mixed in vertical and transverse direction of a cross + section. Also, it is only tested on ice-free streams. Consequently, when + the mean ambient air temperature is lower than -6 ^oC, the surface stream + water temperature is assumed to be zero. + + References + ---------- + .. [1] Stefan H. G., Preud'homme E. B. (1993). "Stream temperature + estimation from air temperature." IN: Journal of the American Water + Resources Association 29-1: 27-45. + :doi:`10.1111/j.1752-1688.1993.tb01502.x` + """ + + temp_stream = 5 + 0.75 * temp_air + + temp_stream = np.where(temp_stream < 0, 0, temp_stream) + + if isinstance(temp_air, pd.Series): + temp_stream = pd.Series(temp_stream, index=temp_air.index) + + return temp_stream diff --git a/pvlib/tests/test_floating.py b/pvlib/tests/test_floating.py new file mode 100644 index 0000000000..80200b03ce --- /dev/null +++ b/pvlib/tests/test_floating.py @@ -0,0 +1,33 @@ +import numpy as np +import pandas as pd +from pvlib import floating + +from .conftest import assert_series_equal +from numpy.testing import assert_allclose + + +def test_daily_stream_temperature_stefan_default(): + result = floating.daily_stream_temperature_stefan(temp_air=15) + assert_allclose(result, 16.25, 0.01) + + +def test_daily_stream_temperature_stefan_negative_temp(): + result = floating.daily_stream_temperature_stefan(temp_air=-15) + assert_allclose(result, 0, 0.1) + + +def test_daily_stream_temperature_stefan_ndarray(): + air_temps = np.array([-5, 2.5, 20, 30, 40]) + result = floating.daily_stream_temperature_stefan(temp_air=air_temps) + expected = np.array([1.25, 6.875, 20, 27.5, 35]) + assert_allclose(expected, result, atol=1e-3) + + +def test_daily_stream_temperature_stefan_series(): + times = pd.date_range(start="2015-01-01 00:00", end="2015-01-05 00:00", + freq="1d") + air_temps = pd.Series([-5, 2.5, 20, 30, 40], index=times) + + result = floating.daily_stream_temperature_stefan(temp_air=air_temps) + expected = pd.Series([1.25, 6.875, 20, 27.5, 35], index=times) + assert_series_equal(expected, result, atol=1e-3) From ff791e63775fb41c9572d4e5cecc2e3515500271 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Sat, 22 Jun 2024 12:54:12 +0200 Subject: [PATCH 02/19] format edits --- pvlib/floating.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index 5cec8932c5..0341772091 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -24,21 +24,22 @@ def daily_stream_temperature_stefan(temp_air): Notes ----- The equation for calculating the daily average stream water temperature - :math:`T_w` using the ambient air temperature :math:`T_{air}` is given by: + :math:`T_w` using the ambient air temperature :math:`T_{air}` is provided + in [1]_ and given by: .. math:: :label: stream - T_w = 5 + 0.75 * T_{air} + T_w = 5 + 0.75 \cdot T_{air} The predicted daily stream water temperatrues of this equation had a - standard deviation of 2.7 ^oC compared to measurements. Small, shallow + standard deviation of 2.7 $^o$C compared to measurements. Small, shallow streams had smaller deviations than large, deep rivers. It should be noted that this equation is limited to streams, i.e., water bodies that are well mixed in vertical and transverse direction of a cross section. Also, it is only tested on ice-free streams. Consequently, when - the mean ambient air temperature is lower than -6 ^oC, the surface stream + the mean ambient air temperature is lower than -6 $^o$C, the surface stream water temperature is assumed to be zero. References From 9197a037fcb24adfaf4953b9bd5112a533f1fc9b Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Sat, 22 Jun 2024 13:01:29 +0200 Subject: [PATCH 03/19] degree symbol fix --- pvlib/floating.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index 0341772091..c782f10ec6 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -33,13 +33,13 @@ def daily_stream_temperature_stefan(temp_air): T_w = 5 + 0.75 \cdot T_{air} The predicted daily stream water temperatrues of this equation had a - standard deviation of 2.7 $^o$C compared to measurements. Small, shallow + standard deviation of 2.7 °C compared to measurements. Small, shallow streams had smaller deviations than large, deep rivers. It should be noted that this equation is limited to streams, i.e., water bodies that are well mixed in vertical and transverse direction of a cross section. Also, it is only tested on ice-free streams. Consequently, when - the mean ambient air temperature is lower than -6 $^o$C, the surface stream + the mean ambient air temperature is lower than -6 °C, the surface stream water temperature is assumed to be zero. References From 9eb689cefc58e7cd0e1e71883281863acb4c3a3a Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Mon, 24 Jun 2024 12:05:12 +0200 Subject: [PATCH 04/19] Echedey's feedback --- pvlib/floating.py | 24 ++++++++++++------- pvlib/tests/test_floating.py | 46 ++++++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index c782f10ec6..1fc839e178 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -7,25 +7,26 @@ import pandas as pd -def daily_stream_temperature_stefan(temp_air): +def stream_temperature_stefan(temp_air): r""" - Estimation of daily stream water temperature based on ambient temperature. + Estimation of daily stream water temperature based on daily ambient + temperature. Parameters ---------- temp_air : numeric - Ambient dry bulb temperature. [degrees C] + Daily average ambient dry bulb temperature. [°C] Returns ------- - daily_stream_temperature : numeric - Daily average stream water temperature. [degrees C] + water_temperature : numeric + Daily average stream water temperature. [°C] Notes ----- The equation for calculating the daily average stream water temperature - :math:`T_w` using the ambient air temperature :math:`T_{air}` is provided - in [1]_ and given by: + :math:`T_w` from the daily ambient air temperature :math:`T_{air}` is + provided in [1]_ and given by: .. math:: :label: stream @@ -40,7 +41,12 @@ def daily_stream_temperature_stefan(temp_air): bodies that are well mixed in vertical and transverse direction of a cross section. Also, it is only tested on ice-free streams. Consequently, when the mean ambient air temperature is lower than -6 °C, the surface stream - water temperature is assumed to be zero. + water temperature is returned as NaN. + + Warning + ------- + The expression has been developed for inland streams and is thus not + suitable for estimating ocean temperature. References ---------- @@ -52,7 +58,7 @@ def daily_stream_temperature_stefan(temp_air): temp_stream = 5 + 0.75 * temp_air - temp_stream = np.where(temp_stream < 0, 0, temp_stream) + temp_stream = np.where(temp_stream < 0, np.nan, temp_stream) if isinstance(temp_air, pd.Series): temp_stream = pd.Series(temp_stream, index=temp_air.index) diff --git a/pvlib/tests/test_floating.py b/pvlib/tests/test_floating.py index 80200b03ce..2f5278887f 100644 --- a/pvlib/tests/test_floating.py +++ b/pvlib/tests/test_floating.py @@ -4,30 +4,40 @@ from .conftest import assert_series_equal from numpy.testing import assert_allclose +import pytest -def test_daily_stream_temperature_stefan_default(): - result = floating.daily_stream_temperature_stefan(temp_air=15) - assert_allclose(result, 16.25, 0.01) +@pytest.mark.parametrize('air_temp,water_temp', [ + (-15, np.nan), + (-5, 1.25), + (40, 35), +]) +def test_stream_temperature_stefan(air_temp, water_temp): + result = floating.stream_temperature_stefan(air_temp) + assert_allclose(result, water_temp) -def test_daily_stream_temperature_stefan_negative_temp(): - result = floating.daily_stream_temperature_stefan(temp_air=-15) - assert_allclose(result, 0, 0.1) +@pytest.fixture +def times(): + return pd.date_range(start="2015-01-01 00:00", end="2015-01-07 00:00", + freq="1d") -def test_daily_stream_temperature_stefan_ndarray(): - air_temps = np.array([-5, 2.5, 20, 30, 40]) - result = floating.daily_stream_temperature_stefan(temp_air=air_temps) - expected = np.array([1.25, 6.875, 20, 27.5, 35]) - assert_allclose(expected, result, atol=1e-3) +@pytest.fixture +def air_temps(times): + return pd.Series([-15, -5, 2.5, 15, 20, 30, 40], index=times) -def test_daily_stream_temperature_stefan_series(): - times = pd.date_range(start="2015-01-01 00:00", end="2015-01-05 00:00", - freq="1d") - air_temps = pd.Series([-5, 2.5, 20, 30, 40], index=times) +@pytest.fixture +def water_temps_expected(times): + return pd.Series([np.nan, 1.25, 6.875, 16.25, 20, 27.5, 35], index=times) - result = floating.daily_stream_temperature_stefan(temp_air=air_temps) - expected = pd.Series([1.25, 6.875, 20, 27.5, 35], index=times) - assert_series_equal(expected, result, atol=1e-3) + +def test_stream_temperature_stefan_ndarray(air_temps, water_temps_expected): + result = floating.stream_temperature_stefan(temp_air=air_temps.to_numpy()) + assert_allclose(water_temps_expected.to_numpy(), result) + + +def test_stream_temperature_stefan_series(air_temps, water_temps_expected): + result = floating.stream_temperature_stefan(temp_air=air_temps) + assert_series_equal(water_temps_expected, result) From 9f24a1a01126ee54d273c0756eb9969e2f439f40 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Mon, 24 Jun 2024 12:12:44 +0200 Subject: [PATCH 05/19] fixed toc --- docs/sphinx/source/reference/floating.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/reference/floating.rst b/docs/sphinx/source/reference/floating.rst index a78ead10ae..5fa22a6049 100644 --- a/docs/sphinx/source/reference/floating.rst +++ b/docs/sphinx/source/reference/floating.rst @@ -9,4 +9,4 @@ Functions .. autosummary:: :toctree: generated/ - floating.daily_stream_temperature_stefan + floating.stream_temperature_stefan From 05da8232c368df71a56ed241372a461f8b1f6125 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:43:58 +0200 Subject: [PATCH 06/19] Update pvlib/floating.py Co-authored-by: Cliff Hansen --- pvlib/floating.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index 1fc839e178..d4b8169e49 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -9,8 +9,7 @@ def stream_temperature_stefan(temp_air): r""" - Estimation of daily stream water temperature based on daily ambient - temperature. + Estimate daily stream water temperature from daily ambient air temperature. Parameters ---------- From 2fff8a6c1f74729ba120646516ea6a26eaf93a8d Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:44:06 +0200 Subject: [PATCH 07/19] Update pvlib/floating.py Co-authored-by: Cliff Hansen --- pvlib/floating.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index d4b8169e49..b2fb38afbe 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -23,9 +23,9 @@ def stream_temperature_stefan(temp_air): Notes ----- - The equation for calculating the daily average stream water temperature - :math:`T_w` from the daily ambient air temperature :math:`T_{air}` is - provided in [1]_ and given by: + Daily average stream water temperature + :math:`T_w` is calculated from daily ambient air temperature :math:`T_{air}` as + provided in [1]_: .. math:: :label: stream From d5c93f9321a453ef8cf3f98cd02fe9cc1ffa9555 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:44:14 +0200 Subject: [PATCH 08/19] Update pvlib/floating.py Co-authored-by: Cliff Hansen --- pvlib/floating.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index b2fb38afbe..5d4f417597 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -32,7 +32,7 @@ def stream_temperature_stefan(temp_air): T_w = 5 + 0.75 \cdot T_{air} - The predicted daily stream water temperatrues of this equation had a + The predicted daily stream water temperatures had a standard deviation of 2.7 °C compared to measurements. Small, shallow streams had smaller deviations than large, deep rivers. From c281c4b5c8e460c0e7fbfcbb0b4772d5794e534c Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:44:21 +0200 Subject: [PATCH 09/19] Update pvlib/floating.py Co-authored-by: Cliff Hansen --- pvlib/floating.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index 5d4f417597..60f640b365 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -37,7 +37,7 @@ def stream_temperature_stefan(temp_air): streams had smaller deviations than large, deep rivers. It should be noted that this equation is limited to streams, i.e., water - bodies that are well mixed in vertical and transverse direction of a cross + bodies that are well mixed in the vertical and transverse directions of a cross section. Also, it is only tested on ice-free streams. Consequently, when the mean ambient air temperature is lower than -6 °C, the surface stream water temperature is returned as NaN. From d8e6f10c963d92972c256645ace9ea0cf068b359 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Mon, 24 Jun 2024 22:44:28 +0200 Subject: [PATCH 10/19] Update pvlib/floating.py Co-authored-by: Cliff Hansen --- pvlib/floating.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index 60f640b365..820f6aea4f 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -50,7 +50,7 @@ def stream_temperature_stefan(temp_air): References ---------- .. [1] Stefan H. G., Preud'homme E. B. (1993). "Stream temperature - estimation from air temperature." IN: Journal of the American Water + estimation from air temperature." Journal of the American Water Resources Association 29-1: 27-45. :doi:`10.1111/j.1752-1688.1993.tb01502.x` """ From 883b2c289348849e9b1ba7f2375350c9c63d3f50 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Mon, 24 Jun 2024 23:31:53 +0200 Subject: [PATCH 11/19] fixed linter --- pvlib/floating.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index 820f6aea4f..e9699e3844 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -24,8 +24,8 @@ def stream_temperature_stefan(temp_air): Notes ----- Daily average stream water temperature - :math:`T_w` is calculated from daily ambient air temperature :math:`T_{air}` as - provided in [1]_: + :math:`T_w` is calculated from daily ambient air temperature + :math:`T_{air}` as provided in [1]_: .. math:: :label: stream @@ -37,10 +37,10 @@ def stream_temperature_stefan(temp_air): streams had smaller deviations than large, deep rivers. It should be noted that this equation is limited to streams, i.e., water - bodies that are well mixed in the vertical and transverse directions of a cross - section. Also, it is only tested on ice-free streams. Consequently, when - the mean ambient air temperature is lower than -6 °C, the surface stream - water temperature is returned as NaN. + bodies that are well mixed in the vertical and transverse directions of a + cross section. Also, it is only tested on ice-free streams. Consequently, + when the mean ambient air temperature is lower than -6 °C, the surface + stream water temperature is returned as NaN. Warning ------- From 5d0246bfa852541f4f5d8655d33c670fa882b8bc Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Thu, 4 Jul 2024 13:02:17 +0200 Subject: [PATCH 12/19] Added text --- pvlib/floating.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pvlib/floating.py b/pvlib/floating.py index e9699e3844..c11f492d3b 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -42,6 +42,11 @@ def stream_temperature_stefan(temp_air): when the mean ambient air temperature is lower than -6 °C, the surface stream water temperature is returned as NaN. + Also, although this equation was created for estimating stream temperature, + there are a number of publications that have used it for estimating the + lakewater and seawater temperature for floating PV, without having any + proof that this is a legitimate approach. + Warning ------- The expression has been developed for inland streams and is thus not From 6b2a2a0371592c85c37bdfa220e91edba5350e7f Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Thu, 4 Jul 2024 13:06:55 +0200 Subject: [PATCH 13/19] update whatsnew --- docs/sphinx/source/whatsnew/v0.11.1.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.11.1.rst b/docs/sphinx/source/whatsnew/v0.11.1.rst index aa2205bb43..7214345670 100644 --- a/docs/sphinx/source/whatsnew/v0.11.1.rst +++ b/docs/sphinx/source/whatsnew/v0.11.1.rst @@ -10,7 +10,9 @@ Deprecations Enhancements ~~~~~~~~~~~~ - +* Add function :py:func:`pvlib.floating.stream_temperature_stefan`, to calculate the + water temperature for inland water bodies. + (:pull:`2104`) Bug fixes ~~~~~~~~~ @@ -30,4 +32,4 @@ Requirements Contributors ~~~~~~~~~~~~ - +* Ioannis Sifnaios (:ghuser:`IoannisSifnaios`) From dee6a82b33b92cbadbf573f12abbd8b21baa9a7c Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Sat, 6 Jul 2024 15:11:55 +0200 Subject: [PATCH 14/19] Update pvlib/floating.py Co-authored-by: Anton Driesse --- pvlib/floating.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index c11f492d3b..f8da9ab372 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -39,7 +39,7 @@ def stream_temperature_stefan(temp_air): It should be noted that this equation is limited to streams, i.e., water bodies that are well mixed in the vertical and transverse directions of a cross section. Also, it is only tested on ice-free streams. Consequently, - when the mean ambient air temperature is lower than -6 °C, the surface + when the mean ambient air temperature is lower than -6.66 °C, the surface stream water temperature is returned as NaN. Also, although this equation was created for estimating stream temperature, From 78fedf75a879cdbb276c1a89bef0cdf9cb2d6b61 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Sat, 6 Jul 2024 15:12:07 +0200 Subject: [PATCH 15/19] Update pvlib/floating.py Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- pvlib/floating.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index f8da9ab372..ee5419985c 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -42,10 +42,10 @@ def stream_temperature_stefan(temp_air): when the mean ambient air temperature is lower than -6.66 °C, the surface stream water temperature is returned as NaN. - Also, although this equation was created for estimating stream temperature, + While this equation was created for estimating stream temperature, there are a number of publications that have used it for estimating the - lakewater and seawater temperature for floating PV, without having any - proof that this is a legitimate approach. + lakewater and seawater temperature for floating PV, although without + providing any proof of the formula's validity for such purposes. Warning ------- From 352e4f443559aa869f0ebeb9143efba6b853826c Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:25:15 +0200 Subject: [PATCH 16/19] Apply suggestions from code review Co-authored-by: RDaxini <143435106+RDaxini@users.noreply.github.com> Co-authored-by: Anton Driesse --- pvlib/floating.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index ee5419985c..05449c49e7 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -40,18 +40,14 @@ def stream_temperature_stefan(temp_air): bodies that are well mixed in the vertical and transverse directions of a cross section. Also, it is only tested on ice-free streams. Consequently, when the mean ambient air temperature is lower than -6.66 °C, the surface - stream water temperature is returned as NaN. + stream water temperature is returned as ``np.nan``. - While this equation was created for estimating stream temperature, - there are a number of publications that have used it for estimating the - lakewater and seawater temperature for floating PV, although without - providing any proof of the formula's validity for such purposes. - - Warning - ------- - The expression has been developed for inland streams and is thus not - suitable for estimating ocean temperature. + Although this model was developed to estimate stream temperature, + a number of publications have used it to estimate lakewater and + seawater temperatures for floating PV without evidence of validity + for such applications. + References ---------- .. [1] Stefan H. G., Preud'homme E. B. (1993). "Stream temperature From dc3098b93afb9e15f4ca9301911e1435c99e7392 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:15:13 +0300 Subject: [PATCH 17/19] Update pvlib/floating.py Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com> --- pvlib/floating.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index 05449c49e7..48f0841195 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -28,7 +28,6 @@ def stream_temperature_stefan(temp_air): :math:`T_{air}` as provided in [1]_: .. math:: - :label: stream T_w = 5 + 0.75 \cdot T_{air} From 7d1ac3cd3ab64a9566914e62ade9bc7e362d2ed2 Mon Sep 17 00:00:00 2001 From: Ioannis Sifnaios Date: Wed, 17 Jul 2024 17:25:57 +0300 Subject: [PATCH 18/19] fixed linter --- pvlib/floating.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pvlib/floating.py b/pvlib/floating.py index 48f0841195..28f60c140d 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -46,7 +46,6 @@ def stream_temperature_stefan(temp_air): seawater temperatures for floating PV without evidence of validity for such applications. - References ---------- .. [1] Stefan H. G., Preud'homme E. B. (1993). "Stream temperature From ceedb1da1ac0e59362ba9bd17b150797c53ce8f5 Mon Sep 17 00:00:00 2001 From: "Adam R. Jensen" <39184289+AdamRJensen@users.noreply.github.com> Date: Thu, 12 Sep 2024 21:44:29 +0200 Subject: [PATCH 19/19] Apply suggestions from code review Co-authored-by: Cliff Hansen --- docs/sphinx/source/whatsnew/v0.11.1.rst | 2 +- pvlib/floating.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.11.1.rst b/docs/sphinx/source/whatsnew/v0.11.1.rst index 64f6deba1c..1db92ed0d2 100644 --- a/docs/sphinx/source/whatsnew/v0.11.1.rst +++ b/docs/sphinx/source/whatsnew/v0.11.1.rst @@ -11,7 +11,7 @@ Deprecations Enhancements ~~~~~~~~~~~~ * Add function :py:func:`pvlib.floating.stream_temperature_stefan`, to calculate the - water temperature for inland water bodies. + water temperature for streams and rivers. (:pull:`2104`) * Add new losses function that accounts for non-uniform irradiance on bifacial modules, :py:func:`pvlib.bifacial.power_mismatch_deline`. diff --git a/pvlib/floating.py b/pvlib/floating.py index 28f60c140d..156fb26570 100644 --- a/pvlib/floating.py +++ b/pvlib/floating.py @@ -41,7 +41,8 @@ def stream_temperature_stefan(temp_air): when the mean ambient air temperature is lower than -6.66 °C, the surface stream water temperature is returned as ``np.nan``. - Although this model was developed to estimate stream temperature, +..warning:: + This model was developed to estimate stream temperature. A number of a number of publications have used it to estimate lakewater and seawater temperatures for floating PV without evidence of validity for such applications.