detect_clearsky and prilliman fail on DST days, kimber fails on tz-naive data (since #2924)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start with _get_sample_intervals in pvlib/tools.py, which detect_clearsky and prilliman share, and with the kimber function in pvlib/soiling.py where it converts the index with tz_convert(None). Run the two reproductions in the issue to confirm the errors. Done means both run on a DST-spanning tz-aware index and a tz-naive index without errors, and the existing tests in test_clearsky.py, test_soiling.py, test_temperature.py and test_tools.py still pass.
Written by the indexing model from the issue text.
Description
On main (0f6631a, pandas 3.1.0), both of these worked before #2924 and now raise:
import pandas as pd
import pvlib
loc = pvlib.location.Location(49.28, -123.12, tz='America/Vancouver')
times = pd.date_range('2026-03-07', '2026-03-10', freq='1min',
tz=loc.tz, inclusive='left')
ghi = loc.get_clearsky(times)['ghi']
pvlib.clearsky.detect_clearsky(ghi, ghi)
# NotImplementedError: algorithm does not yet support unequal time intervals...
rain = pd.Series(0.0, index=pd.date_range('2026-01-01', periods=720, freq='h'))
pvlib.soiling.kimber(rain)
# TypeError: Cannot convert tz-naive timestamps, use tz_localize to localize
In _get_sample_intervals, tz_localize(None) turns the index into local clock time, so the 1-minute data gets a 61-minute step where the clocks change. temperature.prilliman uses the same helper, so it fails the same way.
kimber uses tz_convert(None), which raises on a tz-naive index:
What I'd suggest: subtract the timestamps directly. That gives elapsed time for both naive and tz-aware indexes.
# tools._get_sample_intervals
deltas = (times[1:] - times[:-1]) / pd.Timedelta('60s')
# soiling.kimber
timestep_interval = rainfall.index[1] - rainfall.index[0]
day_fraction = timestep_interval / pd.Timedelta(hours=24)
Plus two tests: detect_clearsky on a DST day should match the same data in UTC, and kimber with a tz-naive index should match the existing expected output.
I tried this locally:
- both new tests fail on main and pass with the change;
test_clearsky.py,test_soiling.py,test_temperature.pyandtest_tools.pypass on pandas 3.1.0 and 2.3.3;- on the commit before #2924 (d6075f6), both examples run fine.
I didn't find an existing issue for this. Happy to open a PR if this sounds right.
AI disclosure: I used Claude Code (an AI coding agent) to find and trace this, run the examples and tests on my machine, and draft this note.
@echedey-ls @kandersolar
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 1.2k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pvlib/pvlib-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pvlib/pvlib-python#2939 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 72/100
pvlib/pvlib-python#2921 · 4 comments · 3 reactions ·
Maintainers usually reply within 1 day
-
Possibility of beam irradiance from behind plane of arrayMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pvlib/pvlib-python#2903 · 5 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
use offset parameter instead of calculating bday in cdromPossibly taken @chenyi6758-source claimed this 20 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
pvlib/pvlib-python#2902 ·
Maintainers usually reply within 1 day
-
Add an example or documentation on using 'bhi' from ERA5May be free again @anshurajbisoyi98-ctrl claimed this 35 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
pvlib/pvlib-python#2880 · 2 comments ·
Maintainers usually reply within 1 day
All issues in pvlib/pvlib-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
adafruit/Fruit-Jam-OS#98 ·
-
python triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/semantic-kernel#14753 ·
Maintainers usually reply within 5 days
-
area:cli area:configuration documentation priority:low size:small
Difficulty 1/5 1-3 hours Newbie friendliness 80/100
RonaldHensbergen/composable-data-stack#1222 ·
Maintainers usually reply within 1 day
-
bug python
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
area: i18n bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days