The sizedistribution module contains various classes associated with sizedistributions:
All sizedistribution classes are relatives of each other with SizeDist beeing the parent. In other words SizeDist_TS and SizeDist_LS can do exactly the same things like SizeDist and a bit more.
In addition to the classes sizedistribution also contains a few usefull functions:
In [48]:
from atmPy import sizedistribution as sd
# from atmPy.instruments.POPS import housekeeping
from atmPy.instruments.piccolo import piccolo
from atmPy.tools import plt_tools
%matplotlib inline
plt_tools.setRcParams(plt)
Due to the similarity to SizeDist_TS and SizeDist_LS I will skip this class. It will show up every now and then below.
Usually a SizeDistribution is generated by reading experimental data using a module designed for the particular instrument (pick one from in atmPy.instruments). The following is a size distribution recorded using a POPS instrument.
In [49]:
dist_TS = sd.read_csv('./data/POPS_dist_TS.csv')
In [112]:
dist_TS.
Out[112]:
Current moment:
In [50]:
dist_TS.distributionType
Out[50]:
In [51]:
dist_TS = dist_TS.convert2dNdlogDp()
Now its different:
In [52]:
dist_TS.distributionType
Out[52]:
There are plenty more, just play with the auto-completion.
This can take some time.
In [53]:
out = dist_TS.fit_normal()
See effect below in the plots
All plotting functions will return matplotlib figures and axes, so further manipulation is possible. The also have a lot of optional arguments that are worth exploring.
In [54]:
out = dist_TS.plot()
In [55]:
out = dist_TS.plot_particle_concentration()
In [56]:
out = dist_TS.plot_fitres()
In [57]:
dist_TS.get_timespan()
Out[57]:
In [58]:
dt = dist_TS.zoom_time(start = '2015-04-21 08:00:00.00', end = '2015-04-21 08:10:00.00')
dt = dt.zoom_diameter(start = 150, end = 600)
out = dt.plot(fit_pos=False)
In [59]:
dt = dist_TS.average_overTime(window = '60S')
out = dt.plot(fit_pos=False)
The following will return a SizeDist instance since it is no longer a time series
In [60]:
avg = dist_TS.average_overAllTime()
out = avg.plot()
Before we can generate a layerseries we need a time series that contains information about Altitude. Furthermore we want to truncate the data to the timeperiode during which a vertical profile was taken.
In [75]:
from atmPy.instruments.Manta_payload import manta_payload
In [80]:
hk = piccolo.read_csv('./data/piccolo.log')
hk_II = manta_payload.read_csv('./data/Manta_raw.dat')
hk = hk.merge(hk_II)
spiral_up_start = '2015-04-21 08:20:54'
spiral_up_end = '2015-04-21 09:58:21'
dist_TS = dist_TS.zoom_time(spiral_up_start,spiral_up_end)
hk = hk.zoom_time(spiral_up_start,spiral_up_end)
The following will generate the SizeDist_LS instance with a layer thickness of 30 meters. (force is necessary since the Altitude time series is not monotonic)
In [81]:
dist_LS = dist_TS.convert2layerseries(hk, layer_thickness= 30, force = True)
In [82]:
out = dist_LS.fit_normal()
out = dist_LS.plot()
Hygroscopic growth can either be applied with one RH value or by using the 'Relative_humidity' column in the associated housekeeping file. We made sure that this column exist by merging the file from the manta aircraft earlier. Since the index of refraction is adjusted during the growth it is nesecarry to define that value before proceeding.
In [88]:
dist_LS.index_of_refraction = 1.455 # refractive index of the calibration material DOS
dist_LS_grown = dist_LS.apply_hygro_growth(0.5)
out = dist_LS_grown.plot(fit_pos=False)
To calculate optical properties it is again necessary to specify the refractive index, which we already did earlier.
In [99]:
wavelength = 550
opt_prop = dist_LS.calculate_optical_properties(wavelength)
In [100]:
out = opt_prop.plot_extCoeffPerLayer()
Out[100]:
In [110]:
ext = opt_prop.get_extinction_coeff_verticle_profile()
ax = ext.plot()
ax.set_title('Extinction coefficient')
Out[110]:
In [111]:
ax = opt_prop.plot_AOD_cum()
ax.set_title('Cumulative AOD')
Out[111]:
In [109]:
ax = opt_prop.asymmetry_parameter_LS.plot()
ax.set_xlabel('Altitude (m)')
ax.set_ylabel('Asymmetry parameter')
ax.set_title('Asymmetry parameter')
Out[109]:
In [ ]: