extend aircraft dataset with ICAO Aircraft Type Designator info
Introduction
traffic already provides aircraft information via either Junzi's or OpenSky's aircraft database.
I find myself needing to filter out helicopters or non land planes: given that the aircraft database has a typecode column for the ICAO aircraft type designator it would make (my?) life easier to have the possibility to join it with the Aircraft Type Designator dataset from ICAO.
Goal
Extend traffic.data.aircraft with (and/or make available on its own, say doc8643at) a dataset that contains ICAO's Aircraft Type Designator information.
ICAO web page for Doc 8643 is at https://www.icao.int/publications/DOC8643/ It provides a search facility: https://www.icao.int/publications/DOC8643/Pages/Search.aspx
If you look behind the scenes 😁 you can see that the underlying dataset can be scraped with:
import requests
import json
import pandas as pd
doc8643_url = r = "https://www4.icao.int/doc8643/External/AircraftTypes"
r = requests.post(doc8643_url)
doc8643at = pd.json_normalize(r.json())
doc8643at.columns = doc8643at.columns.str.lower()
doc8643at = doc8643at.rename(columns={
"modelfullname": "model",
"manufacturercode": "manufacturer_code",
"aircraftdescription": "aircraft_description",
"enginecount": "engine_count",
"enginetype": "engine_type"
}).drop(columns=['wtg'])
| model | description | wtc | designator | manufacturer_code | aircraft_description | engine_count | engine_type |
|---|---|---|---|---|---|---|---|
| Dornier 328JET | L2J | M | J328 | 328 SUPPORT SERVICES | LandPlane | 2 | Jet |
| 450 Ultra | L1P | L | UL45 | 3XTRIM | LandPlane | 1 | Piston |
| Ultra | L1P | L | UL45 | 3XTRIM | LandPlane | 1 | Piston |
| 550 Trener | L1P | L | TR55 | 3XTRIM | LandPlane | 1 | Piston |
| Trener | L1P | L | TR55 | 3XTRIM | LandPlane | 1 | Piston |
| ... | ... | ... | ... | ... | ... | ... | ... |
| Z-526 Skydevil | L1P | L | Z26 | ZLIN | LandPlane | 1 | Piston |
| Z-526 Trener Master | L1P | L | Z26 | ZLIN | LandPlane | 1 | Piston |
| Z-626 | L1P | L | Z26 | ZLIN | LandPlane | 1 | Piston |
| Z-726 Universal | L1P | L | Z26 | ZLIN | LandPlane | 1 | Piston |
| Savage | L1P | L | SAVG | ZLIN AVIATION | LandPlane | 1 | Piston |
10316 rows × 9 columns
And similarly for Manufactures Codes at https://www.icao.int/publications/DOC8643/Pages/Manufacturers.aspx , say docs8643mc
Motivating Use-case
I am generally interested in analysing IFR flights, so if I could have ICAO aircraft type datasets (doc8643at and doc8643mc) joined and available in traffic.data.aircraft I would be able to apply the following filter
t_ifr = (t.aircraft_data()
# remove GA flights:
.query('description not in ["L1P","L2P","H1P", "H1T","H2T"]')
# remove special designator flights
.query('aircraft_description not in ["Gyrocopter", "Tiltrotor"])
.query('aircraft_description not in ["Amphibian", "Helicopter"])
)
Similarly I could study piston-only flights, ... and then apply the relevant queries.
Expected behaviour
I expect traffic.data.aircraft to be augmented (joined) with doc8643at and doc8643mc.
@xoolive is this desirable? I can PR if so.
I now have a similar use case to OP, will need this functionality either way
Hi @aliaksei135 thank you for offering yes, pull requests are welcome!