In [12]:
from atmPy.instruments.LAS.las_sd import LAS
from atmPy.instruments.DMA.smps import SMPS
from atmPy.instruments.DMA import dma
from atmPy import atmosphere as atm
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
import scipy as sp
from scipy import stats
from matplotlib.ticker import LogLocator
%matplotlib inline
In [2]:
las = LAS()
In [3]:
las.read_data()
In [4]:
las.convertSD()
In [5]:
# Get some SMPS data
noaaDma = dma.NoaaWide()
nSMPS = SMPS(noaaDma)
In [6]:
nSMPS.openFiles()
In [7]:
nSMPS.getLag(0,delta=5)
In [8]:
nSMPS.proc_files()
In [10]:
f,ax = plt.subplots()
for i in range(1196,1259):
p = las.dndlogdp.iloc[i,:].plot(ax = ax, logx=True, xlim=[10,1000])
p = ax.plot(nSMPS.diam_interp, nSMPS.dn_interp[0,:])
p = ax.plot(nSMPS.diam_interp, nSMPS.dn_interp[1,:])
ax.yaxis.set_minor_locator(LogLocator())
ax.yaxis.grid(which='major')
ax.yaxis.grid(which='minor')
ax.xaxis.grid(which='major')
ax.xaxis.grid(which='minor')
ax.set_xlabel('Dp (nm)')
ax.set_ylabel('dNdlogDp (cm-3 um-1)')
ax.set_title('Normalized CN concentrations')
plt.savefig('test.pdf')
In [12]:
f,ax = plt.subplots()
for i in range(1196,1259):
p = las.sd.iloc[i,:].plot(ax = ax, logx=True, xlim=[10,1000])
p = ax.plot(nSMPS.diam[0], nSMPS.cn_smoothed[0])
p = ax.plot(nSMPS.diam[1], nSMPS.cn_smoothed[1])
p = ax.plot(nSMPS.diam[0], nSMPS.cn_raw[0])
p = ax.plot(nSMPS.diam[1], nSMPS.cn_raw[1])
ax.yaxis.set_minor_locator(LogLocator())
ax.yaxis.grid(which='major')
ax.yaxis.grid(which='minor')
ax.xaxis.grid(which='major')
ax.xaxis.grid(which='minor')
ax.set_xlabel('Dp (nm)')
ax.set_ylabel('[CN] (cm-3)')
ax.set_title('CN concentrations not normalized')
plt.savefig('raw.pdf')
In [30]:
273.15/297*830/1013.25
Out[30]:
In [76]:
dist = getattr(stats, 'lognorm')
In [77]:
dist
Out[77]:
In [78]:
param = dist.fit(nSMPS.cn_raw[0])
In [89]:
mean, var, skew, kurt = dist.stats(param, moments='mvsk')
In [90]:
mean
Out[90]:
In [85]:
nSMPS.diam
# df_fitted = dist.pdf(nSMPS.diam[0], *param[:-2],loc=param[-2], scale=param[-1])*np.sum(nSMPS.cn_raw[0])
df_fitted = dist.pdf(nSMPS.diam[0], s=param)
In [84]:
param[-2]
Out[84]:
In [82]:
f,ax = plt.subplots()
ax.plot(nSMPS.diam[0], df_fitted)
ax.plot(nSMPS.diam[0], nSMPS.cn_raw[0])
ax.xaxis.set_scale('log')
In [ ]:
In [ ]:
In [ ]: