Plot flight track as matplotlib. Save as KMZ file


In [2]:
import os
import matplotlib.pyplot as plt
import numpy as np

import awot

%matplotlib inline

In [3]:
flname = os.path.join("/Users/guy/data/king_air/pecan2015", "20150716.c1.nc")
fl = awot.io.read_netcdf(fname=flname, platform='uwka')


Using 'time' to make AWOT time variable

In [4]:
print(fl['latitude']['data'].min(), fl['latitude']['data'].max())
print(fl['longitude']['data'].min(), fl['longitude']['data'].max())


(38.312962443369315, 40.138328333385964)
(-98.857612597236781, -95.338004327312788)

In [7]:
fig, ax = plt.subplots(1, 1, figsize=(9, 9))

corners = [-99., 38., -95., 40.5]
bm = awot.graph.create_basemap(corners=corners, proj='aeqd', lat_0=39., lon_0=-97, resolution='l', area_thresh=1.,ax=ax)

# Instantiate the Flight plotting routines
flp = awot.graph.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)



In [6]:
fig, ax = plt.subplots(1, 1, figsize=(9, 9))

corners = [-99., 38., -95., 40.5]
bm = awot.graph.create_basemap(corners=corners, proj='aeqd', lat_0=39., lon_0=-97, resolution='l', area_thresh=1.,ax=ax)

# Instantiate the Flight plotting routines
flp = awot.graph.FlightLevel(fl, basemap=bm)
flp.plot_trackmap(color_by_altitude=True, track_cmap='spectral',
                  min_altitude=50., max_altitude= 4000.,
#                 start_time=start_time, end_time=end_time,
                  addlegend=True, addtitle=True,
                  save_kmz=True)


********************


Writing AWOT track KMZ file:
(-98.857612597236781, -95.338004327312788)
(38.312962443369315, 40.138328333385964)
Google Earth image saved to: /Users/guy/software/python/awot/examples/awot_N2UW_RF28_altitude.kmz

********************



In [7]:
fig, ax = plt.subplots(1, 1, figsize=(9, 9))

corners = [-99., 38., -95., 40.5]
bm = awot.graph.create_basemap(corners=corners, proj='aeqd', lat_0=39., lon_0=-97, resolution='l', area_thresh=1.,ax=ax)

# Instantiate the Flight plotting routines
flp = awot.graph.FlightLevel(fl, basemap=bm)
flp.plot_trackmap(color_by_altitude=False, track_color='k',
                  min_altitude=50., max_altitude= 4000.,
#                 start_time=start_time, end_time=end_time,
                  addlegend=True, addtitle=True,
                  save_kmz=True)


********************


Writing AWOT track KMZ file:
(-98.857612597236781, -95.338004327312788)
(38.312962443369315, 40.138328333385964)
Google Earth image saved to: /Users/guy/software/python/awot/examples/awot_N2UW_RF28_altitude.kmz

********************



In [8]:
fig, ax = plt.subplots(1, 1, figsize=(9, 9))

corners = [-99., 38., -95., 40.5]
bm = awot.graph.create_basemap(corners=corners, proj='aeqd', lat_0=39., lon_0=-97, resolution='l', area_thresh=1.,ax=ax)

# Instantiate the Flight plotting routines
flp = awot.graph.FlightLevel(fl, basemap=bm)
flp.plot_trackmap_variable(field='temperature', track_cmap='spectral',
                  min_altitude=50., max_altitude= 4000.,
#                 start_time=start_time, end_time=end_time,
                  addlegend=True, addtitle=True,
                  save_kmz=True, kmz_filename='test_kmz2.kmz')


********************


Writing AWOT track KMZ file:
(-98.857612597236781, -95.338004327312788)
(38.312962443369315, 40.138328333385964)
Google Earth image saved to: /Users/guy/software/python/awot/examples/test_kmz2.kmz

********************



In [ ]: