Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 3 additions & 0 deletions docs/sphinx/source/whatsnew/v0.15.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
2 changes: 1 addition & 1 deletion pvlib/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions tests/test_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)])

Expand Down Expand Up @@ -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():
Expand Down