06.04.2017, 22:00
(This post was last modified: 06.04.2017, 22:48 by Erwin van der Zwart.)
Hi Buuudzik,
Unfortunately that option is not available, but you can easily create simulair result including timestamp by using this:
If you resolution is 5 minutes you can convert it to hourly data like this:
If you resolution is 10 minutes change 288 to 144 and all 12 to 6 , for 15 minutes resolution change 288 to 96 and all 12 to 4, for 20 minutes resolution change 288 to 72 and all 12 to 3, for 30 minutes resolution change 288 to 48 and all 12 to 2.
BR,
Erwin
Unfortunately that option is not available, but you can easily create simulair result including timestamp by using this:
Code:
require('trends')
name = 'Słońce_Azymut'
dates = {}
dates['start'] = { year = 2017, month = 4, day = 6}
dates['end'] = { year = 2017, month = 4, day = 7}
-- default trend resolution is used when not set
resolution = 3600 -- hourly data
res, a, b = trends.fetch(name, dates, resolution)
-- Create new table with timestamp and only values between 7 and 13
newtable = {}
for i, row in ipairs(res) do
if (i-1) >= 7 and (i-1) <= 13 then
table.insert(newtable, {time = (i-1) .. ':00', value = row})
end
end
log(newtable)
If you resolution is 5 minutes you can convert it to hourly data like this:
Code:
require('trends')
name = 'Słońce_Azymut'
dates = {}
dates['start'] = { year = 2017, month = 4, day = 6}
dates['end'] = { year = 2017, month = 4, day = 7}
-- default trend resolution is used when not set
resolution = 3600 -- hourly data
res, a, b = trends.fetch(name, dates, resolution)
newtable = {}
if #res == 288 then
counter = 0
total = 0
for i, row in ipairs(res) do
total = total + row
counter = counter + 1
if counter == 12 then
if ((i/12)-1) >= 7 and ((i/12)-1) <= 13 then
table.insert(newtable, {time = ((i/12)-1) .. ':00', value = (total/12)})
end
counter = 0
end
end
end
log(newtable)
If you resolution is 10 minutes change 288 to 144 and all 12 to 6 , for 15 minutes resolution change 288 to 96 and all 12 to 4, for 20 minutes resolution change 288 to 72 and all 12 to 3, for 30 minutes resolution change 288 to 48 and all 12 to 2.
BR,
Erwin