Created
May 29, 2017 12:45
-
-
Save AntoineVe/ca16d8286a7b5ceabfbbd7ebd9229b81 to your computer and use it in GitHub Desktop.
Graph data acquired and logged from a RF weather station (Oregon, Otio, ...) via rtl_433
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
from sys import argv | |
from pylab import * | |
import numpy as np | |
data_file = argv[1] | |
def col2array(dico, col): | |
temp_liste = list() | |
for line in dico: | |
temp_liste.append(int(dico[line][col], 16)) | |
return(np.array(temp_liste)) | |
with open(data_file, 'r') as data: | |
data = data.read().splitlines() | |
data_dict = {} | |
count = 0 | |
for line in data: | |
if "[00] {79}" in line: | |
data_dict.update({count: tuple(line.replace('[00] {79} ','').split())}) | |
count += 1 | |
x = np.array(list(data_dict.keys())) | |
y0 = col2array(data_dict, 0) | |
y1 = col2array(data_dict, 1) | |
y2 = col2array(data_dict, 2) | |
y3 = col2array(data_dict, 3) | |
y4 = col2array(data_dict, 4) | |
y5 = col2array(data_dict, 5) | |
y6 = col2array(data_dict, 6) | |
y7 = col2array(data_dict, 7) | |
y8 = col2array(data_dict, 8) | |
y9 = col2array(data_dict, 9) | |
figure(figsize=(21,10), dpi=100) | |
plot(x, y0, label="col 0") | |
plot(x, y1, label="col 1") | |
plot(x, y2, label="col 2") | |
plot(x, y3, label="col 3") | |
plot(x, y4, label="col 4") | |
plot(x, y5, label="col 5") | |
plot(x, y6, label="col 6") | |
plot(x, y7, label="col 7") | |
plot(x, y8, label="col 8") | |
plot(x, y9, label="col 9") | |
legend(loc='best') | |
#savefig("/tmp/meteo-graph.svg", dpi=100) | |
show() | |
close('all') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment