You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pvlib.soiling.hsu does not require rain_accum_period to be a Timedelta #1711
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.
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?
Activity
kwwaleszczynski-del commentedon Oct 28, 2026
I'd like to pick this up. My proposal is to raise a
TypeErrorinhsuwhenrain_accum_periodis a number, becauseSeries.rollingthen treats it as a count of rows and the accumulation period changes with the data interval.Timedelta,datetime.timedeltaand 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
kimberdoes with itsrain_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?