-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Description:
ICAO-format METARs commonly have both correction (COR) and automation (AUTO) modifiers together, but SwiftMETAR's Observer enum can only represent one state:
public enum Observer: String, Codable {
case human = ""
case automated = "AUTO"
case corrected = "COR"
}Current Behavior:
// ✅ Works
try await METAR.from(string: "EGLL 172050Z AUTO 08005KT 9999 NCD 03/M03 Q1016")
// observer = .automated
// ✅ Works
try await METAR.from(string: "EGLL 172050Z COR 08005KT 9999 NCD 03/M03 Q1016")
// observer = .corrected
// ❌ Fails with badFormat error
try await METAR.from(string: "EGLL 172050Z COR AUTO 08005KT 9999 NCD 03/M03 Q1016")Expected Behavior:
Should parse successfully and preserve both pieces of information. The actual weather data (wind, temperature, QNH, etc.) is valid - the parser shouldn't fail entirely just because both modifiers are present.
Real-World Impact:
Many European automated weather stations issue corrected reports with this format. Currently, all such METARs fail to parse even though the weather data itself is perfectly valid.
Suggested Approaches:
- Separate boolean properties (simplest):
public var isAutomated: Bool
public var isCorrected: Bool- OptionSet (more flexible):
public struct ObserverFlags: OptionSet {
public let rawValue: Int
public static let automated = ObserverFlags(rawValue: 1 << 0)
public static let corrected = ObserverFlags(rawValue: 1 << 1)
}
public var observerFlags: ObserverFlags- Graceful degradation (quickest fix):
Parse either modifier and succeed, even if we can only store one. ParsingCOR AUTOand only capturing.automatedis better than failing completely.
References:
- ICAO Annex 3 / Doc 8896 allows multiple modifiers
- Example: Many UK automated stations (EGLL, EGKK, EGGD) regularly issue
COR AUTOreports
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels