Files
Support-Agent/labeling/auto/etiqueteur/NIEDERHORN_2026-10-01/outils/table.py
T
maximeandClaude Opus 5.5 6fbd7510b7 Etiqueteur: October labels for 8 stations; its folder moves to labeling/auto/etiqueteur/, analyses and scripts versioned (D-126)
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>
2026-11-03 16:33:41 +01:00

39 lines
1.4 KiB
Python

"""Table des mesures NIEDERHORN (exports NIEDERHORN_advanced_* seulement).
usage: table.py COL CAPTEURS(a,b|all) DEBUT FIN -> une ligne par instant, une colonne par capteur
Valeur suivie de * si la mesure est rejetée (error_value > error_threshold)."""
import csv, glob, sys
D = 'data/NIEDERHORN/displacement/NIEDERHORN_advanced_2026*.csv'
def charge(debut, fin):
rows = []
for f in sorted(glob.glob(D)):
with open(f) as fh:
for r in csv.DictReader(fh):
t = r['time_utc'][:13].replace(' ', 'T') + ':00Z'
if debut <= t <= fin:
r['t'] = t
r['sensor_name'] = r['sensor_name'].strip()
rows.append(r)
return rows
if __name__ == '__main__':
col, caps, debut, fin = sys.argv[1:5]
rows = charge(debut, fin)
allc = []
for r in rows:
if r['sensor_name'] not in allc:
allc.append(r['sensor_name'])
caps = allc if caps == 'all' else caps.split(',')
tab = {}
for r in rows:
v = r[col]
rej = float(r['error_value']) > float(r['error_threshold'])
s = '' if v == '' else f"{float(v):.3f}" + ('*' if rej else '')
tab.setdefault(r['t'], {})[r['sensor_name']] = s
print('instant', *[c.replace('PWD_', '').replace('_C09', '') for c in caps], sep='\t')
for t in sorted(tab):
print(t[5:16], *[tab[t].get(c, '-') for c in caps], sep='\t')