In [1]:
# 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 path for data file
flname="/Users/guy/data/t28/jpole/T28_JPOLE2003_800.nc"
In [32]:
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=False
# Optional variables that can be included with AWOT
# Start and end times for track in Datetime instance format
#start_time = "2003-08-06 00:00:00"
#end_time = "2003-08-06 23:50:00"
corners = [-96., 34., -98., 36.,]
Read in flight data
NOTE: At time or writing this it is required that the time_var
argument be provided to make the read function work properly. This may change in the future, but time variables are not standard even among RAF Nimbus guidelines.
In [3]:
fl = awot.io.read_netcdf(fname=flname, platform='t28', time_var="Time")
In [13]:
fl.keys()
Out[13]:
Create the track figure for this flight, there appear to be some bunk data values in lat/lon
In [34]:
print(fl['latitude']['data'].min(), fl['latitude']['data'].max())
fl['latitude']['data'][:] = np.ma.masked_equal(fl['latitude']['data'][:], 0.)
fl['longitude']['data'][:] = np.ma.masked_equal(fl['longitude']['data'][:], 0.)
print(fl['latitude']['data'].min(), fl['latitude']['data'].max())
print(fl['longitude']['data'].min(), fl['longitude']['data'].max())
print(fl['altitude']['data'].max())
In [35]:
fig, ax = plt.subplots(1, 1, figsize=(9, 9))
# Create the basemap
bm = create_basemap(corners=corners, proj=proj, resolution='l', area_thresh=1.,ax=ax)
bm.drawcounties()
# 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= 5000.,
addlegend=True, addtitle=False)
In [ ]: