diff --git a/docs/sphinx/source/whatsnew/v0.16.2.rst b/docs/sphinx/source/whatsnew/v0.16.2.rst index 64132a2547..2acc24384b 100644 --- a/docs/sphinx/source/whatsnew/v0.16.2.rst +++ b/docs/sphinx/source/whatsnew/v0.16.2.rst @@ -7,7 +7,6 @@ v0.16.2 (Anticipated December, 2026) Breaking Changes ~~~~~~~~~~~~~~~~ - Deprecations ~~~~~~~~~~~~ @@ -28,6 +27,12 @@ Enhancements allowing for choosing between ERA5 and ERA5-Land datasets. (:pull:`2780`) +* Pass ``offset`` directly to ``_calculate_simple_day_angle`` in + :py:func:`pvlib.solarposition.equation_of_time_pvcdrom` and + :py:func:`pvlib.solarposition.declination_cooper69` instead of + adding or subtracting equivalent multiples of 2*pi/365 afterwards. + (:issue:`2902`, :pull:`2911`) + Documentation ~~~~~~~~~~~~~ * Clarified in :py:func:`pvlib.tracking.singleaxis` that the tracker diff --git a/pvlib/solarposition.py b/pvlib/solarposition.py index 4441ed01f1..2974ffc8d3 100644 --- a/pvlib/solarposition.py +++ b/pvlib/solarposition.py @@ -1144,8 +1144,7 @@ def equation_of_time_pvcdrom(dayofyear): equation_of_time_spencer71 """ # day angle relative to Vernal Equinox, typically March 22 (day number 81) - bday = \ - _calculate_simple_day_angle(dayofyear) - (2.0 * np.pi / 365.0) * 80.0 + bday = _calculate_simple_day_angle(dayofyear, offset=81) # same value but about 2x faster than Spencer (1971) return 9.87 * np.sin(2.0 * bday) - 7.53 * np.cos(bday) - 1.5 * np.sin(bday) @@ -1236,8 +1235,8 @@ def declination_cooper69(dayofyear): -------- declination_spencer71 """ - day_angle = _calculate_simple_day_angle(dayofyear) - dec = np.deg2rad(23.45 * np.sin(day_angle + (2.0 * np.pi / 365.0) * 285.0)) + day_angle = _calculate_simple_day_angle(dayofyear, offset=-284) + dec = np.deg2rad(23.45 * np.sin(day_angle)) return dec