Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/sphinx/source/whatsnew/v0.15.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Deprecations

Bug fixes
~~~~~~~~~
* Fixed :py:func:`pvlib.soiling.kimber` so that rainfall equal to
``cleaning_threshold`` triggers cleaning, and fixed an off-by-one
error in the grace period window. (:issue:`2796`)


Enhancements
Expand Down Expand Up @@ -50,3 +53,4 @@ Contributors
* Eesh Saxena (:ghuser:`eeshsaxena`)
* Karl Hill (:ghuser:`karlhillx`)
* Yonry Zhu (:ghuser:`yonryzhu`)
* Darshan Gowda (:ghuser:`dgowdaan-cmyk`)
4 changes: 2 additions & 2 deletions pvlib/soiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ def kimber(rainfall, cleaning_threshold=6, soiling_loss_rate=0.0015,
soiling = pd.Series(soiling, index=rainfall.index, name='soiling')

# rainfall events that clean the panels
rain_events = accumulated_rainfall > cleaning_threshold
rain_events = accumulated_rainfall >= cleaning_threshold

# grace periods windows during which ground is assumed damp, so no soiling
grace_windows = rain_events.rolling(grace_period, closed='right').sum() > 0
grace_windows = rain_events.rolling(grace_period, closed='both').sum() > 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not fix the off-by-one issue with grace periods. Grace periods are in days; closed='both' just adds the next timestamp to the grace period. In the case of the tests, it's adding one hour. rolling applies closed to the input data, not the output.

@dgowdaan-cmyk dgowdaan-cmyk Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yeah I see what you mean now @cwhanse
closed='both' doesn't solve it for daily grace periods.
We would need to shift the result forward by N-1 days instead.

I will take a look and push a fix for this. Thanks for catching it.


# clean panels by subtracting soiling for indices in grace period windows
cleaning = pd.Series(float('NaN'), index=rainfall.index)
Expand Down
Loading
Loading