Skip to content

Add wind and short-term forecast to the SMHI weather command - #91

Open
mosbth wants to merge 15 commits into
masterfrom
feature/smhi-wind-and-forecast
Open

Add wind and short-term forecast to the SMHI weather command#91
mosbth wants to merge 15 commits into
masterfrom
feature/smhi-wind-and-forecast

Conversation

@mosbth

@mosbth mosbth commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds wind speed/direction (as a compass arrow) to the current weather line, and to a short two-point forecast (+4h/+8h, converted to local Europe/Stockholm time).
  • Drops the "Inget signifikant väder observerat." sentence, which added no information.
  • Iteratively tightens the output format (removes filler words/punctuation like "just nu", "Kommande timmar", commas, "vind"/"från") so the IRC line stays compact despite carrying more data.

Test plan

  • uv run pytest — 61 passed
  • uv run pylint irc2phpbb — 10.00/10
  • Manually verified example output: Karlskrona 15.8° 1.0 m/s ↑ · 04:00 13.5° nästan klart 2.7 m/s ↖ · 08:00 14.7° klart 2.1 m/s ↖.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC

mosbth and others added 14 commits August 23, 2026 23:54
Fetches wind direction/speed (SMHI metobs parameters 3/4) alongside the
existing temperature and present-weather observation, and appends a
short forecast for the coming hours using SMHI's new snow1g point
forecast API (the old pmp3g forecast API was shut down 2026-03-31).

Also drops the "Inget signifikant väder observerat" sentence from the
output since it never added information - the observation sentence is
now only shown when there's an actual, meaningful observation.
Each forecast step now shows a local (Europe/Stockholm) clock time and
wind direction/speed, instead of just temperature and weather symbol.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Drop "vind"/"från" from each step ("2.6 m/s N" instead of "vind 2.6
m/s från N") to reduce the length of an already data-dense line.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Trim redundant words ("regnskurar" -> "skurar", "molnighet" ->
"molnväxling", drop trailing "regn" from sleet terms) so forecast
lines take up less space.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
The current weather line already only ever shows a single-moment
observation, so "just nu" was redundant.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Two well-spaced points give a better overview than three consecutive
hours. Also drop "vind"/"från" from the current weather line's wind
text, matching the shorter format already used in the forecast steps.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
A "→" between the current conditions and the forecast signals that
what follows is upcoming weather, replacing the plain "." there.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
The commas between temperature/wind and symbol/wind didn't add
anything, so drop them and rely on spacing alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Drop the colon after "Karlskrona", the space before the degree sign,
and the "C" in "°C" (Celsius is implied for a Swedish audience).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
N/NO/O/... become ↑/↗/→/... — a compact compass-rose arrow instead
of a two-letter abbreviation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
The "→" separator clashed visually with the compass arrows now used
for wind direction (e.g. an actual east wind renders as "→" too),
so switch back to the plain dash already used between forecast steps.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
A middle dot reads more cleanly than a plain dash and avoids any
resemblance to a minus sign.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Rename hours_ahead to step_indices since these are positions in the
timeSeries list, not literal hour offsets. Build the Europe/Stockholm
ZoneInfo once outside the loop instead of on every iteration.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
@mosbth

mosbth commented Aug 23, 2026

Copy link
Copy Markdown
Owner Author

Ser ut så här:

00:38 < User> marvin väder
00:38 < marvin> Karlskrona 15.8° halvklart 1.0 m/s ↑ · 04:00 13.5° nästan klart 2.7 m/s ↖ · 08:00 14.7° klart 2.1 m/s ↖.

The metobs "rådande väder" code only reports active precipitation/fog/
thunder, not general sky/cloud condition, so "klart"/"molnigt" etc.
never showed up in the current-weather line. Reuse the forecast API's
symbol for the nearest hour (time_series[0]) to fill that gap.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax5CKcNH5hwbYNJoRGLyAC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant