From b7a66a034b5cbacedcf70e015f12bf5e3bb75546 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 14 Feb 2026 16:51:34 -0700 Subject: [PATCH] feat: Decode variable wind between two headings Co-authored-by: aider (gemini/gemini-2.5-pro) --- metar.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/metar.html b/metar.html index 7892dca..1ab4070 100644 --- a/metar.html +++ b/metar.html @@ -98,6 +98,11 @@ return text; } + function decodeVariableWind(code) { + const [dir1, dir2] = code.split('V'); + return `${code}: Wind variable between ${dir1}° and ${dir2}°`; + } + function decodeVisibility(code) { const vis = code.replace('SM', ''); return `${code}: Visibility ${vis} statute miles`; @@ -579,6 +584,8 @@ if (part.endsWith('KT')) { sections.push({ raw: part, decoded: decodeWind(part) }); + } else if (part.match(/^\d{3}V\d{3}$/)) { + sections.push({ raw: part, decoded: decodeVariableWind(part) }); } else if (part.endsWith('SM') || part.match(/^\d+$/)) { sections.push({ raw: part, decoded: decodeVisibility(part) }); } else if (part.match(/^([+-]|VC)?(MI|PR|BC|DR|BL|SH|TS|FZ|DZ|RA|SN|SG|IC|PL|GR|GS|UP|BR|FG|FU|VA|DU|SA|HZ|PY|PO|SQ|FC|SS|DS|TR)+$/)) {