Files

17 lines
908 B
Python
Raw Permalink Normal View History

"""Profil par heure du jour (médiane sur les jours du lot) de pan, tilt, scale et de la température."""
import csv, glob, statistics as st
from collections import defaultdict
from datetime import datetime
D='data/FLORIDA'; P=lambda s: datetime.fromisoformat(s[:16].replace(' ','T'))
h=defaultdict(lambda: defaultdict(list))
for f in sorted(glob.glob(f'{D}/camera/*.csv')):
for r in csv.DictReader(open(f)):
t=P(r['time_utc'])
if t.month==10:
for k in ('pan','tilt','scale'): h[t.hour][k].append(float(r['median_'+k]))
for f in sorted(glob.glob(f'{D}/metrics/FLORIDA_sensor_thermal_deg_c_*.csv')):
for r in csv.DictReader(open(f)):
t=P(r['time_utc'])
if t.month==10 and r['metric'] not in ('','nan'): h[t.hour]['T'].append(float(r['metric']))
for H in range(24):
print(H, ' '.join(f"{k}={st.median(h[H][k]):.5f}" for k in ('T','pan','tilt','scale')))