#!/usr/bin/env python # This is an example of using the FAA_ATA100 module to do something interesting. import FAA_ATA100 data = FAA_ATA100.ATA100zip('../raw_data/FAA/ATA-100/current.zip') parsed_data = data.parse('APT') for record_type in parsed_data.fields.keys(): print record_type for field_name in parsed_data.fields[record_type]: print '\t' + field_name interesting_airports = ['LAF', 'BMG'] interesting_entry = 0 for record in parsed_data: rti = record['RTI'] if rti == 'APT': ident = record['LOCATION IDENTIFIER'] if not ident in interesting_airports: interesting_entry = 0 continue interesting_entry = 1 print ident, print record['LOCATION IDENTIFIER'], print record['ASSOCIATED CITY NAME'], print record['ASSOCIATED STATE POST OFFICE CODE'], print FAA_ATA100.seconds_to_degrees(record['AIRPORT REFERENCE POINT LONGITUDE (SECONDS)']), print FAA_ATA100.seconds_to_degrees(record['AIRPORT REFERENCE POINT LATITUDE (SECONDS)']), print record['AERONAUTICAL SECTIONAL CHART ON WHICH FACILITY'] elif not interesting_entry: continue elif rti == 'RWY': print '\t', print record['RUNWAY IDENTIFICATION'], print record['PHYSICAL RUNWAY LENGTH (NEAREST FOOT)'], print record['PHYSICAL RUNWAY WIDTH (NEAREST FOOT)']