Notice: This library is still under heavy development. Features and APIs may change.
FlightPandas is a Python library for processing, analyzing, and visualizing flight trajectory data using Pandas and GeoPandas. It provides an intuitive interface for working with individual flights, grouped flight data, and time series operations.
- Time Series Handling: Resample and interpolate flight trajectory data efficiently.
- Geospatial Support: Seamless integration with GeoPandas for handling spatial data.
- Flight Trajectory Representation: Convert point data into LineString geometries.
- Group Operations: Manage and analyze grouped flight trajectories.
- Custom Splitters: Extend functionality with modules for splitting flights and observations.
pip install flightpandas
- Clone the repository:
git clone https://github.com/your_username/flightpandas.git cd flightpandas
- Install the library:
pip install .
from flightpandas import FlightCollection, RDP
import pandas as pd
# Sample DataFrame
data = {
"flight_id": [1, 1, 2, 2],
"time": pd.date_range("2024-01-01", periods=4, freq="5min"),
"lat": [10, 20, 30, 40],
"lon": [100, 110, 120, 130],
}
df = pd.DataFrame(data).set_index("time")
# Create a FlightCollection
group = FlightCollection(df, keys="flight_id", time="time", lat="lat", lon="lon")
# Get the first flight
flight = group.flights[0]
print('Flight 0: ', flight)
# Resample the data
resampled = flight.resample(freq='10s', method='linear')
print('Flight 0 resampled: ', resampled)
# Simplify the first flight
simplified = RDP(resampled, tolerance=0.01).eval()
print('Flight 0 simplified: ', simplified)
from flightpandas import FlightCollection, RDP
import pandas as pd
# Sample DataFrame
data = {
"flight_id": [1, 1, 2, 2],
"time": pd.date_range("2024-01-01", periods=4, freq="5min"),
"lat": [10, 20, 30, 40],
"lon": [100, 110, 120, 130],
}
df = pd.DataFrame(data).set_index("time")
# Create a FlightCollection
collection = FlightCollection(df, keys="flight_id", time="time", lat="lat", lon="lon")
# Resample the data
resampled = collection.resample(freq='10s', method='linear')
# Iterate over the resampled data
for key, flight in resampled:
print(f"Key: {key}")
print(flight)
The library is structured as follows:
base.py
: Core functionality for trajectory data management.flight.py
: Methods for individual flight trajectory analysis.flight_group.py
: Operations on grouped flight trajectories.plotter.py
:simplifier.py
:splitter
: Utilities for splitting flight data based on criteria.
Base
: Foundation for managing trajectory data.Flight
: Represents individual flight trajectories.FlightCollection
: Handles groups of flight trajectories.
- Resample and Interpolate: Handle time-series data with methods like
.resample(freq)
.
You can find the full documentation here.
- Pandas
- GeoPandas
- Shapely
Install dependencies using:
pip install pandas geopandas shapely
Contributions are welcome! To get started:
- Fork the repository.
- Create a new branch for your feature/bugfix:
git checkout -b feature-name
- Commit your changes and submit a pull request.
This project is licensed under the BSD-3-Clause License. See the LICENSE.txt file for details.
Special thanks to the contributors and the open-source community for making this library possible.
For questions or support, please open an issue on the GitHub repository.