Skip to content

Fix sample interval calculation on DST transitions and kimber on tz-naive data - #2937

Open
pranaysb wants to merge 1 commit into
pvlib:mainfrom
pranaysb:fix-dst-naive-intervals
Open

pranaysb wants to merge 1 commit into
pvlib:mainfrom
pranaysb:fix-dst-naive-intervals

Conversation

@pranaysb

@pranaysb pranaysb commented Nov 8, 2026

Copy link
Copy Markdown

Description

Fixes two issues identified in #2935 following the pandas 3.1.0 compatibility updates:

  1. detect_clearsky & temperature.prilliman on DST transition days: In pvlib.tools._get_sample_intervals, consecutive sample intervals were previously computed using times.tz_localize(None).to_numpy(). Stripping timezone metadata converted timestamps to local wall-clock time, causing spring-forward daylight saving transitions to register as a 61-minute step and triggering NotImplementedError: algorithm does not yet support unequal time intervals. Consecutive intervals are now calculated using direct DatetimeIndex subtraction (times[1:] - times[:-1]) / pd.Timedelta('60s'), which correctly preserves elapsed physical duration for timezone-aware series across DST transitions while supporting timezone-naive indices.
  2. soiling.kimber on timezone-naive data: In pvlib.soiling.kimber, calling rainfall.index.tz_convert(None) failed on timezone-naive inputs with TypeError: Cannot convert tz-naive timestamps. Timestep intervals and day fractions are now calculated directly from rainfall.index[1] - rainfall.index[0] / pd.Timedelta(days=1), supporting both timezone-naive and timezone-aware indexes.

Testing

  • Added regression tests in tests/test_clearsky.py, tests/test_temperature.py, tests/test_soiling.py, and tests/test_tools.py.
  • Verified all 1463 unit tests pass with pytest.
  • Verified style conforms with flake8.

…aive data

Fixes pvlib#2935

In pvlib.tools._get_sample_intervals, consecutive timestamp deltas are now
computed using direct DatetimeIndex subtraction rather than stripping
timezones via tz_localize(None), preventing spurious 61-minute interval steps
during Daylight Saving Time (DST) transitions.

In pvlib.soiling.kimber, timestep intervals and day fractions are computed
directly from index timedelta without calling tz_convert(None), preventing
TypeError when given timezone-naive Series.

Added regression tests in test_clearsky, test_temperature, test_soiling,
and test_tools.
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Hey @pranaysb! 🎉

Thanks for opening your first pull request! We appreciate your
contribution. Please ensure you have reviewed and understood the
contributing guidelines.

If AI is used for any portion of this PR, you must vet the content
for technical accuracy.

Finally, be sure the PR description includes the PR
checklist,
and complete the items you are able to.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

detect_clearsky and prilliman fail on DST days, kimber fails on tz-naive data (since #2924)

1 participant