Skip to content

Commit 7e12aec

Browse files
committed
BUG: fix kimber cleaning threshold and grace period off-by-one
- rainfall equal to cleaning_threshold now triggers cleaning - grace_period window now correctly includes the rain day itself - regenerated greensboro nowash/manwash expected test data - added tests for both cases Fixes #2796
1 parent d2e6811 commit 7e12aec

5 files changed

Lines changed: 843 additions & 812 deletions

File tree

docs/sphinx/source/whatsnew/v0.15.3.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Deprecations
1414

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

1821

1922
Enhancements

pvlib/soiling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ def kimber(rainfall, cleaning_threshold=6, soiling_loss_rate=0.0015,
205205
soiling = pd.Series(soiling, index=rainfall.index, name='soiling')
206206

207207
# rainfall events that clean the panels
208-
rain_events = accumulated_rainfall > cleaning_threshold
208+
rain_events = accumulated_rainfall >= cleaning_threshold
209209

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

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

0 commit comments

Comments
 (0)