Skip to content

Integer/float bug in pvlib.temperature.fuentes #2608

@vfilter

Description

@vfilter

Describe the bug
In the temperature.py module here, pvlib is using np.zeros_like which crucially returns the same type than the input.

In the unit tests, pvlib uses int instead of float values here. This leads to NumPy truncating the first float result produced (321.19 -> 321).

The final subtraction tmod_array - 273.15 then converts to a float, giving 321 - 273.15 = 47.85

That means, the results of the Fuentes functions will differ, depending on whether the input is an int or a float.

To Reproduce
Steps to reproduce the behavior:
Run the test_fuentes_timezone unit test with ints and then again with floats

Expected behavior
Ints and floats should produce the same results if they have the same value (i.e., 100 vs 100.0)

Screenshots
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions