avwx.parsing.translate.metar
METAR data translation handlers.
1"""METAR data translation handlers.""" 2 3import avwx.parsing.translate.base as _trans 4from avwx.parsing.translate import remarks 5from avwx.structs import MetarData, MetarTrans, Units 6 7 8def translate_metar(wxdata: MetarData, units: Units) -> MetarTrans: 9 """Return translations for a MetarData object.""" 10 shared = _trans.current_shared(wxdata, units) 11 return MetarTrans( 12 altimeter=shared.altimeter, 13 clouds=shared.clouds, 14 visibility=shared.visibility, 15 wx_codes=shared.wx_codes, 16 wind=_trans.wind( 17 wxdata.wind_direction, 18 wxdata.wind_speed, 19 wxdata.wind_gust, 20 wxdata.wind_variable_direction, 21 units.wind_speed, 22 ), 23 temperature=_trans.temperature(wxdata.temperature, units.temperature), 24 dewpoint=_trans.temperature(wxdata.dewpoint, units.temperature), 25 remarks=remarks.translate(wxdata.remarks, wxdata.remarks_info), 26 )
def
translate_metar( wxdata: avwx.structs.MetarData, units: avwx.structs.Units) -> avwx.structs.MetarTrans:
9def translate_metar(wxdata: MetarData, units: Units) -> MetarTrans: 10 """Return translations for a MetarData object.""" 11 shared = _trans.current_shared(wxdata, units) 12 return MetarTrans( 13 altimeter=shared.altimeter, 14 clouds=shared.clouds, 15 visibility=shared.visibility, 16 wx_codes=shared.wx_codes, 17 wind=_trans.wind( 18 wxdata.wind_direction, 19 wxdata.wind_speed, 20 wxdata.wind_gust, 21 wxdata.wind_variable_direction, 22 units.wind_speed, 23 ), 24 temperature=_trans.temperature(wxdata.temperature, units.temperature), 25 dewpoint=_trans.temperature(wxdata.dewpoint, units.temperature), 26 remarks=remarks.translate(wxdata.remarks, wxdata.remarks_info), 27 )
Return translations for a MetarData object.