Skip to main content

A python parser for the FAA CIFP

Project description

cifparse

A python parser for the FAA CIFP.

Versions

Version Description Release Date
1.0.1 Minor fixes to SQL statements. 2025-04-24
1.0.0 Updated table handling to include additional detail and data types. 2024-12-11
0.9.3 Updated procedure handling (breaking changes) and database support. 2024-11-15
0.9.2 Minor fixes. 2024-07-13
0.9.0 Initial public release. 2024-07-13

A changelog is available in the CHANGELOG.md with additional detail and guidance.

Installation

Install using pip:

pip install cifparse

Usage

Usage is relatively straightforward. Setting the path to the file can be somewhat finnicky, as it will only accept relative paths. To keep things simple, place the CIFP file in your project directory. Otherwise, if you want to go up several folders into a download folder, it might end up looking like ../../../../Downloads/FAACIFP18.

Given the amount of data, parsing can take a moment. If dumping the data to a file, that can also add time. Dumping every airport to JSON can take around 15 seconds, and the resulting file is about 330MB.

Examples

Start by importing cifparse, setting the path to the CIFP file, and then parsing the data.

import cifparse

# Initialize the parser:
from cifparse import CIFP

# Set the path to where you have the CIFP file:
c = CIFP("FAACIFP18")

# Parse the data in the file:
c.parse()
# ...or to save time, parse only a specific subset:
c.parse_airports()
c.parse_heliports()
c.parse_ndbs()
c.parse_airways()
c.parse_vhf_dmes()
c.parse_waypoints()
c.parse_controlled()
c.parse_restrictive()

Working with Entire Segments

After parsing the data, the results will be in the CIFP object, accessible via getters that return lists of the objects.

all_airports = c.get_airports()
all_heliports = c.get_heliports()
all_airways = c.get_airways()
all_ndbs = c.get_ndbs()
all_vordmes = c.get_vhf_dmes()
all_waypoints = c.get_waypoints()
all_controlled = c.get_controlled()
all_restrictive = c.get_restrictive()

Working with Specific Items

airport = c.find_airport("KIAD")
heliport = c.find_heliport("DC03")
airway = c.find_airway("J146")
ndb = c.find_ndb("GTN")
vor = c.find_vhf_dme("AML")
fix = c.find_waypoint("RAVNN")
dc_class_b = c.find_controlled("KDCA")
roa_class_c = c.find_controlled("KROA")
cho_class_d = c.find_controlled("KCHO")
moa = c.find_restrictive("DEMO 1 MOA")

# Because the Alert, MOA, Restricted, and Warning airspace can occasionally be named oddly,
# there is an additional helper function that finds all matches of a particular substring:
all_5314 = c.find_restrictive_match("5314")
# Returns: [R-5314A, R-5314B, R-5314C, R-5314D, R-5314E, R-5314F, R-5314H, R-5314J]

Exporting Data

Dictionaries

Each object has its own to_dict() method. This is useful when you need to dump the data to json:

c = CIFP("FAACIFP18")
airport = c.find_airport("KIAD")
with open("output.json", "w") as json_file:
    json.dump(airport.to_dict(), json_file, indent=2)
Database

Each object has its own to_db() method. This is useful when you would like the data to persist, or query it using standard database methods:

import sqlite3

connection = sqlite.connect("FAACIFP18.db")
cursor = connection.cursor()

c = CIFP("FAACIFP18")
c.initialize_database(cursor)
c.parse()
c.to_db(cursor)

connection.commit()
connection.close()

NOTE: The resulting tables are somewhat less-optimally normalized than they could be. This is mostly to allow flexibility in querying. For example, the airway_points table can be queried directly, or it can be queried via airways with a join to airway_points. There is limited additional information, but it could also help to get higher level overviews of the underlying data. Airspace follows a similar principle.

Example File

An example file is provided in the Examples directory. It demonstrates parsing all of the CIFP data, finding an airport within the data, and then looping through the SID and STAR data to create a geoJSON file for each.

CIFP Objects

A breakdown of the different objects can be found in the Docs directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cifparse-1.0.1.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cifparse-1.0.1-py3-none-any.whl (48.7 kB view details)

Uploaded Python 3

File details

Details for the file cifparse-1.0.1.tar.gz.

File metadata

  • Download URL: cifparse-1.0.1.tar.gz
  • Upload date:
  • Size: 37.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for cifparse-1.0.1.tar.gz
Algorithm Hash digest
SHA256 61983cb2fa829d8daf33e25d417caea264e3477f483c5ac3f4c4bee1c867f285
MD5 2eeee2643a71450c0c263e6e4c3b35da
BLAKE2b-256 6bf15076e1401aa63fa62048538d781f1b6f7ebf66869a3b2951d76b61a0cd55

See more details on using hashes here.

File details

Details for the file cifparse-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: cifparse-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 48.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for cifparse-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7616cafcbbf6942bd470cadaf0965e37f2900118b23defa2fd06577ab9433f42
MD5 35a7eb61494a509781c2aaab4b1d1221
BLAKE2b-256 55a6cd812465ca1d3400f89a5a67a7ab1032152bf3448a0a64a1dcffc8f1afbb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page