tracktable.info module

Submodules

tracktable.info.airports module

class tracktable.info.airports.Airport[source]

Bases: object

Information about a single airport

iata_code

3-letter IATA airport identifier

Type

string

icao_code

4-leter ICAO airport identifier

Type

string

name

Human-readable airport name

Type

string

city

City where airport is located

Type

string

country

Country where airport is located

Type

string

position

(longitude, latitude, altitude) position of airport

Type

tuple

size_rank

Approximate rank among all the world’s airports

Type

integer

utc_offset

Local time zone as an offset from UTC

Type

integer

tracktable.info.airports.airport_information(airport_code)[source]

Look up information about an airport

Parameters

airport_code – ICAO or IATA code for an airport

Returns

Airport object containing requested information.

Raises

KeyError – no such airport

tracktable.info.airports.airport_size_rank(airport_code)[source]

Return an airport’s global rank by size

Parameters

airport_code (string) – IATA or ICAO airport identifier

Returns

Integer ranking. 1 is the largest, higher values are smaller.

tracktable.info.airports.airport_tier(airport_code)[source]

Return an estimated tier for an airport

We divide airports roughly into 4 tiers (chosen purely by hand) for a classification task. This function lets us retrieve the tier assigned to any given airport.

Parameters

airport_code (string) – IATA/ICAO airport identifier

Returns

tier1, tier2, tier3 or tier4

Return type

String

Raises

KeyError – no such airport

tracktable.info.airports.all_airports()[source]

Return all the airport records we have

Returns

Unsorted list of airport objects.

tracktable.info.airports.build_airport_dict()[source]

Assemble the airport dictionary on first access

This function is called whenever the user tries to look up an airport. It checks to make sure the table has been populated and, if not, loads it from disk.

Returns

None

Side Effects:

Airport data will be loaded if not already in memory

tracktable.info.cities module

cities.py - Locations and population values for many cities of the world

class tracktable.info.cities.CityInfo[source]

Bases: object

Brief information about a city.

country_code

2-character abbreviation for country

Type

string

name

City name

Type

string

population

Estimated population

Type

integer

latitude

Latitude of city location

Type

float

longitude

Longitude of city location

Type

float

tracktable.info.cities.cities_in_bbox(bbox_min=(-180, -90), bbox_max=(180, 90), minimum_population=0)[source]

Return all the cities in a bounding box.

Kwargs:
bbox_min (TrajectoryPoint): Southwest corner of bounding box,

default (-180, -90)

bbox_max (TrajectoryPoint): Northeast corner of bounding box,

default (180, 90)

minimum_population (integer): Cities with lower population than

this will not be returned. Default 0.

Returns

List of CityInfo objects.

tracktable.info.cities.largest_cities_in_bbox(bbox_min=(-180, -90), bbox_max=(180, 90), count=10)[source]

Return the largest N cities in a bounding box.

A city’s size is measured by its population.

Parameters
  • bbox_min (TrajectoryPoint) – Southwest corner of bounding box. Defaults to (-180, -90).

  • bbox_max (TrajectoryPoint) – Northeast corner of bounding box. Defaults to (180, 90).

  • count (integer) – How many cities to return. Defaults to 10.

Returns

A list of CityInfo objects.

tracktable.info.timezones module

tracktable.info.timezones.find_containing_timezone(longitude, latitude)[source]
tracktable.info.timezones.load_timezone_shapefile()[source]
tracktable.info.timezones.local_time_for_position(position)[source]
tracktable.info.timezones.print_file()[source]
tracktable.info.timezones.retrieve_file()[source]

Module contents

tracktable.info: Various sources of information on cities and airports that we can use to annotate maps.

XXX TODO: Cite each source and its license here.