"""
Author: M. Graham Macy
Created: 7/29/2024
Edited: 8/5/2024

Description:
Contains functions that plot data from
running fleet operations

"""

import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

    
def plot_rand_flights(data): 
    # This is a plot of the US
    map = Basemap(
            llcrnrlon=-120,
            llcrnrlat=15,
            urcrnrlon=-50,
            urcrnrlat=50,
            lon_0=-85,
            lat_0=32.5,
            resolution='c',  # c means "crude" resolution
            projection='cass'
        )

    for i in range(len(data.aclat)-1):
           map.plot(
            [data.aclon[i],data.aclon[i+1]],
            [data.aclat[i],data.aclat[i+1]],
            latlon=True
            )
    map.drawcoastlines()
    map.drawstates()
    map.drawcountries()
    plt.xlabel('Longitude')
    plt.ylabel('Latitude')
    plt.title('Aircraft location history')
    plt.show()

def plot_avgEGTM(data):
      
    plt.plot(data.avg_fleet_EGTM, ".r")
    plt.xlabel('Days since Jan 1st')
    plt.ylabel('Avg Fleet EGTM deg C')
    plt.title('Average Fleet EGTM')
    plt.show()
    