1: procedure DOW-FLH (Original Time Series) |
2: set flags for consecutive zeros ▹Handel Dirty Data |
3: for each day do |
4: find the time point index (TPI) of the lowest flow |
5: end for |
6: find TPIs’ median number as starts of daily seasons, e.g., 3 am |
7: for model in all DOW models do▹Build DOW Models |
8: take all seasons related to to a group |
9: remove flagged consecutive zeros |
10: calculate median of grouped seasons as the model |
11: end for |
12: for model in all DOW models do ▹Fit/Adapt to Get Scalings and Additions |
13: for each realted season do |
14: remove flagged consecutive zeros |
15: estimate by robustly fitting to the season |
16: rounding all values of the fitted model to integers as the season’s flow levels |
17: get residuals as the difference between the fitted and the season |
18: end for |
19: end for |
20: for each flow level Standardize Residuals (FLH) do▹Standardize Residuals (FLH) |
21: take all residuals for this flow level (or with neighbours if not enough) |
22: calculate standard deviations (STD) |
23: end for |
24: consider all STDs with all flow levels as the flow level heteroscedasticity (FLH) |
25: divide each residual with timely corresponding STD to standardize |
26: for each detection algorithm do ▹Detection |
27: feed the entire standardized residual time series to the algorithm |
28: get algorithm-specific anomalies or anomaly scores |
29: end for |
30: return the list of anomalies or anomaly scores |
31: end procedure |