Draft code in Python
We have a first very preliminary draft of the code for the "station outlier filter" here at the bottom of the notebook.
Some notes from discussion with Lottte:
- Basic reasoning of the filter: The filter looks at min. two weeks of data (for 5-minute data) at evaluates the correlation with neighboring stations
- Two weeks are chosen because short enough to also apply on a "event basis", because first two weeks cannot be evaluated
- R tricks to speed up things:
- original R code is here
- use
apply in combination with which in R, e.g. like in line 83 in the linked code
SOflag[which(apply(cortable, 1, function(x) median(x, na.rm=T)) < corthres)] <- 1
- doing with a fixed window length is also reasonable, but maybe limits applicability when studying short events
Draft code in Python
We have a first very preliminary draft of the code for the "station outlier filter" here at the bottom of the notebook.
Some notes from discussion with Lottte:
applyin combination withwhichin R, e.g. like in line 83 in the linked code