What's the best way to find outliers in the time-series, encountering that it is a real-world mechanical process (process continuity)? What's the best way to find outliers in the time-series, encountering continuity?
I attached two time-series that I'm interested to filter. One is less noisy, and one is a bit noisier. I'm mostly interested in the first one.
BTW the data looks like it is periodic, however, it is not and it is quite short (200-500 samples).
Also, I don't know much about the process
Thanks


 A: The best way is not to filter "outliers" at all
What we call "outliers" in statistical analysis are points that are distant from the majority of the other points in a distribution.  Diagnosis of an "outlier" is done by making a comparison to an assumed distributional form, and statistical tests for outliers compare the position of the outlier to what is expected as a maximum deviation under the assumed distribution.  Outliers are sometimes caused by measurement error (i.e., recording a data point incorrectly) but usually they are valid observations that just happen to be in the "tails" of the relevant distribution.  Often the diagnosis of outliers occurs when the data follows a distribution with high kurtosis (i.e., fat tails), but we compare the data points to an assumed distributional form with low kurtosis (e.g., the normal distribution).
Thus, if we are doing statistical analysis properly, when we identify "outliers" in the data, this means that we have identified that the underlying assumed distributional form does not have sufficiently fat tails to properly describe the observed data.  Unless we have reason to believe that measurement error has occurred (in which case we might legitimately filter out invalid data), this is a deficiency of the model, not the data.  Unfortunately, some analysts prefer to discard aspects of reality that do not conform to their models, rather than discarding models that do not conform properly to reality.  In doing so they engage in the fallacy of "cherry picking".
In regards to your time-series analysis, the best method of analysis here would be to first fit the periodic parts of the data and then examine the residuals to see what kind of distribution accommodates their shape well.  The variance of the residuals is clearly related to the periodic part of the data, so you will also need to accommodate for this in your model.  Once you have a set of residuals from fitting the periodic parts of the model, you will be able to take a crack at forming a sensible underlying distribution for the "error term".  This might involve using a transformation of scale to (implicitly) deal with skewness or kurtosis of the residuals.  Once you have a good model, it should describe the periodic behaviour of the time-series well, and it should also have an error distribution that fits with the residual data.  Ideally, if you conduct an "outlier" test on your model, it will pass the test (i.e., it will not identify points that are too far out in the tails for the model form to be plausible).
