metobs_toolkit.station.Station.step_check#
- Station.step_check(obstype: str = 'temp', max_increase_per_second: int | float = 0.0022222222222222222, max_decrease_per_second: int | float = -0.002777777777777778, whiteset: WhiteSet = WhiteSet(empty)) None[source]#
Check for ‘spikes’ and ‘dips’ in a time series.
Test if observations do not produce spikes in the time series. The maximum allowed increase and decrease per second is set in the argument, and is tested for each record (with respect to the previous record).
If the difference between two consecutive records (i.e., the spike/dip) is larger than the threshold, the record is flagged as an outlier.
- Parameters:
obstype (str, optional) – The target observation to check. By default “temp”
max_increase_per_second (int or float, >0, optional) – The maximum allowed increase (per second). This value is extrapolated to the time resolution of records. This value must be positive! The default is 8.0/3600.0
max_decrease_per_second (int or float, <0, optional) – The maximum allowed decrease (per second). This value is extrapolated to the time resolution of records. This value must be negative! The default is -10.0/3600.0
whiteset (WhiteSet, optional) – A WhiteSet instance containing timestamps that should be excluded from outlier detection. Records matching the whiteset criteria will not be flagged as outliers. The default is an empty WhiteSet().
- Return type:
None
Notes
This method modifies the outliers in place and does not return anything. You can use the outliersdf property to view all flagged outliers.
In general, for temperatures, the decrease threshold is set less stringent than the increase threshold. This is because a temperature drop is meteorologically more common than a sudden increase which is often the result of a radiation error.