Calculate the rate of change
Use the to calculate the rate of change per unit of time between subsequent non-null values.
By default, derivative()
returns only positive derivative values and replaces negative values with null. Cacluated values are returned as floats.
Given the following input:
returns:
_time | _value |
---|---|
2020-01-01T00:04:00Z | |
2020-01-01T00:12:00Z | |
2020-01-01T00:19:00Z | 10.0 |
2020-01-01T00:32:00Z | |
2020-01-01T00:51:00Z | 4.74 |
2020-01-01T01:00:00Z | 5.56 |
To return negative derivative values, set the nonNegative
parameter to false
,
Given the following input:
The following returns:
_time | _value |
---|---|
2020-01-01T00:04:00Z | -22.5 |
2020-01-01T00:12:00Z | -1.25 |
2020-01-01T00:19:00Z | 10.0 |
2020-01-01T00:32:00Z | -1.54 |
2020-01-01T00:51:00Z | 4.74 |
2020-01-01T01:00:00Z | 5.56 |
Results represent the rate of change per minute between subsequent values and include negative values.
Average rate of change per window of time
returns the average rate of change (as a float) per unit
for time intervals defined by every
. Negative values are replaced with null.
aggregate.rate()
does not support .
Given the following input:
The following returns:
_time | _value |
---|---|
2020-01-01T00:20:00Z | |
2020-01-01T00:40:00Z | 10.0 |
2020-01-01T01:00:00Z | 4.74 |
2020-01-01T01:20:00Z | 5.56 |