Labels for CLARIDEN, FLORIDA, JUNGFRAU (gaps 06-20.10, 26.10-01.11), LENZSPITZE, NIEDERHORN, NORDEND, SNCF01, WILDSTRUBEL. Figures and tool outputs stay out of git. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
"""Températures de la station (metrics/sensor_*_deg_c) sur une plage : PNG et table toutes les 3 h.
|
|
Usage : .venv/bin/python <ce fichier> <dossier station> <jour début AAAA_MM_JJ> <jour fin> <sortie>"""
|
|
import csv, glob, sys, os
|
|
import matplotlib
|
|
matplotlib.use("Agg")
|
|
import matplotlib.pyplot as plt
|
|
from datetime import datetime
|
|
|
|
dossier, d0, d1, sortie = sys.argv[1:5]
|
|
series = {}
|
|
for nom in ("thermal", "A0", "CPU", "GPU", "PLL"):
|
|
pts = []
|
|
for f in sorted(glob.glob(f"{dossier}/metrics/*_sensor_{nom}_deg_c_*.csv")):
|
|
jour = os.path.basename(f).split("_deg_c_")[1][:10]
|
|
if d0 <= jour <= d1:
|
|
for r in csv.DictReader(open(f)):
|
|
if r["metric"]:
|
|
pts.append((datetime.fromisoformat(r["time_utc"]), float(r["metric"])))
|
|
series[nom] = sorted(pts)
|
|
|
|
fig, ax = plt.subplots(figsize=(14, 5))
|
|
for nom, pts in series.items():
|
|
ax.plot([t for t, _ in pts], [v for _, v in pts], label=nom)
|
|
ax.legend(); ax.grid(alpha=.4); ax.set_ylabel("°C (UTC)")
|
|
png = f"{sortie}/temperature_{d0}_{d1}.png"
|
|
fig.savefig(png, dpi=90, bbox_inches="tight"); print(png)
|
|
th = dict(series["thermal"]); a0 = dict(series["A0"])
|
|
for t in sorted(th):
|
|
if t.hour % 3 == 0:
|
|
print(t.strftime("%m-%d %H:%M"), f"thermal {th[t]:6.2f}", f"A0 {a0.get(t, float('nan')):6.2f}")
|