University of Wyoming flight data
In [13]:
# Load the needed packages
import numpy as np
import matplotlib.pyplot as plt
import awot
from awot.graph.common import create_basemap
from awot.graph import FlightLevel
%matplotlib inline
Supply user information
In [2]:
# Set the project name
Project="DYNAMO"
# Set the path for data file
flname="/Users/guy/data/king_air/copemed2013/flight/20130806.c1.nc"
Set up some characteristics for plotting.
In [3]:
proj = 'cea'
Wbarb_Spacing = 300 # Spacing of wind barbs along flight path (sec)
# Choose the X-axis time step (in seconds) where major labels will be
XlabStride = 3600
# Should landmarks be plotted? [If yes, then modify the section below
Lmarks=True
# Optional variables that can be included with AWOT
# Start and end times for track in Datetime instance format
start_time = "2013-08-06 00:00:00"
end_time = "2013-08-06 23:50:00"
corners = [-6.,49.,-3.,53.]
Read in flight data
In [4]:
fl = awot.io.read_netcdf(fname=flname, platform='uwka')
Create the track figure for this flight
In [14]:
fig, ax = plt.subplots(1, 1, figsize=(9, 9))
bm = create_basemap(corners=corners, proj=proj, resolution='l', area_thresh=1.,ax=ax)
# Instantiate the Flight plotting routines
flp = FlightLevel(fl, basemap=bm)
flp.plot_trackmap(
# start_time=start_time, end_time=end_time,
color_by_altitude=True, track_cmap='spectral',
min_altitude=50., max_altitude= 4000.,
addlegend=True, addtitle=True)
Let's query the flight dictionary to see what fields we have
In [6]:
fl.keys()
Out[6]:
Create figure and produce a multi-panel times series plot
In [7]:
fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, figsize=(9, 9))
flp.plot_timeseries('altitude', color='k', marker='o', msize=1.5, lw=2,
date_format='%H:%M', tz=None, xdate=True,
# date_minor_string='minute', other_major_ticks=None, other_minor_ticks=None,
# other_min=None, other_max=None,
# start_time=start_time, end_time=end_time,
# title=None, xlab=' ', ylab=' ',
ax=ax1)
flp.plot_timeseries('thetae', color='b', ax=ax2, ylab=r"${\Theta}$$_{e}$ [K]")
flp.plot_timeseries('pressure', color='k', ax=ax3)
flp.plot_timeseries('Wwind', color='r', ax=ax4, ylab="Vertical Wind")
We can also add the distance along a flight track from the following. Look at the docstrings for help, as the keys are optional and the software will search for a matching variable.
In [8]:
tg = awot.util.calc_ground_distance(fl, method='great circle', add_to_dict=True)
ta =awot.util.calc_air_distance(fl, airspeed_key='tas', add_to_dict=True)
print(fl['altitude']['data'].shape, fl['track_distance_air']['data'].shape, fl['track_distance_ground']['data'].shape)
Let's make sure that the new dictionaries were added. track_distance_ground and track_distance_air
In [9]:
fl.keys()
Out[9]:
In [10]:
print(fl['track_distance_air']['data'].min(), fl['track_distance_air']['data'].max())
print(fl['track_distance_ground']['data'].min(), fl['track_distance_ground']['data'].max())
Plot the data as a function of distance traveled in the air
In [12]:
fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, figsize=(9, 9))
flp.plot_trackseries('altitude', plot_km=True, color='k', ls='-', lw=2,
ylab='Height [m]', ax=ax1)
flp.plot_trackseries('thetae', plot_km=True, track_key='track_distance_air', color='b', ls='-',
ylab=r"${\Theta}$$_{e}$ [K]", ax=ax2)
flp.plot_trackseries('pressure', plot_km=True, track_key='track_distance_air', color='g', ls='-',
ylab='P [hpa]',ax=ax3)
flp.plot_trackseries('Wwind', plot_km=True, track_key='track_distance_air', color='r', ls='-',
ylab="W [m/s]", ax=ax4)
Plot the data as a function of distance traveled over the ground
In [13]:
fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, figsize=(9, 9))
flp.plot_trackseries('altitude', plot_km=True, track_key='track_distance_ground', color='k', ls='-', lw=2,
ylab='Height [m]', ax=ax1)
flp.plot_trackseries('thetae', plot_km=True, track_key='track_distance_ground', color='b', ls='-',
ylab=r"${\Theta}$$_{e}$ [K]", ax=ax2)
flp.plot_trackseries('pressure', plot_km=True, track_key='track_distance_ground', color='g', ls='-',
ylab='P [hpa]',ax=ax3)
flp.plot_trackseries('Wwind', plot_km=True, track_key='track_distance_ground', color='r', ls='-',
ylab="W [m/s]", ax=ax4)
In [ ]: