alternative to block_size
yngwaz opened this issue · 2 comments
First: Thanks for this package, I like it a lot (and it is much faster than my own implementation)!
My problem is ''block_size'':
If I am interested in annual maxima, it easily happens that the selected blocks traverse "hard boundaries" such as 31.12/01.01 (or 31.08/01.09 if I am interested in school years for instance). It could thus happen (rarely of course) that my annual maxima is attributed to the wrong year). This is of course related to the problem of leap years.
A worst-case scenario would probably be:
A maximum any time in e.g. 2020-12 and another "almost-maximum" at 2021-01-01 03:00. Then for the rest in 2021 no real high value (anywhere near the last two mentioned ones). It then could be that 2021-01-01 03:00 would be counted to the annual block of 2020 (and thus not appear in the extremes). However, I would really prefer to have the value of 2021-01-01 03:00 counted to 2021 and therefore provide another extreme value for 2021.
The date_time_intervals are constructed from my first element in the time series (ts) and the block_size. If I am aware of this (which I am), I can fill up my ts with 0's to my desired start of the year (not with nan's because they will be removed by pyextremes before building the date_time_intervals, and hence I would get even stranger year-periods).
My desired solution:
For my purpose, it would be nice to pass date_time_intervals to pyextremes (get_extremes_block_maxima) directly. This would allow me to have hard boundaries at years.
I could imagine this "problem" is even more severe if one looks at monthly blocks: an average block_size would constantly traverse hard month-boundaries.
Anyway, thanks again, and I would be interested to know if my block_size problem is worth to be considered.
I may be late, but, if you have a custom way you extract extreme values from your data, you can use the EVA.set_extremes
method:
pyextremes/src/pyextremes/eva.py
Lines 497 to 546 in 8ec142b
This way you can extract extreme values yourself and then use them with pyextremes.
Many thanks for that hint!
Yes, that would work perfectly fine for me. Sorry, I didn't see this option!