City page: range strip spans 10th–90th percentile instead of average (#111)

The monthly temperature-range visualization now spans the 10th-percentile daily low
to the 90th-percentile daily high (from climatology's p10/p90) — the band most days
fall within — instead of just the average low to average high, giving a truer sense
of each month's spread. The normals table keeps the average high/low figures.
This commit is contained in:
Emi Griffith 2026-07-15 21:50:14 -07:00 committed by GitHub
parent 807f26262f
commit b3e7f75e50
2 changed files with 12 additions and 5 deletions

View file

@ -206,6 +206,10 @@ def _monthly_normals(history) -> list[dict]:
tmax, tmin, precip = clim.get("tmax"), clim.get("tmin"), clim.get("precip")
high_f = tmax["mean"] if tmax else None
low_f = tmin["mean"] if tmin else None
# The range strip spans the typical spread: 10th-percentile daily low to
# 90th-percentile daily high (the band most days fall within).
rng_lo = tmin["p10"] if tmin else None
rng_hi = tmax["p90"] if tmax else None
rows.append({
"name": name,
"slug": MONTHS[i - 1],
@ -213,9 +217,11 @@ def _monthly_normals(history) -> list[dict]:
"high_f": high_f,
"low": _temp(tmin["mean"]) if tmin else "",
"low_f": low_f,
"range_lo_f": rng_lo,
"range_hi_f": rng_hi,
"precip": f"{precip['mean']:.2f} in" if precip else "",
"precip_v": precip["mean"] if precip else None,
"bar": _range_bar(low_f, high_f),
"bar": _range_bar(rng_lo, rng_hi),
})
return rows

View file

@ -75,14 +75,15 @@
<span class="range-track">
{% if m.bar %}<span class="range-fill" style="left:{{ m.bar.left }}%;width:{{ m.bar.width }}%;--c1:var(--{{ m.bar.c1 }});--c2:var(--{{ m.bar.c2 }})"></span>{% endif %}
</span>
{% if m.low_f is not none and m.high_f is not none %}
<span class="range-vals">{{ m.low_f | round | int }}°–{{ m.high_f | round | int }}°</span>
{% if m.range_lo_f is not none and m.range_hi_f is not none %}
<span class="range-vals">{{ m.range_lo_f | round | int }}°–{{ m.range_hi_f | round | int }}°</span>
{% else %}<span class="range-vals">—</span>{% endif %}
</div>
{% endfor %}
</div>
<p class="range-note muted">Each bar spans the average daily low to high, coloured cold&nbsp;→&nbsp;hot
on a shared 10&nbsp;°F to 115&nbsp;°F scale — so the whole year's rhythm reads at a glance.</p>
<p class="range-note muted">Each bar spans the 10th-percentile daily low to the 90th-percentile daily
high — the range most days fall within — coloured cold&nbsp;→&nbsp;hot on a shared
10&nbsp;°F to 115&nbsp;°F scale, so the whole year's rhythm reads at a glance.</p>
</section>
<section class="city-travel">