If in previous articles I have shown you how to retrieve data from your Netatmo personal weather and how to save them in an InfluxDb database, today I will show you a code written in Python to visualize the weather data and to compute some statistics.
I started from the fact that there is not enough data collected to establish a baseline, given that my records start in July 2016, so I only have 8 years of measurements. Thus, I chose a simpler but still relevant way to be able to compare this year's average daily temperatures with previous years.
Taking as a reference period all records from previous years, I created a band graph, showing for each day the difference between the maximum and minimum of the mean temperature during the reference period. I also put on this graph the multi-year average temperature for each day. Then I added on the graph the daily averages from the beginning of the year until now and the result is the graph presented at the beginning of the article.
Below is the code I used:
For now, although it does its job well, I still have to fix a small problem in the code: somewhere in the flux querry, InfluxDB doesn't handle correctly the transition from summer time to winter time and a small error may occur. This error is up to 0.1 degrees (as compared to manually computed averages), but it's there and you'll have to take it into account if you want higher accuracy.
Obviously if I find a fix I will update the code. On the other hand I'm not in a hurry, I know that InfluxDb version 3.0 has been released. That version abandons flux querries and switches to SQL queries, so everything will change. I don't know if it's worth to work to fix this bug or to wait for version 3.0 self-hosted and rewrite all the querries from scratch.
So if you really need maximum precision please leave a comment, let me know that there is interest in this topic, and I will try to to find a solution.
0 Comments