# In[73]:


meas = Sp.Sp(m)
meas.params()


# # Now plot the measurements and luts

# ## Plot all measurements

# In[85]:


pz = Sp.plt_zenrad(meas,good_only=True)


# In[86]:


pn = Sp.plt_norm_zenrad(meas,good_only=True)


# In[87]:


pc = Sp.curtain_zenrad(meas)


# In[90]:
cba.set_label('UTC [h]')
plt.ylim(0,1)
plt.xlim(340,1750)
plt.title('SASZe normalized spectra, Ascension Island, 2016-08-14')
plt.xlabel('Wavelength [nm]')
plt.ylabel('Normalized Radiance')
plt.tight_layout()
#plt.plot(lut.wvl,lut.norm[0,:,0,8,20],'k-',lw=3,
#         label='Modeled, $\\tau$={:2.1f}, r$_{{eff}}$={:2.0f}$\\mu$m'.format(lut.tau[20],lut.ref[8]))
plt.plot(lut.wvl,lut.norm[0,:,0,4,16],'-',color='k',lw=3,alpha=0.8,
         label='Modeled, $\\tau$={:2.1f}, r$_{{eff}}$={:2.0f}$\\mu$m'.format(lut.tau[16],lut.ref[4]))
plt.plot(lut.wvl,lut.norm[0,:,0,4,1],'-',color='lightgrey',lw=3,alpha=0.8,
         label='Modeled, $\\tau$={:2.1f}, r$_{{eff}}$={:2.0f}$\\mu$m'.format(lut.tau[1],lut.ref[4]))
plt.legend(handletextpad=0.08,labelspacing=0.05,frameon=True)
plt.savefig(fp+'data/SASZe_sample_spectra_with_model.png',dpi=600,transparent=True)


# In[184]:


fig = sp.plt_zenrad(sr)
plt.ylim(0,0.5)
#plt.figure()


# In[253]:


sp.plt_norm_zenrad(sr)

# In[ ]:


print 'Running the parameter calculations on measured spectra'
meas = Sp.Sp(mea,verbose=False)
meas.params()


# ### plot out the different spectra

# In[ ]:


if not noplot:
    print('Making plots...')
    fig1 = Sp.plt_zenrad(meas)
    fig1.savefig(fp_zencld_plot+'{datestr}_zenrad.png'.format(datestr=datestr),
                 dpi=600,transparent=True)
    print('zenrad...'),

    fig1n = Sp.plt_norm_zenrad(meas)
    fig1n.savefig(fp_zencld_plot+'{datestr}_norm_zenrad.png'.format(datestr=datestr),
                  dpi=600,transparent=True)
    print('norm zenrad...'),

    fig2 = Sp.curtain_zenrad(meas,utc=True)
    fig2.savefig(fp_zencld_plot+'{datestr}_curtain_utc_zenrad.png'.format(datestr=datestr),
                 dpi=600,transparent=True)
    print('utc curtain zenrad...'),

    fig2n = Sp.curtain_norm_zenrad(meas,utc=True)