Skip to content

pvlib.soiling.hsu does not require rain_accum_period to be a Timedelta #1711

Open

Description

@williamhobbs

Describe the bug
If a user accidentally passes rain_accum_period in pvlib.soiling.hsu as an integer, the function runs without error. Is that desired? I'm concerned that someone could test with hour interval data, in which case rain_accum_period = 1 and rain_accum_period = pd.Timedelta('1h') will give the same results. But, if they later switch to using, e.g., 15-min interval data, rain_accum_period = 1 may give unintended results.

Expected behavior
Either an error for using integers, or clarification in the function's documentation that integers will work but they specify number of intervals instead of number of hours.

Tagging @andrewtrendline

Activity

  1. kwwaleszczynski-del commented on Oct 28, 2026

    @kwwaleszczynski-del

    I'd like to pick this up. My proposal is to raise a TypeError in hsu when rain_accum_period is a number, because Series.rolling then treats it as a count of rows and the accumulation period changes with the data interval. Timedelta, datetime.timedelta and strings like '2h' would keep working, and the docstring would say that numbers are not accepted.

    Two alternatives, if you prefer: a deprecation warning for one release before the error, or treating a number as hours, the way kimber does with its rain_accum_period=24. The second one is more consistent between the two models, but it would silently change results for anyone who passes a number of 15-minute steps today, so I lean towards the error. Which would you like?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions