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)) {