Skip to content

javiergarciaheras/AeroRoutes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AeroRoutes

Build Status GitHub GitHub release (latest by date)

AeroRoutes 🛫

AeroRoutes is a library for computing the main features of aircraft routes. It now supports loxodrome and orthodrome routes. The primary purpose is purely academic: to show students their different characteristics.

🚀 Try the Demo Notebook

An interactive Jupyter Notebook is available to demonstrate how to use AeroRoutes:

👉 Run the Demo Notebook

Binder


📖 Installation

pip install aeroroutes


## How to run the library

1. Clone or download the repository.
2. Install all the dependencies.


## How to use it

1. Create the latitude and longitude of both origin and destination. If you know only the coordinates in degrees, minutes and seconds you can use the function convert_dms_to_dec from aeroroutes.tools.

```python
from aeroroutes.tools import convert_dms_to_dec
# Madrid:
LEMD_lon = convert_dms_to_dec(3, 34, 2.47, 'W')
LEMD_lat = convert_dms_to_dec(40, 29, 37.62, 'N')
# Tokyo:
RJAA_lon = convert_dms_to_dec(140, 23, 17.66, 'E')
RJAA_lat = convert_dms_to_dec(35, 46, 24.78, 'N')
  1. Create and instance to aeroroutes.routes.ComputeOrto or aeroroutes.routes.ComputeLoxo including origin and destination lon lat as a list, also de number of legs in your route could be also defined.
from aeroroutes.routes import ComputeOrto
from aeroroutes.routes import ComputeLoxo
# Orthodrome:
ortographic = ComputeOrto([LEMD_lon, LEMD_lat], [RJAA_lon, RJAA_lat], 100)

# Loxodrome
loxodromic = ComputeLoxo([LEMD_lon, LEMD_lat], [RJAA_lon, RJAA_lat], 100)
  1. In previous object all features are already computed. You could obtain the following:
  • Route with lons and lats along all segments.
# Orthodrome:
lon_o, lat_o = ortographic.get_route()

# Loxodrome
lon_l, lat_l = loxodromic.get_route()
  • Route distances in km.
# Orthodrome:
d_o = ortographic.get_distance_km()

# Loxodrome
d_l = loxodromic.get_distance_km()
  • Arc between point in the orthodrome route.
# Orthodrome:
d_o = ortographic.get_arc_between_points()
  • Geographic track in deg.
# Orthodrome:
gamma_o = loxodromic.get_geographic_track()
  1. Finally, routes can be plotted using different projections with the funciton from aeroroutes.tools.plot_routes. The library uses matplotlib basemap ((matplotlib basemap website)). The lats and lons from the routes and the parameters for the Basemap (kwargs dictionary) are only needed. As you can see in the following examples:
  • Plot using Mercator projection. (matplotlib basemap website). Parallels, and meridians inputs are the values you want to see on the map, as a numpy array.
from aeroroutes.tools import plot_routes
import numpy as np

kwargs = {"projection": 'merc', "llcrnrlat": 20, "urcrnrlat": 80, "llcrnrlon": -20,
                  "urcrnrlon": 150, "lat_ts": 20, "resolution": 'c'}

plot_routes(ortographic.lon_deg, ortographic.lat_deg,
                    parallels=np.arange(30., 91., 30.),
                    meridians=np.arange(-10., 181., 60.), **kwargs)

plot_routes(loxodromic.lon_deg, loxodromic.lat_deg,
                    parallels=np.arange(30., 91., 30.),
                    meridians=np.arange(-10., 181., 60.), **kwargs)

  • Plot using Lamber Conformal projection. (matplotlib basemap website). Parallels, and meridians inputs are the values you want to see on the map, as a numpy array.
from aeroroutes.tools import plot_routes
import numpy as np
kwargs = {"projection": 'lcc', "width": 12000000, "height": 9000000, "rsphere": (6378137.00, 6356752.3142),
                  "resolution": 'l', "area_thresh": 1000., "lat_1": 45, "lat_2": 55, "lat_0": 50, "lon_0": 80.}

plot_routes(ortographic.lon_deg, ortographic.lat_deg,
                    parallels=np.arange(30., 91., 30.),
                    meridians=np.arange(-10., 181., 60.), **kwargs)

plot_routes(loxodromic.lon_deg, loxodromic.lat_deg,
                    parallels=np.arange(30., 91., 30.),
                    meridians=np.arange(-10., 181., 60.), **kwargs)

About

Library to compute the main features in aircraft routes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published