pycontrails.core.airports

Airport data support.

Module Attributes

Functions

distance_to_airports(airports, longitude, ...)

Calculate the 3D distance from the waypoint to the provided airports.

find_nearest_airport(airports, longitude, ...)

Find airport nearest to the waypoints.

global_airport_database([cachestore, ...])

Load and process global airport database from Our Airports.

pycontrails.core.airports.OURAIRPORTS_DATABASE_URL = 'https://github.com/contrailcirrus/ourairports-data/raw/main/airports.csv'

URL for Our Airports database. Fork of the ourairports-data repository.

pycontrails.core.airports.distance_to_airports(airports, longitude, latitude, altitude)

Calculate the 3D distance from the waypoint to the provided airports.

Parameters:
Returns:

numpy.ndarray – 3D distance from waypoint to airports, [\(m\)]

See also

geo.haversine()

pycontrails.core.airports.find_nearest_airport(airports, longitude, latitude, altitude, *, bbox=2.0)

Find airport nearest to the waypoints.

Parameters:
  • airports (pandas.DataFrame) – Airport database in the format returned from global_airport_database().

  • longitude (float) – Waypoint longitude, [\(\deg\)]

  • latitude (float) – Waypoint latitude, [\(\deg\)]

  • altitude (float) – Waypoint altitude, [\(m\)]

  • bbox (float) – Search airports within spatial bounding box of ± bbox from the waypoint, [\(\deg\)] Defaults to \(2\deg\)

Returns:

str – ICAO code of nearest airport. Returns None if no airport is found within bbox.

Notes

Function will first search for large airports around the waypoint vicinity. If none is found, it will search for medium and small airports around the waypoint vicinity.

The waypoint must be below 10,000 feet to increase the probability of identifying the correct airport.

pycontrails.core.airports.global_airport_database(cachestore=None, update_cache=False)

Load and process global airport database from Our Airports.

The database includes coordinates and metadata for 74867 unique airports.

Parameters:
  • cachestore (cache.CacheStore | None, optional) – Cache store for airport database. Defaults to cache.DiskCacheStore.

  • update_cache (bool, optional) – Force update to cached airports database.

Returns:

pandas.DataFrame – Processed global airport database.

Global airport database.

Notes

As of 2023 March 30, the global airport database contains:

Airport Type

Number

small_airport

39327

heliport

19039

closed

10107

medium_airport

4753

seaplane_base

1133

large_airport

463

balloonport

45

References