From 7e6475c09a2a33814d01c5229c7c822057446900 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 14 Feb 2026 15:22:01 -0700 Subject: [PATCH] feat: Add support for decoding obscuration remarks like FG8 Co-authored-by: aider (gemini/gemini-2.5-pro) --- metar.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/metar.html b/metar.html index a4f56b2..fa37cfb 100644 --- a/metar.html +++ b/metar.html @@ -208,12 +208,30 @@ return `${code}: ${decodedParts.join(', ')}`; } + function decodeObscurationRemark(code) { + const weatherMap = { + 'FG': 'Fog', + 'BR': 'Mist', + 'FU': 'Smoke', + 'HZ': 'Haze', + 'DU': 'Widespread dust', + 'SA': 'Sand', + }; + const weatherCode = code.substring(0, 2); + const oktas = code.substring(2); + const weatherName = weatherMap[weatherCode]; + return `${code}: ${weatherName} obscuring ${oktas}/8 of the sky`; + } + function decodeRemarks(parts) { let decoded = ["RMK: Remarks"]; const weatherRegex = /^([+-]|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)+$/; + const obscurationRegex = /^(FG|BR|FU|HZ|DU|SA)\d$/; parts.forEach(part => { if (part.startsWith('SLP')) { decoded.push(` - ${decodeSlp(part)}`); + } else if (obscurationRegex.test(part)) { + decoded.push(` - ${decodeObscurationRemark(part)}`); } else if (part.match(/^([A-Z]{2}\d)+$/)) { decoded.push(` - ${decodeCloudTypesRemark(part)}`); } else if (weatherRegex.test(part)) {