admin管理员组文章数量:1312991
I'm aggregating data of one day with Influx Flux. My data is written every 5 mins.
I realized that the sum of two 12h window integrals != one 24h integral which is not correct.
Here is my query:
from(bucket: "my-data")
|> range(start: 2025-01-13T00:00:00Z, stop: 2025-01-14T00:00:00Z)
|> filter(fn: (r) => r["_measurement"] == "datapoint")
|> filter(fn: (r) => r["_field"] == "test")
//|> interpolate.linear(every: 1s)
|> window(every: 12h, offset: 0s)
|>integral(unit: 1h)
I believe the problem are the gaps that are created by the window method. To illustrate that I only run the window function:
from(bucket: "my-data")
|> range(start: 2025-01-13T00:00:00Z, stop: 2025-01-14T00:00:00Z)
|> filter(fn: (r) => r["_measurement"] == "datapoint")
|> filter(fn: (r) => r["_field"] == "test")
|> window(every: 12h, offset: 0s)
In the result you see a gap between the two series.
You can find the graph here:
That is cause because my data only has a 5 min resolution.
To confirm this theory, I up sampled my data:
import "interpolate"
from(bucket: "my-data")
|> range(start: 2025-01-13T00:00:00Z, stop: 2025-01-14T00:00:00Z)
|> filter(fn: (r) => r["_measurement"] == "datapoint")
|> filter(fn: (r) => r["_field"] == "test")
|> interpolate.linear(every: 1s)
|> window(every: 12h, offset: 0s)
|>integral(unit: 1h)
That minimizes the gap. Now the sum of the two integrals match the 24h integral.
However, I don't like the solution as it seems inefficient to me. Does someone know a better way to solve this?
I think it would be ideal to have an window function that interpolates a datapoint at the window borders.
本文标签: influxdbIntegral over window in influx boundary issueStack Overflow
版权声明:本文标题:influxdb - Integral over window in influx boundary issue - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741902967a2403974.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论