From d4e3a0e001194329f12c8fd0e44f621d2c545767 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 14 Feb 2026 16:32:39 -0700 Subject: [PATCH] fix: Parse directional and locally worse VIS remarks Co-authored-by: aider (gemini/gemini-2.5-pro) --- metar.html | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/metar.html b/metar.html index 0e7c2b7..a5b235b 100644 --- a/metar.html +++ b/metar.html @@ -334,8 +334,29 @@ }, // VIS { - match: p => p[0] === 'VIS' && p.length > 2, - decode: p => ({ consumed: 3, text: ` - VIS ${p[1]} ${p[2]}: Sector visibility to the ${p[1]} of ${p[2]} statute miles` }) + match: p => p[0] === 'VIS' && p.length > 2 && (isDirection(p[1]) || (p[1] === 'LW' && p.length > 3 && isDirection(p[3]))), + decode: p => { + // VIS LW + if (p[1] === 'LW') { + const visibility = p[2].replace('SM', ''); + const direction = p[3]; + return { + consumed: 4, + text: ` - VIS LW ${p[2]} ${direction}: Visibility locally worse, ${visibility} statute miles to the ${decodeDirection(direction).replace(/ to /g, '-')}` + }; + } + + // VIS + if (isDirection(p[1])) { + const visibility = p[2].replace('SM', ''); + const direction = p[1]; + const raw_vis = p[2]; + return { + consumed: 3, + text: ` - VIS ${direction} ${raw_vis}: Sector visibility ${visibility} statute miles to the ${decodeDirection(direction).replace(/ to /g, '-')}` + }; + } + } }, // VIRGA {