Skip to content

Fix numpy array syntax in scaling.py and update tests#2712

Open
r0hansaxena wants to merge 1 commit intopvlib:mainfrom
r0hansaxena:fix-scaling-numpy-arg
Open

Fix numpy array syntax in scaling.py and update tests#2712
r0hansaxena wants to merge 1 commit intopvlib:mainfrom
r0hansaxena:fix-scaling-numpy-arg

Conversation

@r0hansaxena
Copy link
Contributor

@r0hansaxena r0hansaxena commented Mar 6, 2026

  • Closes scaling.py Numpy function arg bug #2614
  • I am familiar with the contributing guidelines
  • I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num `. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

Description

This PR addresses Issue #2614, where latlon_to_xy in pvlib/scaling.py was incorrectly handling discrete scaling factors due to a numpy syntax error. Instead of passing a list to np.array(), the code passed separate arguments, leading to incorrect coordinate scaling.

Proposed Changes

  1. Fixed pvlib/scaling.py: Corrected the np.array call to properly scale latitude and longitude by their respective factors.
  2. Updated tests/test_scaling.py: Recalculated and updated the expected values in the positions(), expect_cs_smooth(), and expect_vr() fixtures. The previous expectations were based on the buggy code's output.
  3. Whatsnew entry: Added a summary of the fix to the v0.15.1.rst changelog.

Verification Results

All tests in tests/test_scaling.py now pass locally with the corrected calculations.

@r0hansaxena r0hansaxena force-pushed the fix-scaling-numpy-arg branch from 8ea1c8b to e99207d Compare March 6, 2026 15:14
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

1 participant