Skip to content

Commit c3d80be

Browse files
committed
Fix latlon_to_xy longitude scaling and update related tests
1 parent 2602596 commit c3d80be

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

pvlib/scaling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def latlon_to_xy(coordinates):
196196
m_per_deg_lon = r_earth * np.cos(np.pi/180 * meanlat) * np.pi/180
197197

198198
# Conversion
199-
pos = coordinates * np.array(m_per_deg_lat, m_per_deg_lon)
199+
pos = coordinates * np.array([m_per_deg_lat, m_per_deg_lon])
200200

201201
# reshape as (x,y) pairs to return
202202
try:

tests/test_scaling.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def time_500ms(clear_sky_index):
5151

5252
@pytest.fixture
5353
def positions():
54-
# Sample positions based on the previous lat/lon (calculated manually)
55-
expect_xpos = np.array([554863.4, 555975.4, 557087.3])
54+
# Sample positions based on correct geodetic scaling
55+
expect_xpos = np.array([546433.8, 547528.9, 548623.9])
5656
expect_ypos = np.array([1110838.8, 1111950.8, 1113062.7])
5757
return np.array([pt for pt in zip(expect_xpos, expect_ypos)])
5858

@@ -94,9 +94,14 @@ def expect_cs_smooth():
9494

9595
@pytest.fixture
9696
def expect_vr():
97-
# Expected VR for expecttmscale
98-
return np.array([3., 3., 3., 3., 3., 3., 2.9997844, 2.9708118, 2.6806291,
99-
2.0726611, 1.5653324, 1.2812714, 1.1389995])
97+
# Expected VR for expect_tmscale
98+
# (updated after fixing latlon_to_xy scaling)
99+
return np.array([
100+
3., 3., 3., 3., 3., 3.,
101+
2.9997677, 2.9697125, 2.6750587,
102+
2.0659253, 1.5611084, 1.2791058,
103+
1.1379316
104+
])
100105

101106

102107
def test_latlon_to_xy_zero():

0 commit comments

Comments
 (0)