"""Par station et par nuit (16:00 → 08:00 UTC, datée du soir) sur ses lots : BusVoltage minimal, BatteryPercent minimal, heures de nuit sans BusVoltage. Pour voir quelles stations manquent d'énergie la nuit (lancé depuis la racine).""" import os from datetime import timedelta exec(open(os.path.join(os.path.dirname(__file__), 'trous.py')).read().split('tous = {}')[0]) for st, lots in LOTS.items(): lig = [] for a, b in lots: a, b = d(a), d(b) bv, bat = metrique(st, 'BusVoltage', a, b), metrique(st, 'BatteryPercent', a, b) for j in jours(a, b): hs = [j + timedelta(hours=16 + k) for k in range(16)] v = [float(bv[t]) for t in hs if t in bv]; p = [float(bat[t]) for t in hs if t in bat] lig.append(f'{j:%m-%d} {min(v) if v else 0:5.2f} {min(p) if p else -1:3.0f}% {16 - len(v):2d}') print(f'\n== {st} (nuit : BV min, batterie min, heures sans BV)') for i in range(0, len(lig), 6): print(' ' + ' | '.join(lig[i:i + 6]))