You have two options.
1. Window the data in RAM on the Kapacitor host
forecasteec
|join(real)
.as('forecasteec', 'real')
|eval(lambda: abs( "forecasteec.value" - "real.value"))
.as('diff')
|window()
.period(1d)
.every(1d)
|sum('diff')
But this requires that you can buffer 24 hours of data in RAM which is
probably not feasible
2. Write the intermediate data to InfluxDB and then query it back out to
sum it over 24 hours later.
forecasteec
|join(real)
.as('forecasteec', 'real')
|eval(lambda: abs( "forecasteec.value" - "real.value"))
.as('diff')
|influxDBOut()
.database('diff_data')
.measurement('diff')
.precision('s')
batch
|query(''' SELECT sum("diff") FROM "diff_data"."default"."diff" ''')
.period(1d)
.every(1d)
.align()
|...
The second option is essentially the same as the first except you are using
InfluxDB as the buffer so that you don't have to keep it all in RAM.
On Monday, August 29, 2016 at 6:39:42 AM UTC-6, wug wrote:
>
>
>
> Hello,
>
>
>
> I want to use Kapacitor in order to do more complex computation on my
> data. I create a task with the type batch. I put 2 queries in to variable
> forecasteec and real . I want to compute a type of error which is:
>
>
> error = sum( abs( real - forecasteec))/sum(real)
>
>
> The sum is for one day. The first part is easy. But I do not know how do
> the sum on 1 day. I have data each 15 min.
>
>
> What is the best way to do that? I am completly on Kapacitor. I am using
> the version 0.13
>
>
> Here the first part:
>
>
> * 21 forecasteec*
>
> * 22 |join(real)*
>
> * 23 .as('forecasteec', 'real')*
>
> * 24 |eval(lambda: abs( "forecasteec.value" - "real.value"))*
>
>
>
> wug
>
>
>
>
>
>
--
Remember to include the InfluxDB version number with all issue reports
---
You received this message because you are subscribed to the Google Groups
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/18126317-f152-414c-8613-b63d95f0b36a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.