Skip to content

Fix TypeError in dc_ohms_from_percent for single-array list input#2830

Open
SAY-5 wants to merge 1 commit into
pvlib:mainfrom
SAY-5:fix-dc-ohms-single-array-list-input
Open

Fix TypeError in dc_ohms_from_percent for single-array list input#2830
SAY-5 wants to merge 1 commit into
pvlib:mainfrom
SAY-5:fix-dc-ohms-single-array-list-input

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 18, 2026

Copy link
Copy Markdown
  • Closes dc_ohms_from_percent fails on single-Array ModelChain with list input #2829
  • 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.

ModelChain.dc_ohms_from_percent decides whether results.dc is a tuple from the input shape, but PVSystem.dc_ohms_from_percent() unwraps to a scalar for a single-Array system regardless of input shape. So a single-Array system given a length-1 list/tuple stored results.dc as a tuple while Rw came back as a float, and zip(Rw, self.results.dc) raised TypeError: 'float' object is not iterable.

Passing unwrap=False in the tuple branch keeps Rw a tuple so the two paths agree, mirroring how the rest of _run_from_effective_irrad already calls the multi-array helpers. The scalar path is unchanged.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@github-actions

Copy link
Copy Markdown

Hey @SAY-5! 🎉

Thanks for opening your first pull request! We appreciate your
contribution. Please ensure you have reviewed and understood the
contributing guidelines.

If AI is used for any portion of this PR, you must vet the content
for technical accuracy.

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.

dc_ohms_from_percent fails on single-Array ModelChain with list input

1 participant