Skip to content

Fix latlon_to_xy longitude scaling bug and update scaling tests (Fixes #2614)#2700

Closed
muien5080 wants to merge 1 commit intopvlib:mainfrom
muien5080:fix-latlon-to-xy-scaling
Closed

Fix latlon_to_xy longitude scaling bug and update scaling tests (Fixes #2614)#2700
muien5080 wants to merge 1 commit intopvlib:mainfrom
muien5080:fix-latlon-to-xy-scaling

Conversation

@muien5080
Copy link

@muien5080 muien5080 commented Feb 24, 2026

Fix incorrect longitude scaling in latlon_to_xy where the NumPy array construction previously misapplied scaling factors, causing longitude to be multiplied by the latitude conversion factor.

Fixes #2614

Changes:
Correct scaling vector construction:
np.array([m_per_deg_lat, m_per_deg_lon])
Ensure longitude scaling depends on mean latitude
Update expected coordinate values in test_scaling.py
Update expected variability reduction (VR) values affected by corrected geometry

Validation:
test_scaling.py passes
Full test suite passes locally:
1415 passed
111 skipped
2x failed
No new warnings introduced

Checklist:
Tests added or updated
Documentation update (not required)
Code passes flake8
All tests pass locally
Linked to relevant issue

@muien5080 muien5080 force-pushed the fix-latlon-to-xy-scaling branch from 1590ff7 to c3d80be Compare March 1, 2026 01:45
@cwhanse
Copy link
Member

cwhanse commented Mar 1, 2026

@muien5080 please put the PR template back in your leading comment block, so we maintainers can use that checklist. Thanks.

@muien5080
Copy link
Author

Template restored.
Thanks.

@AdamRJensen
Copy link
Member

Closing this PR as the contributor did not follow instructions.

@AdamRJensen AdamRJensen closed this Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scaling.py Numpy function arg bug

3 participants