-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Description:
ICAO METARs place trend indicators (NOSIG, BECMG, TEMPO) at the end of the main body without a RMK keyword. SwiftMETAR only parses these in the remarks section, causing otherwise valid ICAO METARs to fail completely.
Current Behavior:
// ✅ Works (US format with RMK keyword)
try await METAR.from(string: "KJFK 171851Z 31008KT 10SM FEW250 M04/M17 A3034 RMK NOSIG")
// ❌ Fails with badFormat (ICAO format without RMK)
try await METAR.from(string: "EGLL 172050Z 08005KT 9999 NCD 03/M03 Q1016 NOSIG")Expected Behavior:
Should parse ICAO trend indicators appearing after QNH/altimeter in the main body. Even if the trend forecast itself isn't parsed, the parser should gracefully ignore it and successfully parse the weather data.
Real-World Impact:
NOSIG appears in the vast majority of European METARs. Currently, every METAR from major European airports (EGLL, LFPG, EDDF, LEMD, etc.) fails to parse entirely, even though all the actual weather data is valid and parseable.
Context:
Two different METAR formats exist:
ICAO Format (used worldwide):
METAR EGLL 172050Z 08005KT 9999 NCD 03/M03 Q1016 NOSIG
^^^^^^ no RMK keyword
US Format (FAA/NWS):
METAR KJFK 171851Z 31008KT 10SM FEW250 M04/M17 A3034 RMK AO2 NOSIG
^^^ RMK separates
Code Evidence:
The NOSIGParser exists but only runs on the remarks section:
struct NOSIGParser: RemarkParser { // ← Only processes after RMK
private static let regex = #"\bNOSIG\b"#
...
}Suggested Fix:
Option 1 - Graceful degradation (simplest):
When parsing the main body, if an unknown keyword is encountered at the end (after all expected groups), treat it as the end of parseable data rather than throwing an error. This would allow:
...Q1016 NOSIG→ Parse everything up to Q1016, ignore NOSIG...A3034 BECMG 2000→ Parse everything up to A3034, ignore trend
Option 2 - Full ICAO support:
Add trend parsing to the main METAR parser, after QNH/altimeter and before any RMK:
NOSIG- No significant change expectedBECMG [conditions]- Conditions becoming...TEMPO [conditions]- Temporary conditions...
These should still work after RMK for US compatibility.
Common ICAO Trend Indicators:
NOSIG(very common - ~80% of European METARs)BECMG(occasional)TEMPO(occasional)
References:
- ICAO Annex 3, Section 4.4 (Trend Forecasts)
- ICAO Doc 8896 (Manual of Aeronautical Meteorological Practice)