georgebv / pyextremes

Extreme Value Analysis (EVA) in Python
https://georgebv.github.io/pyextremes/
MIT License
237 stars 47 forks source link

When getting extremes with threshold, pyextremes should warn that the threshold is too high/low #27

Closed wiz21b closed 1 year ago

wiz21b commented 2 years ago

When doing

model.get_extremes(method="POT", threshold=20,..., extremes_type="high"

if the threshold is set too high so that no extreme can be found, pyextremes gives an stacktrace which is bit hard to understand (ValueError: attempt to get argmax of an empty sequence). It'd be nice to have a proper error message saying that no extreme could be found.

georgebv commented 2 years ago

Thank you, good point, should be easy to add. Feel free to create a PR if you'd like to contribute; otherwise, I'll be adding this in next release.