dmbaturin / pytaf

TAF (Terminal Aerodrome Forecast) and METAR parser and decoder
MIT License
57 stars 23 forks source link

taf.get_header() shows dates with ordinal suffix #11

Open dscarlat opened 6 years ago

dscarlat commented 6 years ago

i.e. for taf = pytaf.TAF("TAF AMD KMKE 172034Z 1721/1824 14013G19KT P6SM SCT028 BKN035 BKN250 FM180100 17008KT P6SM SCT035 BKN120 FM181000 17007KT P6SM VCSH BKN040 OVC080 TEMPO 1811/1815 6SM -TSRA BR BKN030CB FM181500 18009KT P6SM VCSH BKN050 FM182100 16012KT P6SM SCT050 BKN150")

After running

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

print(taf.get_header()) shows {'form': 'taf', 'icao_code': 'KMKE', 'origin_date': '17th', 'valid_till_hours': '24', 'valid_from_hours': '21', 'origin_hours': '20', 'valid_from_date': '17th', 'type': 'AMD', 'origin_minutes': '34', 'valid_till_date': '18th'}

why origin_date, valid_from_date and valid_till_date as the ordinal suffix and not just the day int value?

dscarlat commented 6 years ago

maybe this is not avoiding side effect:

https://github.com/dmbaturin/pytaf/blob/51f30c11b3f523a4601f8bf70c6147b85d41113b/lib/pytaf/tafdecoder.py#L61

dscarlat commented 6 years ago

Yes I think you need to use: _header = copy.copy(header) to avoid side effect.