This project is read-only.
1
Vote

PROB30/PROB40 handled incorrectly in TAF decoding

description

When processing the following TAF, the final FM does not appear in the output, and the PROB30 is incomplete:
TAF AMD CYQX 112140Z 1121/1218 15008KT P6SM SCT008 OVC030
      TEMPO 1121/1124 5SM -SHRA BR BKN005 OVC030
     FM120000 17012KT 4SM -SHRA BR BKN008 OVC015
      TEMPO 1200/1206 6SM BR SCT008 OVC015
     FM120600 22012G22KT 3SM -SHRA BR OVC008
      PROB30 1206/1212 1SM +TSRA BR OVC003
     FM121400 22015G25KT P6SM SCT020 RMK
      NXT FCST BY 120000Z=
The DecodePrefix method in ENG.WMOCodes.Decoders/Internal/TrendInfoForTafDecoder.cs contains this line:
        source = CutMatch(source, match.Groups[(int)info.Type].Value);
This assumes that the value of the enum matches the index of the regular expression group match. Unfortunately the order is not identical between the three places where this information is defined:
    private enum eType {
      ...
      Prob30,
      Prob40
    }
...
      get { return "...|(^PROB40)|(^PROB30)"; }
...
        return new eType[] { ..., eType.Prob40, eType.Prob30 };
When processing a PROB30, this results in CutMatch removing an empty string instead of PROB30 from the source string, which throws off the rest of the decoding.

Attached is a proposed, trivial patch which updates the order of the enumerated values to match the other two orderings.

file attachments

comments