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 {