#!/usr/bin/env python3
"""Reproduce the matched-period London–Seattle sunshine comparison.

Input values are WMO/NOAA 1961–1990 monthly sunshine-duration normals.
The one-sun equivalent multiplies hours by 1 kW/m² and is a normalization
proxy, not measured global horizontal irradiation (GHI).
"""
import csv
from collections import defaultdict

INPUT = "sunshine_normals_1961_1990.csv"
totals = defaultdict(float)
with open(INPUT, newline="", encoding="utf-8") as f:
    for row in csv.DictReader(f):
        totals[row["city"]] += float(row["sunshine_hours"])

london = totals["London"]
seattle = totals["Seattle"]
difference = seattle - london
print(f"London annual sunshine:  {london:.1f} h")
print(f"Seattle annual sunshine: {seattle:.1f} h")
print(f"Seattle minus London:     {difference:.1f} h")
print(f"Seattle advantage:        {100*difference/london:.1f}%")
print(f"Ratio:                    {seattle/london:.3f}")
print("1-sun equivalent energy (proxy): hours × 1 kW/m² = same numeric kWh/m²")
