Part of #697.
Where
pyleoclim/utils/spectral.py, the evenly-spaced checks inside welch() (line ~199), mtm() (line ~312), and periodogram() (line ~701):
raise ValueError('For the Welch method, data should be evenly spaced')
Problem
Compare with Series.wavelet() (cwt), which raises with actionable guidance:
raise ValueError("The chosen method is cwt but the series is unevenly spaced. You can either interpolate/bin or set method='wwz'.")
The spectral.py errors are terse, raised deep inside the utils layer rather than at the Series.spectral() call site, and don't tell the user what to do next (interpolate? bin? pick a different method?).
Proposed fix
Move the evenly-spaced check up to Series.spectral() itself (consistent with how wavelet() does it) and raise with the same style of actionable message, naming the available fixes (.interp(), .bin(), or switching to method='wwz'/'lomb_scargle', whichever are actually unevenly-spaced-safe for that call).
Part of #697.
Where
pyleoclim/utils/spectral.py, the evenly-spaced checks insidewelch()(line ~199),mtm()(line ~312), andperiodogram()(line ~701):Problem
Compare with
Series.wavelet()(cwt), which raises with actionable guidance:The
spectral.pyerrors are terse, raised deep inside the utils layer rather than at theSeries.spectral()call site, and don't tell the user what to do next (interpolate? bin? pick a different method?).Proposed fix
Move the evenly-spaced check up to
Series.spectral()itself (consistent with howwavelet()does it) and raise with the same style of actionable message, naming the available fixes (.interp(),.bin(), or switching tomethod='wwz'/'lomb_scargle', whichever are actually unevenly-spaced-safe for that call).