Skip to content

Fix integer truncation in temperature.fuentes by forcing float dtype …#2711

Closed
Chirag3841 wants to merge 1 commit intopvlib:mainfrom
Chirag3841:fix-fuentes-int-float
Closed

Fix integer truncation in temperature.fuentes by forcing float dtype …#2711
Chirag3841 wants to merge 1 commit intopvlib:mainfrom
Chirag3841:fix-fuentes-int-float

Conversation

@Chirag3841
Copy link
Contributor

@Chirag3841 Chirag3841 commented Mar 5, 2026

  • [ x] Closes Integer/float bug in pvlib.temperature.fuentes #2608
  • [ x] I am familiar with the contributing guidelines
  • [x ] I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license
  • [x ] 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.
  • [x ] 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.

Summary

Fix integer truncation in pvlib.temperature.fuentes.

The function created the internal array using np.zeros_like(poa_global),
which inherits the dtype of the input. When integer inputs were provided,
intermediate floating-point temperatures were truncated when written into
the array.

This patch forces the internal array to use a floating-point dtype:
tmod_array = np.zeros_like(poa_global, dtype=float)

Updated expected values in test_fuentes_timezone to reflect the corrected
behavior and added a regression test test_fuentes_int_vs_float to ensure
integer and float inputs produce identical results.

@AdamRJensen AdamRJensen closed this Mar 5, 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.

Integer/float bug in pvlib.temperature.fuentes

2 participants