Skip to content

kimber grace and rain threshold implementation differences #2796

Open

Description

@mikofski

Describe the bug

  1. the threshold in pvlib is strict...

    rain_events = accumulated_rainfall > cleaning_threshold

    ...whereas the paper Kimber, 2006 implies that rainfall inclusive of the threshold is sufficient to clean:
    Image

  2. the grace period has an off-by-one error, including the rain day and therefore effectively reducing grace days to gracedays-1

To Reproduce

  1. set rainfall to exactly the value of rainfall in the accumulation period and it will not clean
  2. set grace days to 1, and effectively here are no grace days!

Expected behavior

  1. rainfall equal to should clean
  2. grace day of 1 should be clean for 1 day after rainfall event

Versions:

  • pvlib.__version__: 0.15.2

Additional context
Thank you @wholmgren for pointing out these inconsistencies!

May also be related to

Activity

  1. dgowdaan-cmyk commented on Jul 2, 2026

    @dgowdaan-cmyk
    Contributor

    Thanks for reporting this — I agree the current > check is too strict compared with Kimber 2006. I’ll update the Kimber implementation so rainfall equal to cleaning_threshold also counts as a cleaning event, and I’ll fix the grace-period indexing so grace_period=1 means one full day after rainfall rather than including the rain day itself. I’ll add tests for both cases and submit a PR.

  2. added this to the v0.15.3 milestone on Jul 2, 2026
  3. cwhanse commented on Jul 11, 2026

    @cwhanse
    Member

    set grace days to 1, and effectively here are no grace days!

    I think this only happens if the input rainfall data are 1-day timesteps. The test data are hourly, the proposed fix "closed='both'" is just shifting the grace period by one time step.

  4. modified the milestones: v0.15.3, v0.16.0 on Aug 5, 2026
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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions