In [2]:
import os
import matplotlib.pyplot as plt
import numpy as np
import awot
%matplotlib inline
Open file for processing
In [3]:
flname = os.path.join("/Users/guy/data/king_air/pecan2015", "20150716.c1.nc")
fl = awot.io.read_netcdf(fname=flname, platform='uwka')
In [4]:
print(fl['latitude']['data'].min(), fl['latitude']['data'].max())
print(fl['longitude']['data'].min(), fl['longitude']['data'].max())
Plot flight track
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)
By setting the keyword save_kmz, a KMZ file can be created. Note that this method can sometimes cause distorted images to be displayed on Google Earth.
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)
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)
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')
Now with another file, we can save a KML file directly.
In [3]:
fl0620 = os.path.join("/Users/guy/data/king_air/pecan2015", "20150620b.c1.nc")
fl = awot.io.read_netcdf(fname=fl0620, platform='uwka')
In [4]:
awot.util.write_line_kml(fl, 'altitude', file_path="/Users/guy/Desktop")
In [ ]: