%pylab inline
Populating the interactive namespace from numpy and matplotlib
import FPIDisplay
from datetime import datetime, timedelta
import FPIprocess
from matplotlib import dates
import fpiinfo
import FPI
reload(FPI)
/usr/lib/pymodules/python2.7/matplotlib/__init__.py:1173: UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time. warnings.warn(_use_error_msg)
<module 'FPI' from '/home/bhardin2/SourceCode/FPI.pyc'>
12 Feb 2015
######################################################################################
instr_name = 'minime08'
year = 2013
doy = 151
######################################################################################
r = FPIprocess.load_level0(instr_name, year, doy)
fpir = r['FPI_Results']
site = r['site']
direction = fpir['direction']
LOSwind = fpir['LOSwind']
sigma_LOSwind = fpir['sigma_LOSwind']
T = fpir['T']
sigma_T = fpir['sigma_T']
I = fpir['skyI']/fpir['sky_intT']
sky_times = fpir['sky_times']
skyI = fpir['skyI']
skyB = fpir['skyB']
sigma_skyI = fpir['sigma_skyI']
intT = fpir['sky_intT']
cloud = None
if fpir['Clouds']:
cloud = fpir['Clouds']['mean']
print sky_times[0]
plot(sky_times, cloud, 'k.-')
xlabel('UT')
ylabel('Cloud Parameter (Sky-Amb) [K]')
plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%H'))
title('%s_%s_%s' % (instr_name,year,doy))
2013-05-31 21:54:03-04:00
<matplotlib.text.Text at 0x7f16cfb2b590>
from IPython.display import Image
Image(url='http://airglow.ece.illinois.edu/Data/SummaryImages/minime08_ann_20130531_winds.png')
######################################################################################
instr_name = 'minime05'
year = 2013
doy = 7
######################################################################################
r = FPIprocess.load_level0(instr_name, year, doy)
fpir = r['FPI_Results']
site = r['site']
direction = fpir['direction']
LOSwind = fpir['LOSwind']
sigma_LOSwind = fpir['sigma_LOSwind']
T = fpir['T']
sigma_T = fpir['sigma_T']
I = fpir['skyI']/fpir['sky_intT']
sky_times = fpir['sky_times']
skyI = fpir['skyI']
skyB = fpir['skyB']
sigma_skyI = fpir['sigma_skyI']
intT = fpir['sky_intT']
cloud = None
if fpir['Clouds']:
cloud = fpir['Clouds']['mean']
from matplotlib import dates
fig = figure(figsize=(6,6))
ax = subplot(211)
dref, drefe = FPI.DopplerReference(fpir, reference='laser')
LOSwind_ref = LOSwind - dref
for direc in ['Zenith']:
I = np.array([si for (si,d) in zip(LOSwind_ref, direction) if d == direc])
Ie = np.array([si for (si,d) in zip(sigma_LOSwind, direction) if d == direc])
t = np.array([si for (si,d) in zip(sky_times, direction) if d == direc])
ax.errorbar(t, I, yerr=Ie, fmt='.-', label=direc)
ax.set_xlim([sky_times[0] - timedelta(hours=0.5), sky_times[-1] + timedelta(hours=0.5)])
ax.set_ylim((prctile(LOSwind,5)-100,prctile(LOSwind,95)+100))
ax.xaxis.set_major_formatter(dates.DateFormatter('%H'))
ax.set_ylabel('Vertical Wind, [m/s]')
ax.set_xlabel('Universal Time')
ax.legend(loc='best', prop={'size':8}, numpoints=1, ncol=5)
ax.grid(True)
ax.set_ylim((-200,200))
from matplotlib import dates
param = 't'
ax = fig.add_subplot(212)
ax.errorbar(fpir['laser_times'], fpir['laser_value'][param], yerr=fpir['laser_stderr'][param], fmt='k')
ax.set_xlim([sky_times[0] - timedelta(hours=0.5), sky_times[-1] + timedelta(hours=0.5)])
ax.xaxis.set_major_formatter(dates.DateFormatter('%H'))
ax.set_ylabel('Etalon Gap [m]')
ax.set_xlabel('Universal Time')
ax.grid(True)
def quality_flags():
# Set Flags (Order is Important)
t_flag = 0 # default
w_flag = 0 # default
if (reference == 'zenith'): # Zenith Processing ### TODO Caution if cloudy ( if -999. aka no cloud sensor)
t_flag = 1
w_flag = 1
if (a_dt > cloudthreshold or _np.isnan(a_dt)): # If cloudy or sensor is giving bad reading
# TODO: Zenith wind could still be useful too?
# TODO: AIRGLOW INTENSITY CHECK
# TODO: w_flag = 1 when -30 to -25 ? RETHINK
t_flag = 1
w_flag = 2
if (a_e_w > winderrorlimit):
w_flag = 2
if (a_e_t > temperrorlimit):
t_flag = 2
if drift_flag:
w_flag = 2
if t_flag_manual:
t_flag = max(t_flag,t_flag_manual)
if w_flag_manual:
w_flag = max(w_flag,w_flag_manual)
print '[[click for code]]'
[[click for code]]
import subprocess
import shutil
nb_name = 'FPI_Quality_Issues.ipynb' # There's probably a way to get this programmatically
cmd = ['ipython', 'nbconvert', '--to', 'slides', nb_name, \
'--reveal-prefix', '"http://cdn.jsdelivr.net/reveal.js/2.6.2"',\
'--template','output_toggle']
# The --template command points to a custom template which opens and closes the input code cells with a click
subprocess.call(cmd)
html_name = '%s.slides.html' % (nb_name.split('.')[0])
shutil.copy(html_name, '/home/bhardin2/public_html/slideshows/')
print '(click to reveal code)'
(click to reveal code)