pytaf icon indicating copy to clipboard operation
pytaf copied to clipboard

TAFs with missing issue date/time interpreted incorrectly

Open MxMartin opened this issue 6 years ago • 3 comments

I noticed a few TAFs in my dataset that had no issue date/time and that the parser then incorrectly interpreted the valid form/to date/time as issue date/time, e. g.:

'TAF ENBO 0615/0715 03008KT 9999 FEW025 SCT100 BECMG 0615/0618 25010KT PROB30 TEMPO 0621/0708 BKN008'

would be interpreted as

TAF for KQHN issued 07: UTC on the 02nd, valid from :00 UTC on the to 13:00 UTC on the 03rd Wind: from 270 degrees at 09 knots Visibility: more than 10 000 meters Sky conditions: sky clear

Temporarily between 11:00 on the 02nd and 15:00 on the 02nd: Wind: from 270 degrees at 10 knots gusting to 15 knots Visibility: 6000 meters Weather: blowing dust

Gradual change to the following between 12:00 on the 02nd and 13:00 on the 02nd: Wind: variable at 06 knots Visibility: 9000 meters Sky conditions: sky clear Weather: haze

I am not familiar enough with regex to come up with a sensible solution to this. Is there a way to define that the "valid from/to" expression must be encapsulated by spaces and must contain a /?

Kind regards Mike

MxMartin avatar Nov 19 '18 16:11 MxMartin

Interesting question. Frankly, I'm tempted to rewrite the parser part as a custom-built state machine, or using some context-sensitive language toolkit. The "regex"-based approach obviously got out of control and reached its maintainability limits quickly.

dmbaturin avatar Nov 19 '18 16:11 dmbaturin

I would like to also mention that the pytaf program forget the last TAF line.

import pytaf

#taf = pytaf.TAF("TAF KIAH 090530Z 0906/1012 02006KT 3SM BR OVC004 FM090700 02008KT 4SM SHRA BR VCSH OVC007 TEMPO 0909/0913 2SM -TSRA BKN007 OVC040CB FM091300 01014G21KT 4SM -RA BR OVC006 FM091800 01017G25KT 6SM -DZ BR BKN012 OVC040 FM092200 01014G23KT P6SM BKN035 OVC090 FM100000 02013KT P6SM SCT120 SCT250 FM100700 03008KT P6SM BKN100 =")

taf = pytaf.TAF("TAF AMD CYMX 090209Z 0902/0924 VRB03KT P6SM OVC010 TEMPO 0902/0904 3SM SHRA BR OVC004 PROB40 0902/0904 VRB15G25KT 11/2SM TSRA BR OVC003CB FM090400 VRB03KT P6SM OVC010 TEMPO 0904/0905 VRB15G25KT 11/2SM TSRA BR OVC003CB FM090500 VRB03KT 3/4SM BR OVC002 TEMPO 0905/0911 2SM -SHRA BR OVC003 PROB30 0905/0911 1/4SM FG VV001 FM091100 VRB03KT WS010/24030KT 3/4SM -SHRA BR OVC002 PROB30 0911/0914 VRB15G30KT 2SM TSRA BR OVC004CB FM091400 24010G20KT 4SM -SHRA BR OVC005 FM091600 24010G20KT P6SM SCT008 OVC015 BECMG 0922/0924 23008KT RMK NXT FCST BY 090600Z =")

decoder = pytaf.Decoder(taf) print(decoder.decode_taf())

output:

TAF amended for CYMX issued 02:09 UTC on the 09th, valid from 02:00 UTC on the 09th to 24:00 UTC on the 09th Wind: variable at 03 knots Visibility: more than 6 statute miles Sky conditions: overcast clouds at 1000 feet

Temporarily between 02:00 on the 09th and 04:00 on the 09th: Visibility: 3 statute miles Sky conditions: overcast clouds at 400 feet Weather: rain showers / mist

Probability 40% of the following between 02:00 on the 09th and 04:00 on the 09th: Wind: variable at 15 knots gusting to 25 knots Sky conditions: overcast cumulonimbus clouds at 300 feet Weather: rain thunderstorms / mist

From 04:00 on the 09th: Wind: variable at 03 knots Visibility: more than 6 statute miles Sky conditions: overcast clouds at 1000 feet

Temporarily between 04:00 on the 09th and 05:00 on the 09th: Wind: variable at 15 knots gusting to 25 knots Sky conditions: overcast cumulonimbus clouds at 300 feet Weather: rain thunderstorms / mist

From 05:00 on the 09th: Wind: variable at 03 knots Visibility: 3/4 statute miles Sky conditions: overcast clouds at 200 feet Weather: mist

Temporarily between 05:00 on the 09th and 11:00 on the 09th: Visibility: 2 statute miles Sky conditions: overcast clouds at 300 feet Weather: light rain showers / mist

Probability 30% of the following between 05:00 on the 09th and 11:00 on the 09th: Visibility: 1/4 statute miles Weather: fog

From 11:00 on the 09th: Wind: variable at 03 knots Visibility: 3/4 statute miles Sky conditions: overcast clouds at 200 feet Weather: light rain showers / mist Windshear: at 1000, wind 240 at 30 KT

Probability 30% of the following between 11:00 on the 09th and 14:00 on the 09th: Wind: variable at 15 knots gusting to 30 knots Visibility: 2 statute miles Sky conditions: overcast cumulonimbus clouds at 400 feet Weather: rain thunderstorms / mist

From 14:00 on the 09th: Wind: from 240 degrees at 10 knots gusting to 20 knots Visibility: 4 statute miles Sky conditions: overcast clouds at 500 feet Weather: light rain showers / mist

From 16:00 on the 09th: Wind: from 240 degrees at 10 knots gusting to 20 knots Visibility: more than 6 statute miles Sky conditions: scattered clouds at 800 feet, overcast clouds at 1500 feet

It complete skips "BECMG 0922/0924 23008KT RMK NXT FCST BY 090600Z"

Don't no if this is the same issue because it doesn't parse 0922/0924

jamayfieldjr avatar Dec 05 '18 03:12 jamayfieldjr

I don't believe so dmbaturin regex is really powerful and you've obviously built a program that works! I've have a program in MATLAB that decodes TAFs. There are only a number of combination the NWS can put in their TAFs. Eurocontrol in Brussels is a bit more lean and use a ton of prob groups! IT DRIVES ME CRAZY! I found your program a year ago and have really gotten into python3.

jamayfieldjr avatar Dec 05 '18 03:12 jamayfieldjr