Maximum value detection functions
Maximum value detection functions find the local maximums of a sequence within a specified window.
ts_find_peaks
The function has the following format:
select ts_find_peaks(x, y, winSize)The following describes the parameters:
Parameter | Description | Value |
x | The time column, sorted in ascending order. | A UNIX timestamp in seconds. |
y | The numeric value column that corresponds to the data at each timestamp. | - |
winSize | The minimum length of the detection window. | A long integer. The value must be greater than or equal to 1 and less than or equal to the actual length of the data. Set this parameter to one-tenth of the actual data length. |
Example:
Query and analysis:
* and h : nu2h05202.nu8 and m: NET | select ts_find_peaks(stamp, value, 30) from (select '("__time__" - ("__time__" % 10))' as stamp, avg(v) as value from log GROUP BY stamp order by stamp)Output:

The following items are displayed:
Display item | Description | |
Horizontal axis | unixtime | The timestamp of the data in seconds. For example, 1537071480. |
Vertical axis | src | The raw data before filtering. For example, 1956092.7647745228. |
peak_flag | Indicates whether the point is a local maximum:
| |