diff --git a/metar.html b/metar.html
index 8f89211..4b7ebf6 100644
--- a/metar.html
+++ b/metar.html
@@ -550,6 +550,13 @@
let failed = 0;
let withUnknowns = 0;
const originalConsoleLog = console.log;
+ const unknowns = {
+ airports: new Set(),
+ weatherChunks: new Set(),
+ cloudInfos: new Set(),
+ cloudTypesInRemark: new Set(),
+ otherRemarks: new Set(),
+ };
metars.forEach(metarString => {
const tempLogs = [];
@@ -567,7 +574,25 @@
if (hasUnknowns) {
withUnknowns++;
originalConsoleLog(`METAR with decoding issues: ${metarString}`);
- tempLogs.forEach(msg => originalConsoleLog(` -> ${msg}`));
+ tempLogs.forEach(msg => {
+ originalConsoleLog(` -> ${msg}`);
+ if (msg.startsWith('Unknown Airport code:')) {
+ const code = msg.split(' ')[3];
+ unknowns.airports.add(code);
+ } else if (msg.startsWith('Unknown weather chunk:')) {
+ const chunk = msg.split(' ')[3];
+ unknowns.weatherChunks.add(chunk);
+ } else if (msg.startsWith('Unknown cloud information:')) {
+ const code = msg.split(' ')[3];
+ unknowns.cloudInfos.add(code);
+ } else if (msg.startsWith('Unknown cloud type in remark:')) {
+ const code = msg.split(' ')[5];
+ unknowns.cloudTypesInRemark.add(code);
+ } else if (msg.startsWith('Other remark:')) {
+ const remark = msg.split(' ')[2];
+ unknowns.otherRemarks.add(remark);
+ }
+ });
}
} catch (e) {
@@ -585,6 +610,14 @@
console.log(`Clean decodes: ${clean} (${(clean/total*100).toFixed(1)}%)`);
console.log(`Decodes with issues: ${withUnknowns} (${(withUnknowns/total*100).toFixed(1)}%)`);
console.log(`Failed to parse: ${failed} (${(failed/total*100).toFixed(1)}%)`);
+
+ console.log(`\n--- Unknowns encountered ---`);
+ for (const key in unknowns) {
+ if (unknowns[key].size > 0) {
+ console.log(`${key}:`);
+ console.log([...unknowns[key]].sort());
+ }
+ }
}
testAllBtn.addEventListener('click', testAllMetars);