A python wrapper of the United States Federal Aviation Authority's National Airspace System API
Project description
NASSTAT - National AirSpace STATistics
#####################################################################
#####################################################################
#####███╗░░██╗░█████╗░░██████╗░██████╗████████╗░█████╗░████████╗#####
#####████╗░██║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔══██╗╚══██╔══╝#####
#####██╔██╗██║███████║╚█████╗░╚█████╗░░░░██║░░░███████║░░░██║░░░#####
#####██║╚████║██╔══██║░╚═══██╗░╚═══██╗░░░██║░░░██╔══██║░░░██║░░░#####
#####██║░╚███║██║░░██║██████╔╝██████╔╝░░░██║░░░██║░░██║░░░██║░░░#####
#####╚═╝░░╚══╝╚═╝░░╚═╝╚═════╝░╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░░░╚═╝░░░#####
#####################################################################
#####################################################################
Last updated: Fri March 21 2025
A python wrapper of the United States Federal Aviation Authority's National Airspace System API developed by Dariel Cruz Rodriguez.
Table of Contents
- Dependencies
- Installation
- Example Use Cases
- Attribution & Licensing
- Models
- Methods
Dependencies
Run this command to install the required packages:
pip install requests xml.etree.ElementTree json re
NASSTAT uses the following packages, many of which are included in the standard library of vanilla Python installations:
requests- for making HTTP requests to the FAA's APIxml.etree.ElementTree- for parsing the XML response from the FAA's APIjson- for parsing the JSON response from the FAA's APIre- for regular expression matching
Installation
Attribution & Licensing
Attribution
Although it is not required, please attribute use of this package to the author, Dariel Cruz Rodriguez, by including a link to dariel.us in your project. As a college student, your attribution can be really helpful in building my portfolio and building a reputation in the data science community. If you are unable to attribute, or it doesn't make sense for your project, please feel free to email me about your project so I can keep an internal note of it, I would love to hear about how you are using NASSTAT!
Additionally, the data provided by the FAA is licensed under the Open Government License, which allows for free use and redistribution of the data. Thank you Uncle Sam!
MIT License
Copyright (c) 2024 Dariel Cruz Rodriguez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Models
Airport()
Importing
MCO = Airport("MCO") # loads in an instance of MCO and all associated data with it
Attributes
airportid(str): The airport IATA/ICAO code (e.g., "MCO", "KATL")lastupdate(datetime): The timestamp of when the airport data was last updatedairportclosures(dict): Information about current airport closures, if anyairportdelays(dict): Details about current delays including minimum, maximum, average delay times, and reasonspossibledelays(dict): Information about potential upcoming delays
Methods
Airport.getDelays()
If you want to filter for just departure or arrival delays, use either Airport.getDepartureDelays() or Airport.getArrivalDelays().
airportcode = "MCO"
airport = Airport(airportcode)
delays = airport.getDelays()
print(delays)
# > {'Departure': {'minDelay': 31, 'maxDelay': 45, 'avgDelay': 38, 'reason': 'TM INITIATIVES:MIT:STOP&VOL'}}
# In plain language, you can access items in the dictionary to form a string.
airportcode = "MCO"
airport = Airport(airportcode)
airport.getDelays()
if airport.airportdelays is None:
print("There are no delays.")
else:
for key, value in airport.airportdelays.items():
print(f"There is a delay on {airportcode} {key}s averaging {value['avgDelay']} minutes (btwn. {value['minDelay']}-{value['maxDelay']} min) due to {value['reason']}.")
# > There is a delay on MCO Departures averaging 38 minutes (btwn. 31-45 min) due to TM INITIATIVES:MIT:STOP&VOL.
Airport.averageDelay()
airportcode = "MCO"
airport = Airport(airportcode)
print(airport.averageDelay())
# > 38.0
Airport.delayReasons()
airportcode = "PBI"
airport = Airport(airportcode)
print(airport.delayReasons())
# > "runway construction"
# This method also returns multiple reasons as a plain language string (adding 'and' at the end of the list for the last reason)
airportcode = "LGA"
airport = Airport(airportcode)
print(airport.delayReasons())
# > "runway construction, wind, and TM INITIATIVES:MIT:STOP&VOL"
Airport.isDelay()
airportcode = "MCO"
airport = Airport(airportcode)
print(airport.isDelay())
# > True
airportcode = "DEN"
airport = Airport(airportcode)
print(airport.isDelay())
# > "NAASTATUS Airport Delays is empty, attempting to refresh..."
# > False
Airport.getPossibleDelays()
airportcode = "DCA"
airport = Airport(airportcode)
print(airport.getPossibleDelays())
# > {'GROUND STOP/DELAY PROGRAM POSSIBLE': 'AFTER 1930'}
Airport.getClosures()
airportcode = "LAS"
airport = Airport(airportcode)
print(airport.getClosures())
# > [{'reason': '!LAS 03/121 LAS AD AP CLSD TO NON SKED TRANSIENT GA ACFT EXC 24HR PPR 702-261-7775 2503171851-2506252300', 'start': 'Mar 17 at 18:51 UTC.', 'reopen': 'Jun 25 at 23:00 UTC.'}]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nasstat-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nasstat-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdc99e6c3603559e7e89b134a5618e1a326799448063ff459f52c1471cd78984
|
|
| MD5 |
bc42e5734d7075bd2246afbabd822570
|
|
| BLAKE2b-256 |
c1c2b0f4c6446d73179a64b317e980fbeb2316a2302fc09c2e38969cf6cc1bbf
|