Skip to content

Commit

Permalink
Merge pull request #15 from MichaelRoentgen/AMD-+-COR-type-fix
Browse files Browse the repository at this point in the history
Allowing for TAFs with type AMD and COR
  • Loading branch information
dmbaturin committed Nov 19, 2018
2 parents 72d72c8 + 48c15dc commit 3185a74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/pytaf/taf.py
Expand Up @@ -66,7 +66,7 @@ def _init_header(self, string):
^
(TAF)? # TAF header (at times missing or duplicate)
\s*
(?P<type> (COR|AMD|RTD)){0,1} # Corrected/Amended/Delayed
(?P<type> (COR|AMD|AMD\sCOR|COR\sAMD|RTD)){0,1}
\s* # There may or may not be space as COR/AMD/RTD is optional
(?P<icao_code> [A-Z]{4}) # Station ICAO code
Expand Down
10 changes: 7 additions & 3 deletions lib/pytaf/tafdecoder.py
Expand Up @@ -71,13 +71,17 @@ def _decode_header(self, header):
elif _header["type"] == "COR":
result += "TAF corrected for "
elif _header["type"] == "RTD":
result += "TAF related for "
result += "TAF delayed for "
elif _header["type"] == "AMD COR":
result += "TAF amended and corrected for "
elif _header["type"] == "COR AMD":
result += "TAF corrected and amended for "
else:
result += "TAF for "

# Add ordinal suffix
_header["origin_date"] = _header["origin_date"] + self._get_ordinal_suffix(_header["origin_date"])
_header["valid_from_date"] = _header["valid_from_date"] + self._get_ordinal_suffix(_header["valid_from_date"])
_header["valid_from_date"] = _header["valid_from_date"] + self._get_ordinal_suffix(_header["valid_from_date"])
_header["valid_till_date" ] = _header["valid_till_date"] + self._get_ordinal_suffix(_header["valid_till_date"])

result += ("%(icao_code)s issued %(origin_hours)s:%(origin_minutes)s UTC on the %(origin_date)s, "
Expand Down Expand Up @@ -205,7 +209,7 @@ def _decode_clouds(self, clouds):

if layer["layer"] == "CAVU":
return "ceiling and visibility unrestricted"

if layer["layer"] == "VV///":
return "Sky Obscured"

Expand Down

0 comments on commit 3185a74

Please sign in to comment.