feat: Add decoding for combined direction remarks

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-14 16:20:07 -07:00
parent de6daf0ffb
commit 5745eb934a
+24 -12
View File
@@ -279,6 +279,18 @@
'S': 'South', 'SW': 'Southwest', 'W': 'West', 'NW': 'Northwest' 'S': 'South', 'SW': 'Southwest', 'W': 'West', 'NW': 'Northwest'
}; };
function isDirection(dirStr) {
if (!dirStr) return false;
const dirParts = dirStr.split('-');
return dirParts.every(part => directions[part]);
}
function decodeDirection(dirStr) {
const dirParts = dirStr.split('-');
const decodedParts = dirParts.map(part => directions[part]);
return decodedParts.join(' to ').toLowerCase();
}
const decoders = [ const decoders = [
// SLP // SLP
{ {
@@ -312,8 +324,8 @@
if (p.length > 1 && p[1] === 'ALQDS') { if (p.length > 1 && p[1] === 'ALQDS') {
return { consumed: 2, text: ` - VIRGA ALQDS: Virga in all quadrants` }; return { consumed: 2, text: ` - VIRGA ALQDS: Virga in all quadrants` };
} }
if (p.length > 1 && directions[p[1]]) { if (p.length > 1 && isDirection(p[1])) {
return { consumed: 2, text: ` - VIRGA ${p[1]}: Virga to the ${directions[p[1]].toLowerCase()}` }; return { consumed: 2, text: ` - VIRGA ${p[1]}: Virga to the ${decodeDirection(p[1])}` };
} }
return { consumed: 1, text: ` - ${p[0]}: ${specialRemarks[p[0]]}` }; return { consumed: 1, text: ` - ${p[0]}: ${specialRemarks[p[0]]}` };
} }
@@ -346,8 +358,8 @@
if (mod === 'LENT') { if (mod === 'LENT') {
text = ` - ${cloudCode} LENT: ${cloudName} lenticularis`; text = ` - ${cloudCode} LENT: ${cloudName} lenticularis`;
consumed = 2; consumed = 2;
if (p.length > 2 && directions[p[2]]) { if (p.length > 2 && isDirection(p[2])) {
text += ` to the ${directions[p[2]].toLowerCase()}`; text += ` to the ${decodeDirection(p[2])}`;
consumed = 3; consumed = 3;
} }
} else if (mod === 'ASOCTD') { } else if (mod === 'ASOCTD') {
@@ -356,8 +368,8 @@
if (p.length > 3 && p[2] === '/' && p[3] === 'HALO') { if (p.length > 3 && p[2] === '/' && p[3] === 'HALO') {
text = ` - ${cloudCode} ASOCTD / HALO: ${cloudName} associated with Halo phenomenon`; text = ` - ${cloudCode} ASOCTD / HALO: ${cloudName} associated with Halo phenomenon`;
consumed = 4; consumed = 4;
} else if (p.length > 2 && directions[p[2]]) { } else if (p.length > 2 && isDirection(p[2])) {
text += ` to the ${directions[p[2]].toLowerCase()}`; text += ` to the ${decodeDirection(p[2])}`;
consumed = 3; consumed = 3;
} }
} else if (mod === 'ALQDS') { } else if (mod === 'ALQDS') {
@@ -366,14 +378,14 @@
} else if (mod === 'TR') { } else if (mod === 'TR') {
text = ` - ${cloudCode} TR: ${cloudName} clouds are translucent (thin)`; text = ` - ${cloudCode} TR: ${cloudName} clouds are translucent (thin)`;
consumed = 2; consumed = 2;
} else if (mod === 'DSNT' && p.length > 2 && directions[p[2]]) { } else if (mod === 'DSNT' && p.length > 2 && isDirection(p[2])) {
text = ` - ${cloudCode} DSNT ${p[2]}: ${cloudName} distant ${directions[p[2]].toLowerCase()}`; text = ` - ${cloudCode} DSNT ${p[2]}: ${cloudName} distant ${decodeDirection(p[2])}`;
consumed = 3; consumed = 3;
} else if (directions[mod]) { } else if (isDirection(mod)) {
text = ` - ${cloudCode} ${mod}: ${cloudName} to the ${directions[mod].toLowerCase()}`; text = ` - ${cloudCode} ${mod}: ${cloudName} to the ${decodeDirection(mod)}`;
consumed = 2; consumed = 2;
if (p.length > 3 && p[2] === 'MOV' && directions[p[3]]) { if (p.length > 3 && p[2] === 'MOV' && isDirection(p[3])) {
text += `, moving ${directions[p[3]].toLowerCase()}`; text += `, moving ${decodeDirection(p[3])}`;
consumed = 4; consumed = 4;
} }
} }