From 216db9e888eada077a806c49ec11a9353a975d2e Mon Sep 17 00:00:00 2001 From: Joseph Radford Date: Wed, 5 Nov 2025 22:08:07 +1100 Subject: [PATCH 1/6] Prevent atmos_refract docstring typo regression Add tests to ensure parameter name is documented as 'atmos_refract' (not 'atmos_refrac') in spa_python and solar_position docstrings. Related to #2532 --- tests/test_solarposition.py | 9 +++++++++ tests/test_spa.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/test_solarposition.py b/tests/test_solarposition.py index 88093e05f9..1f934e4578 100644 --- a/tests/test_solarposition.py +++ b/tests/test_solarposition.py @@ -86,6 +86,15 @@ def expected_rise_set_ephem(): index=times) +def test_spa_python_atmos_refract_spelling(): + """Test that parameter name is 'atmos_refract' not 'atmos_refrac'.""" + import re + # Check for 'atmos_refrac' not followed by 't' (i.e., the typo) + pattern = r'atmos_refrac(?!t)' + assert not re.search(pattern, solarposition.spa_python.__doc__), \ + "Found typo 'atmos_refrac' in spa_python docstring. Should be 'atmos_refract'" + + # the physical tests are run at the same time as the NREL SPA test. # pyephem reproduces the NREL result to 2 decimal places. # this doesn't mean that one code is better than the other. diff --git a/tests/test_spa.py b/tests/test_spa.py index 67cab4cbdb..f9ae2900b2 100644 --- a/tests/test_spa.py +++ b/tests/test_spa.py @@ -89,6 +89,15 @@ mix_month_actual = mix_year_actual +def test_solar_position_atmos_refract_spelling(): + """Test that parameter name is 'atmos_refract' not 'atmos_refrac'.""" + import re + # Check for 'atmos_refrac' not followed by 't' (i.e., the typo) + pattern = r'atmos_refrac(?!t)' + assert not re.search(pattern, pvlib.spa.solar_position.__doc__), \ + "Found typo 'atmos_refrac' in solar_position docstring. Should be 'atmos_refract'" + + class SpaBase: """Test functions common to numpy and numba spa""" def test_julian_day_dt(self): From f4274919e22992cf42a32803301e40240fe776b8 Mon Sep 17 00:00:00 2001 From: Joseph Radford Date: Wed, 5 Nov 2025 22:14:40 +1100 Subject: [PATCH 2/6] Fix atmos_refract parameter name typo in docstrings Correct parameter name from 'atmos_refrac' to 'atmos_refract' in docstrings for solarposition.spa_python and spa.solar_position to match the actual function signatures. Update whatsnew to describe this change. Closes #2532 --- docs/sphinx/source/whatsnew/v0.13.2.rst | 2 ++ pvlib/solarposition.py | 2 +- pvlib/spa.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.13.2.rst b/docs/sphinx/source/whatsnew/v0.13.2.rst index d4cd10b5e7..7b6f0a7c49 100644 --- a/docs/sphinx/source/whatsnew/v0.13.2.rst +++ b/docs/sphinx/source/whatsnew/v0.13.2.rst @@ -46,6 +46,8 @@ Enhancements Documentation ~~~~~~~~~~~~~ * Provide an overview of single-diode modeling functionality in :ref:`singlediode`. (:pull:`2565`) +* Fix typo in parameter name ``atmos_refract`` in :py:func:`pvlib.solarposition.spa_python` + and :py:func:`pvlib.spa.solar_position`. (:issue:`2532`, :pull:`TBC`) Testing diff --git a/pvlib/solarposition.py b/pvlib/solarposition.py index ba861c9d82..2b8a43e9d0 100644 --- a/pvlib/solarposition.py +++ b/pvlib/solarposition.py @@ -314,7 +314,7 @@ def spa_python(time, latitude, longitude, using time.year and time.month from pandas.DatetimeIndex. For most simulations the default delta_t is sufficient. The USNO has historical and forecasted delta_t [3]_. - atmos_refrac : float, optional + atmos_refract : float, optional The approximate atmospheric refraction (in degrees) at sunrise and sunset. how : str, optional, default 'numpy' diff --git a/pvlib/spa.py b/pvlib/spa.py index d4181aaa49..6297e88c35 100644 --- a/pvlib/spa.py +++ b/pvlib/spa.py @@ -1057,7 +1057,7 @@ def solar_position(unixtime, lat, lon, elev, pressure, temp, delta_t, degrees C; used for atmospheric correction delta_t : float or array Difference between terrestrial time and UT1. - atmos_refrac : float + atmos_refract : float The approximate atmospheric refraction (in degrees) at sunrise and sunset. numthreads: int, optional, default 8 From 452876d1bb8090279b64aed630e6a680a072dc26 Mon Sep 17 00:00:00 2001 From: Joseph Radford Date: Wed, 5 Nov 2025 22:34:43 +1100 Subject: [PATCH 3/6] Break long lines up in test files --- tests/test_solarposition.py | 8 +++++--- tests/test_spa.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/test_solarposition.py b/tests/test_solarposition.py index 1f934e4578..d22e748dc0 100644 --- a/tests/test_solarposition.py +++ b/tests/test_solarposition.py @@ -87,12 +87,14 @@ def expected_rise_set_ephem(): def test_spa_python_atmos_refract_spelling(): - """Test that parameter name is 'atmos_refract' not 'atmos_refrac'.""" + """Test parameter name is 'atmos_refract' not 'atmos_refrac'.""" import re # Check for 'atmos_refrac' not followed by 't' (i.e., the typo) pattern = r'atmos_refrac(?!t)' - assert not re.search(pattern, solarposition.spa_python.__doc__), \ - "Found typo 'atmos_refrac' in spa_python docstring. Should be 'atmos_refract'" + assert not re.search(pattern, solarposition.spa_python.__doc__), ( + "Found typo 'atmos_refrac' in spa_python docstring. " + "Should be 'atmos_refract'" + ) # the physical tests are run at the same time as the NREL SPA test. diff --git a/tests/test_spa.py b/tests/test_spa.py index f9ae2900b2..b63524351f 100644 --- a/tests/test_spa.py +++ b/tests/test_spa.py @@ -90,12 +90,14 @@ def test_solar_position_atmos_refract_spelling(): - """Test that parameter name is 'atmos_refract' not 'atmos_refrac'.""" + """Test parameter name is 'atmos_refract' not 'atmos_refrac'.""" import re # Check for 'atmos_refrac' not followed by 't' (i.e., the typo) pattern = r'atmos_refrac(?!t)' - assert not re.search(pattern, pvlib.spa.solar_position.__doc__), \ - "Found typo 'atmos_refrac' in solar_position docstring. Should be 'atmos_refract'" + assert not re.search(pattern, pvlib.spa.solar_position.__doc__), ( + "Found typo 'atmos_refrac' in solar_position docstring. " + "Should be 'atmos_refract'" + ) class SpaBase: From 62a5ce0785d31af28ccd8e0732140b37df71c408 Mon Sep 17 00:00:00 2001 From: Joseph Radford Date: Thu, 6 Nov 2025 10:14:14 +1100 Subject: [PATCH 4/6] Revert "Break long lines up in test files" This reverts commit 452876d1bb8090279b64aed630e6a680a072dc26. --- tests/test_solarposition.py | 8 +++----- tests/test_spa.py | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/test_solarposition.py b/tests/test_solarposition.py index d22e748dc0..1f934e4578 100644 --- a/tests/test_solarposition.py +++ b/tests/test_solarposition.py @@ -87,14 +87,12 @@ def expected_rise_set_ephem(): def test_spa_python_atmos_refract_spelling(): - """Test parameter name is 'atmos_refract' not 'atmos_refrac'.""" + """Test that parameter name is 'atmos_refract' not 'atmos_refrac'.""" import re # Check for 'atmos_refrac' not followed by 't' (i.e., the typo) pattern = r'atmos_refrac(?!t)' - assert not re.search(pattern, solarposition.spa_python.__doc__), ( - "Found typo 'atmos_refrac' in spa_python docstring. " - "Should be 'atmos_refract'" - ) + assert not re.search(pattern, solarposition.spa_python.__doc__), \ + "Found typo 'atmos_refrac' in spa_python docstring. Should be 'atmos_refract'" # the physical tests are run at the same time as the NREL SPA test. diff --git a/tests/test_spa.py b/tests/test_spa.py index b63524351f..f9ae2900b2 100644 --- a/tests/test_spa.py +++ b/tests/test_spa.py @@ -90,14 +90,12 @@ def test_solar_position_atmos_refract_spelling(): - """Test parameter name is 'atmos_refract' not 'atmos_refrac'.""" + """Test that parameter name is 'atmos_refract' not 'atmos_refrac'.""" import re # Check for 'atmos_refrac' not followed by 't' (i.e., the typo) pattern = r'atmos_refrac(?!t)' - assert not re.search(pattern, pvlib.spa.solar_position.__doc__), ( - "Found typo 'atmos_refrac' in solar_position docstring. " - "Should be 'atmos_refract'" - ) + assert not re.search(pattern, pvlib.spa.solar_position.__doc__), \ + "Found typo 'atmos_refrac' in solar_position docstring. Should be 'atmos_refract'" class SpaBase: From 6c82ccb3f3447d6d9507daf520856fc71d711786 Mon Sep 17 00:00:00 2001 From: Joseph Radford Date: Thu, 6 Nov 2025 10:15:20 +1100 Subject: [PATCH 5/6] Revert "Prevent atmos_refract docstring typo regression" This reverts commit 216db9e888eada077a806c49ec11a9353a975d2e. --- tests/test_solarposition.py | 9 --------- tests/test_spa.py | 9 --------- 2 files changed, 18 deletions(-) diff --git a/tests/test_solarposition.py b/tests/test_solarposition.py index 1f934e4578..88093e05f9 100644 --- a/tests/test_solarposition.py +++ b/tests/test_solarposition.py @@ -86,15 +86,6 @@ def expected_rise_set_ephem(): index=times) -def test_spa_python_atmos_refract_spelling(): - """Test that parameter name is 'atmos_refract' not 'atmos_refrac'.""" - import re - # Check for 'atmos_refrac' not followed by 't' (i.e., the typo) - pattern = r'atmos_refrac(?!t)' - assert not re.search(pattern, solarposition.spa_python.__doc__), \ - "Found typo 'atmos_refrac' in spa_python docstring. Should be 'atmos_refract'" - - # the physical tests are run at the same time as the NREL SPA test. # pyephem reproduces the NREL result to 2 decimal places. # this doesn't mean that one code is better than the other. diff --git a/tests/test_spa.py b/tests/test_spa.py index f9ae2900b2..67cab4cbdb 100644 --- a/tests/test_spa.py +++ b/tests/test_spa.py @@ -89,15 +89,6 @@ mix_month_actual = mix_year_actual -def test_solar_position_atmos_refract_spelling(): - """Test that parameter name is 'atmos_refract' not 'atmos_refrac'.""" - import re - # Check for 'atmos_refrac' not followed by 't' (i.e., the typo) - pattern = r'atmos_refrac(?!t)' - assert not re.search(pattern, pvlib.spa.solar_position.__doc__), \ - "Found typo 'atmos_refrac' in solar_position docstring. Should be 'atmos_refract'" - - class SpaBase: """Test functions common to numpy and numba spa""" def test_julian_day_dt(self): From eaa62647ad3375ac45b68a8f0f57c0a137907a78 Mon Sep 17 00:00:00 2001 From: Joseph Radford Date: Thu, 6 Nov 2025 10:28:02 +1100 Subject: [PATCH 6/6] Add PR number and contributer name to whatsnew --- docs/sphinx/source/whatsnew/v0.13.2.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.13.2.rst b/docs/sphinx/source/whatsnew/v0.13.2.rst index 7b6f0a7c49..9a07bd21fb 100644 --- a/docs/sphinx/source/whatsnew/v0.13.2.rst +++ b/docs/sphinx/source/whatsnew/v0.13.2.rst @@ -47,7 +47,7 @@ Documentation ~~~~~~~~~~~~~ * Provide an overview of single-diode modeling functionality in :ref:`singlediode`. (:pull:`2565`) * Fix typo in parameter name ``atmos_refract`` in :py:func:`pvlib.solarposition.spa_python` - and :py:func:`pvlib.spa.solar_position`. (:issue:`2532`, :pull:`TBC`) + and :py:func:`pvlib.spa.solar_position`. (:issue:`2532`, :pull:`2592`) Testing @@ -69,3 +69,4 @@ Maintenance Contributors ~~~~~~~~~~~~ * Cliff Hansen (:ghuser:`cwhanse`) +* Joseph Radford (:ghuser:`josephradford`)