feat: Decode special METAR remarks and directional patterns

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-14 15:32:08 -07:00
parent 83318ef48a
commit cd87f98f18
+19
View File
@@ -246,6 +246,15 @@
'CU': 'Cumulus',
'CB': 'Cumulonimbus'
};
const specialRemarks = {
'FROIN': 'Frontal passage in vicinity',
'CONTRAILS': 'Contrails observed',
'VIRGA': 'Virga (precipitation not reaching the ground)'
};
const directions = {
'N': 'North', 'NE': 'Northeast', 'E': 'East', 'SE': 'Southeast',
'S': 'South', 'SW': 'Southwest', 'W': 'West', 'NW': 'Northwest'
};
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
@@ -255,6 +264,16 @@
decoded.push(` - ${decodeObscurationRemark(part)}`);
} else if (part.match(/^([A-Z]{2}\d)+$/)) {
decoded.push(` - ${decodeCloudTypesRemark(part)}`);
} else if (part === 'VIRGA' && i + 1 < parts.length && directions[parts[i+1]]) {
const direction = directions[parts[i+1]];
decoded.push(` - VIRGA ${parts[i+1]}: Virga to the ${direction.toLowerCase()}`);
i++; // Consume direction part
} else if (part === 'TCU' && i + 2 < parts.length && parts[i+1] === 'DSNT' && directions[parts[i+2]]) {
const direction = directions[parts[i+2]];
decoded.push(` - TCU DSNT ${parts[i+2]}: Towering cumulus distant ${direction.toLowerCase()}`);
i += 2; // Consume DSNT and direction
} else if (specialRemarks[part]) {
decoded.push(` - ${part}: ${specialRemarks[part]}`);
} else if (cloudTypes[part] && i + 1 < parts.length && parts[i + 1] === 'TR') {
const cloudName = cloudTypes[part];
decoded.push(` - ${part} ${parts[i+1]}: ${cloudName} clouds are translucent (thin)`);