From e99207d537f94ab3204fd4efe0008315e99392d1 Mon Sep 17 00:00:00 2001 From: r0hansaxena Date: Fri, 6 Mar 2026 19:58:26 +0530 Subject: [PATCH 1/2] Fix numpy array syntax in scaling.py and update tests --- docs/sphinx/source/whatsnew/v0.15.1.rst | 3 +++ pvlib/scaling.py | 2 +- tests/test_scaling.py | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.15.1.rst b/docs/sphinx/source/whatsnew/v0.15.1.rst index 5e93232eed..7606acdc78 100644 --- a/docs/sphinx/source/whatsnew/v0.15.1.rst +++ b/docs/sphinx/source/whatsnew/v0.15.1.rst @@ -14,6 +14,9 @@ Deprecations Bug fixes ~~~~~~~~~ +* Fix a bug in :py:func:`pvlib.scaling.latlon_to_xy` where latitude + scaling was incorrectly applied to both latitude and longitude components. + (:issue:`2614`, :pull:` `) * Fix a division-by-zero condition in :py:func:`pvlib.transformer.simple_efficiency` when ``load_loss = 0``. (:issue:`2645`, :pull:`2646`) diff --git a/pvlib/scaling.py b/pvlib/scaling.py index 2f9e0df594..693d9f6bff 100644 --- a/pvlib/scaling.py +++ b/pvlib/scaling.py @@ -196,7 +196,7 @@ def latlon_to_xy(coordinates): m_per_deg_lon = r_earth * np.cos(np.pi/180 * meanlat) * np.pi/180 # Conversion - pos = coordinates * np.array(m_per_deg_lat, m_per_deg_lon) + pos = coordinates * np.array([m_per_deg_lat, m_per_deg_lon]) # reshape as (x,y) pairs to return try: diff --git a/tests/test_scaling.py b/tests/test_scaling.py index 344e2209b5..f8638f580a 100644 --- a/tests/test_scaling.py +++ b/tests/test_scaling.py @@ -52,7 +52,7 @@ def time_500ms(clear_sky_index): @pytest.fixture def positions(): # Sample positions based on the previous lat/lon (calculated manually) - expect_xpos = np.array([554863.4, 555975.4, 557087.3]) + expect_xpos = np.array([546433.8, 547528.9, 548623.9]) expect_ypos = np.array([1110838.8, 1111950.8, 1113062.7]) return np.array([pt for pt in zip(expect_xpos, expect_ypos)]) @@ -89,14 +89,16 @@ def expect_wavelet(): @pytest.fixture def expect_cs_smooth(): # Expected smoothed clear sky index for indices 5000:5004 (Matlab) - return np.array([1., 1., 1.05774, 0.94226, 1.]) + return np.array([1., 1., 1.057735, 0.942265, 1.]) @pytest.fixture def expect_vr(): # Expected VR for expecttmscale - return np.array([3., 3., 3., 3., 3., 3., 2.9997844, 2.9708118, 2.6806291, - 2.0726611, 1.5653324, 1.2812714, 1.1389995]) + return np.array([3., 3., 3., 3., 3., + 2.99999999, 2.99976775, 2.96971249, + 2.67505872, 2.06592527, 1.5611084, + 1.27910582, 1.13793164]) def test_latlon_to_xy_zero(): From 6093c8ef032b2c3d426a4a28e94763f511ae7607 Mon Sep 17 00:00:00 2001 From: r0hansaxena Date: Tue, 10 Mar 2026 01:35:26 +0530 Subject: [PATCH 2/2] Update docs/sphinx/source/whatsnew/v0.15.1.rst Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com> --- docs/sphinx/source/whatsnew/v0.15.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.15.1.rst b/docs/sphinx/source/whatsnew/v0.15.1.rst index 7606acdc78..89ca057674 100644 --- a/docs/sphinx/source/whatsnew/v0.15.1.rst +++ b/docs/sphinx/source/whatsnew/v0.15.1.rst @@ -16,7 +16,7 @@ Bug fixes ~~~~~~~~~ * Fix a bug in :py:func:`pvlib.scaling.latlon_to_xy` where latitude scaling was incorrectly applied to both latitude and longitude components. - (:issue:`2614`, :pull:` `) + (:issue:`2614`, :pull:`2712`) * Fix a division-by-zero condition in :py:func:`pvlib.transformer.simple_efficiency` when ``load_loss = 0``. (:issue:`2645`, :pull:`2646`)