Hello, 

I explain you what I want to do. My real data of the previous day (period 
of midnight to midnight) come once the day at around 9:30am (it can be 
variable). I have forecast data  which are updated each hours. I want that 
every day around 9:45am the error of the forecast is computed for the 
previous day.

Currently, I am doing first the difference between the real and the 
forecast for each timestamp. Then I have to do the sum of this difference 
on the previous day and also the sum of the real data on the previous day 
in order to divide these both results each other.  Is there a simple way to 
do that: do a queries just on the previous day with Kapacitor? If a 
computation one at 9:45am is easier to realize, I will keep this solution. 
But I would like that the time when the computation is done stays variable. 

Thank you 

wug



 

Le mercredi 7 septembre 2016 21:35:29 UTC+2, [email protected] a écrit :
>
> When you say previous day do you mean, previous 24 hours, or the previous 
> period of midnight to midnight? If its the previous 24 hours then using 
> `.offset(1d)` will work.
>
> If you want the previous midnight-midnight period then you can use an 
> intermediate measurement. The steps would be:
>
> 1. At the end of each day compute the sum(diff_eEC_h) for the day and save 
> it to a new measurement (Kapacitor or CQs can be used to do this)
> 2. In your Kapacitor script select the last(sum) value from the 
> measurement in step #1, this will always be the previous days total.
>
> Does that make sense?
>
> On Wednesday, September 7, 2016 at 8:50:24 AM UTC-6, wug wrote:
>>
>> Hello,
>>
>> Thank you for the answer!  It works now. The next step is that I would 
>> like to query the data from the previous day. I wanted to use 
>> node.offset(value time.Duration). But I am doing my query each hour, and I 
>> want always all the data from the previous day. Therefore, I would like a 
>> offset variable like:
>>
>> offset = current_hour
>> then:
>>
>> var error_eEC_h = batch
>>
>>      |query('''
>>
>>      SELECT sum(diff_eEC_h) as value1 FROM FMV_calcul."default"."error"
>>
>>      ''')
>>
>>      .period(1d)
>>
>>      .cron('0 0 * * * * *')
>>
>>      .groupBy(time(1d))
>>      .offset(current_hour)
>>
>> Is there a way to do that?
>>
>> Thank you
>>
>> wug
>>
>> kapacitor 0.13
>>
>>    
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>       .groupBy(time(1d))
>>
>>
>>
>> Le vendredi 2 septembre 2016 19:02:28 UTC+2, [email protected] a 
>> écrit :
>>>
>>> The script looks correct. The cron uses local time for the timezone of 
>>> the Kapacitor process. To change the timezone for the process use the TZ 
>>> env var on Unix like systems.
>>>
>>> On Friday, September 2, 2016 at 8:18:28 AM UTC-6, wug wrote:
>>>>
>>>>   I am trying to define a batch task with Kapacitor which is execute 
>>>> each day at a certain time. First I am just trying to do a select using 
>>>> cron but this is not working (I have enabled the task).  Here the code: 
>>>>
>>>>
>>>>     batch
>>>>
>>>>         |query('''
>>>>
>>>>         SELECT distinct(value) as value FROM  
>>>> FMV_energy."default"."puissance.electricite"
>>>>
>>>>         WHERE "source" = 'FMV' AND "station" = 
>>>> 'siesa.consommation.PCV' AND "typeof" = 'forecast'
>>>>
>>>>         ''')
>>>>
>>>>         .period(2d)
>>>>
>>>>         .cron('0 5 16 * * * *')
>>>>
>>>>         .groupBy(time(15m))
>>>>
>>>>         .fill(0)
>>>>
>>>>
>>>> What am I doing wrong?
>>>>
>>>>
>>>> How have  I to manage the timezone in Kapacitor? It should be the 
>>>> problem?
>>>>
>>>>
>>>> Thank you
>>>>
>>>>
>>>> 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/33dae556-0832-4850-835d-12e27859eb0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to