Repository navigation
Conversation
Hey @pranaysb! 🎉Thanks for opening your first pull request! We appreciate your If AI is used for any portion of this PR, you must vet the content Finally, be sure the PR description includes the PR |
|
Would a fall-back regression be useful alongside the spring-forward test? For example: times = pd.date_range(
"2026-11-01 05:00", periods=8, freq="15min", tz="UTC"
).tz_convert("America/New_York")
assert tools._get_sample_intervals(times, 60) == (15.0, 4)I checked the timestamps independently: 01:00–01:45 occurs twice with different UTC offsets, while every elapsed interval is 15 minutes. That makes the case useful for handover exports containing a repeated local hour. The assertion above is a proposed regression, not a result from running this PR. |
…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.
33566fe to
a4fd451
Compare
|
Thanks @o1-shevchenko, I've added the fall-back regression test to |
docs/sphinx/source/whatsnewfor all changes. Includes link to the GitHub Issue with:issue:`num`or this Pull Request with:pull:`num`. Includes contributor name and/or GitHub username (link with:ghuser:`user`).Description
Fixes two issues identified in #2935 following the pandas 3.1.0 compatibility updates:
detect_clearsky&temperature.prillimanon DST transition days: Inpvlib.tools._get_sample_intervals, consecutive sample intervals were previously computed usingtimes.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 triggeringNotImplementedError: algorithm does not yet support unequal time intervals. Consecutive intervals are now calculated using directDatetimeIndexsubtraction(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.soiling.kimberon timezone-naive data: Inpvlib.soiling.kimber, callingrainfall.index.tz_convert(None)failed on timezone-naive inputs withTypeError: Cannot convert tz-naive timestamps. Timestep intervals and day fractions are now calculated directly fromrainfall.index[1] - rainfall.index[0] / pd.Timedelta(days=1), supporting both timezone-naive and timezone-aware indexes.Testing
tests/test_clearsky.py,tests/test_temperature.py,tests/test_soiling.py, andtests/test_tools.py.pytest.flake8.