I’m writing weather forecast data to InfluxDB. For each write point there will be three timestamps:
- Time of collection
- Time which data point occurs (in future)
- Time of forecast issue
My question is: how can I create a query that uses 2) Time which data point occurs (in future), rather than 1) Time of collection ?
And as a larger question: Is there a better, or more correct way of structuring my write points (see below)?
My current query:
> SELECT "temperatureHigh" FROM "darksky_daily" WHERE $timeFilter
To illustrate, my graph in Grafana currently looks like this:
Some additional details…
This is how I’m writing points to InfluxDB. Each point is tagged as daily_n where n is typically 1-8:
{'fields': {'ReportTime': 1553929200, 'temperatureLow': 46.04, 'temperatureLowTime': 1554040800,
'temperatureHigh': 68.82, 'temperatureHighTime': 1553983200, ...}, 'time': '2019-03-23T14:59:03Z',
'tags': {'location': 'San Pablito', 'daily': 'daily_8'}, 'measurement': 'darksky_daily'}
The results in InfluxDB:
> select temperatureLow,temperatureLowTime,temperatureHigh,temperatureHighTime from "darksky_daily" order by time desc limit 20
name: darksky_daily
time temperatureLow temperatureLowTime temperatureHigh temperatureHighTime
---- -------------- ------------------ --------------- -------------------
2019-03-23T15:00:03Z 46.04 1554040800 68.82 1553983200
2019-03-23T15:00:03Z 37.94 1553436000 60.06 1553378400
2019-03-23T15:00:03Z 43.23 1553954400 64.42 1553896800
2019-03-23T15:00:03Z 44.18 1553781600 53.68 1553727600
2019-03-23T15:00:03Z 47.76 1553695200 56.48 1553641200
2019-03-23T15:00:03Z 41.36 1553868000 60.47 1553810400
2019-03-23T15:00:03Z 45.12 1553608800 57.45 1553554800
2019-03-23T15:00:03Z 48.05 1553497200 62.9 1553468400
-------------------------------------------------------------
2019-03-23T14:30:02Z 45.12 1553608800 57.45 1553554800
2019-03-23T14:30:02Z 48.05 1553497200 62.9 1553468400
2019-03-23T14:30:02Z 43.23 1553954400 64.42 1553896800
2019-03-23T14:30:02Z 46.04 1554040800 68.82 1553983200
2019-03-23T14:30:02Z 37.94 1553436000 60.04 1553378400
2019-03-23T14:30:02Z 41.36 1553868000 60.47 1553810400
2019-03-23T14:30:02Z 44.18 1553781600 53.68 1553727600
2019-03-23T14:30:02Z 47.76 1553695200 56.48 1553641200