Skip to content

Commit bdb7308

Browse files
committed
clarify error message
1 parent 24ee5ff commit bdb7308

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pvlib/clearsky.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,13 @@ def detect_clearsky(measured, clearsky, times=None, infer_limits=False,
817817
tools._get_sample_intervals(times, window_length)
818818

819819
if samples_per_window < 3:
820-
raise ValueError(f"Window of length {window_length} found"
821-
" Each window must contain at least"
822-
" three data points; {samples_per_window} results"
823-
" from time interval of {sample_interval}")
820+
raise ValueError(f"Samples per window of {samples_per_window}"
821+
f" found. Each window must contain at least 3 data"
822+
f" points."
823+
" Samples per window is calculated from window_length"
824+
" ({window_length} found) and the data interval"
825+
f" ({sample_interval} found)."
826+
" Increase window_length.")
824827

825828
# if infer_limits, find threshold values using the sample interval
826829
if infer_limits:

pvlib/tests/test_clearsky.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ def test_detect_clearsky_not_enough_data(detect_clearsky_data):
680680

681681
def test_detect_clearsky_window_too_short(detect_clearsky_data):
682682
expected, cs = detect_clearsky_data
683-
with pytest.raises(ValueError, match="Window of length"):
683+
with pytest.raises(ValueError, match="Samples per window of "):
684684
clearsky.detect_clearsky(expected['GHI'], cs['ghi'], window_length=2)
685685

686686

0 commit comments

Comments
 (0)