avwx-rest / avwx-engine

Aviation Weather parsing engine. METAR & TAF
MIT License
90 stars 31 forks source link

lookup station by IATA code? #33

Closed mralext20 closed 3 years ago

mralext20 commented 3 years ago

i maintain a discord bot that uses this library, and it would be really usful for there to be a way to lookup a station by the iata code, instead of just by the icao code.

devdupont commented 3 years ago

It's possible to do this already by doing a text search, but yeah this can be added via a LazyCalc similar to ICAO lookups

devdupont commented 3 years ago

Added in 1.6.5. Uses LazyCalc so the data and mapping isn't generated unless needed.

>>> import avwx
>>> 
>>> london = avwx.Station.from_iata("LHR")
>>> 
>>> london == avwx.Station.from_icao(london.icao)  # EGLL
True