AeroViz 0.1.4__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of AeroViz might be problematic. Click here for more details.
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Chemistry/__init__.py +21 -20
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Chemistry/_isoropia.py +9 -12
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Chemistry/_mass_volume.py +4 -3
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Chemistry/_ocec.py +20 -45
- aeroviz-0.1.6/AeroViz/dataProcess/Chemistry/isrpia2.exe +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Optical/_IMPROVE.py +2 -3
- aeroviz-0.1.6/AeroViz/dataProcess/Optical/fRH.pkl +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/SizeDistr/__init__.py +6 -10
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/VOC/__init__.py +1 -6
- aeroviz-0.1.6/AeroViz/dataProcess/VOC/_potential_par.py +108 -0
- aeroviz-0.1.4/AeroViz/dataProcess/VOC/voc_par.json → aeroviz-0.1.6/AeroViz/dataProcess/VOC/support_voc.json +321 -339
- aeroviz-0.1.6/AeroViz/rawDataReader/__init__.py +110 -0
- aeroviz-0.1.6/AeroViz/rawDataReader/config/supported_instruments.py +147 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/core/__init__.py +113 -98
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/AE33.py +3 -3
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/AE43.py +2 -2
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/APS_3321.py +4 -4
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/Aurora.py +5 -2
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/BC1054.py +2 -2
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/EPA_vertical.py +2 -2
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/GRIMM.py +4 -4
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/IGAC.py +2 -2
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/MA350.py +2 -2
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/Minion.py +2 -2
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/NEPH.py +9 -14
- aeroviz-0.1.4/AeroViz/rawDataReader/script/Sunset_OCEC.py → aeroviz-0.1.6/AeroViz/rawDataReader/script/OCEC.py +24 -18
- aeroviz-0.1.6/AeroViz/rawDataReader/script/SMPS.py +76 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/TEOM.py +2 -2
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/Table.py +3 -3
- aeroviz-0.1.6/AeroViz/rawDataReader/script/VOC.py +33 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/script/__init__.py +2 -4
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz.egg-info/PKG-INFO +13 -10
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz.egg-info/SOURCES.txt +5 -5
- aeroviz-0.1.6/AeroViz.egg-info/requires.txt +9 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/MANIFEST.in +4 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/PKG-INFO +13 -10
- {aeroviz-0.1.4 → aeroviz-0.1.6}/README.md +3 -1
- {aeroviz-0.1.4 → aeroviz-0.1.6}/requirements.txt +2 -1
- aeroviz-0.1.6/setup.py +28 -0
- aeroviz-0.1.4/AeroViz/dataProcess/VOC/_potential_par.py +0 -74
- aeroviz-0.1.4/AeroViz/rawDataReader/__init__.py +0 -63
- aeroviz-0.1.4/AeroViz/rawDataReader/config/supported_instruments.py +0 -155
- aeroviz-0.1.4/AeroViz/rawDataReader/script/SMPS_TH.py +0 -41
- aeroviz-0.1.4/AeroViz/rawDataReader/script/SMPS_aim11.py +0 -51
- aeroviz-0.1.4/AeroViz/rawDataReader/script/SMPS_genr.py +0 -51
- aeroviz-0.1.4/AeroViz/rawDataReader/script/VOC.py +0 -26
- aeroviz-0.1.4/AeroViz.egg-info/requires.txt +0 -8
- aeroviz-0.1.4/setup.py +0 -35
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/data/DEFAULT_DATA.csv +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/data/DEFAULT_PNSD_DATA.csv +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Chemistry/_calculate.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Chemistry/_partition.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Chemistry/_teom.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Chemistry/isrpia.cnf +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Optical/Angstrom_exponent.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Optical/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Optical/_absorption.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Optical/_extinction.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Optical/_mie.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Optical/_mie_sd.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/Optical/_scattering.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/SizeDistr/__merge.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/SizeDistr/_merge.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/SizeDistr/_merge_v1.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/SizeDistr/_merge_v2.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/SizeDistr/_merge_v3.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/SizeDistr/_merge_v4.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/SizeDistr/_size_distr.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/dataProcess/core/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/bar.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/box.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/distribution/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/distribution/distribution.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/meteorology/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/meteorology/meteorology.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/optical/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/optical/optical.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/pie.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/regression.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/scatter.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/templates/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/templates/ammonium_rich.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/templates/contour.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/templates/corr_matrix.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/templates/diurnal_pattern.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/templates/koschmieder.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/templates/metal_heatmap.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/timeseries/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/timeseries/template.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/timeseries/timeseries.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/utils/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/utils/_color.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/utils/_unit.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/utils/fRH.json +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/utils/plt_utils.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/utils/sklearn_utils.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/utils/units.json +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/plot/violin.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/core/DataProc.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/core/SizeDist.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/core/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/method/PyMieScatt_update.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/method/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/method/mie_theory.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/method/prop.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/AbstractDistCalc.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/Chemical.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/IMPACT.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/IMPROVE.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/Others.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/PSD.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/PSD_dry.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/process/script/retrieve_RI.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/rawDataReader/config/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/tools/__init__.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/tools/database.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/tools/dataclassifier.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/tools/dataprinter.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz/tools/datareader.py +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz.egg-info/dependency_links.txt +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/AeroViz.egg-info/top_level.txt +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/LICENSE +0 -0
- {aeroviz-0.1.4 → aeroviz-0.1.6}/setup.cfg +0 -0
|
@@ -1,40 +1,42 @@
|
|
|
1
1
|
from ..core import Writer, run_process
|
|
2
2
|
|
|
3
|
-
__all__ = [
|
|
4
|
-
|
|
5
|
-
'Chemistry',
|
|
6
|
-
|
|
7
|
-
]
|
|
3
|
+
__all__ = ['Chemistry']
|
|
8
4
|
|
|
9
5
|
|
|
10
6
|
class Chemistry(Writer):
|
|
11
|
-
|
|
12
|
-
## Reconstruction
|
|
7
|
+
# Reconstruction
|
|
13
8
|
@run_process('Chemistry - reconstruction basic', 'reconstrc_basic')
|
|
14
|
-
def ReConstrc_basic(self, *df_chem, df_ref=None, df_water=None, df_density=None,
|
|
15
|
-
nam_lst=['NH4+', 'SO42-', 'NO3-', 'Fe', 'Na+', 'OC', 'EC']):
|
|
9
|
+
def ReConstrc_basic(self, *df_chem, df_ref=None, df_water=None, df_density=None, nam_lst=None):
|
|
16
10
|
from ._mass_volume import _basic
|
|
17
11
|
|
|
12
|
+
if nam_lst is None:
|
|
13
|
+
nam_lst = ['NH4+', 'SO42-', 'NO3-', 'Fe', 'Na+', 'OC', 'EC']
|
|
14
|
+
|
|
18
15
|
out = _basic(df_chem, df_ref, df_water, df_density, nam_lst=nam_lst)
|
|
19
16
|
|
|
20
17
|
return self, out
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
# Partition
|
|
23
20
|
@run_process('Chemistry - Partition', 'partition')
|
|
24
|
-
def Partition(self, *df_chem, nam_lst=
|
|
21
|
+
def Partition(self, *df_chem, nam_lst=None):
|
|
25
22
|
from ._partition import _basic
|
|
26
23
|
|
|
24
|
+
if nam_lst is None:
|
|
25
|
+
nam_lst = ['NH4+', 'SO42-', 'NO3-', 'Cl-', 'NO2', 'HNO3', 'SO2', 'NH3', 'HCl', 'temp']
|
|
26
|
+
|
|
27
27
|
out = _basic(df_chem, nam_lst=nam_lst)
|
|
28
28
|
|
|
29
29
|
return self, out
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
# ISOROPIA
|
|
32
32
|
@run_process('Chemistry - ISOROPIA', 'isoropia')
|
|
33
|
-
def ISOROPIA(self, *df_chem,
|
|
34
|
-
nam_lst=['Na+', 'SO42-', 'NH4+', 'NO3-', 'Cl-', 'Ca2+', 'K+', 'Mg2+', 'NH3', 'HNO3', 'HCl', 'RH',
|
|
35
|
-
'temp']):
|
|
33
|
+
def ISOROPIA(self, *df_chem, nam_lst=None):
|
|
36
34
|
from ._isoropia import _basic
|
|
37
35
|
|
|
36
|
+
if nam_lst is None:
|
|
37
|
+
nam_lst = ['Na+', 'SO42-', 'NH4+', 'NO3-', 'Cl-', 'Ca2+',
|
|
38
|
+
'K+', 'Mg2+', 'NH3', 'HNO3', 'HCl', 'RH', 'temp']
|
|
39
|
+
|
|
38
40
|
if self.path_out is None:
|
|
39
41
|
raise ValueError('Please Input "path_out" !!')
|
|
40
42
|
|
|
@@ -42,18 +44,17 @@ class Chemistry(Writer):
|
|
|
42
44
|
|
|
43
45
|
return self, out
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
# OCEC
|
|
46
48
|
@run_process('Chemistry - OC/EC basic', 'ocec_basic')
|
|
47
|
-
def OCEC_basic(self, df_lcres,
|
|
49
|
+
def OCEC_basic(self, df_lcres, df_mass=None, ocec_ratio=None, ocec_ratio_month=1, hr_lim=200,
|
|
48
50
|
least_square_range=(0.1, 2.5, 0.1), WISOC_OC_range=(0.2, 0.7, 0.01), ):
|
|
49
51
|
from ._ocec import _basic
|
|
50
52
|
|
|
51
|
-
out = _basic(df_lcres,
|
|
52
|
-
WISOC_OC_range)
|
|
53
|
+
out = _basic(df_lcres, df_mass, ocec_ratio, ocec_ratio_month, hr_lim, least_square_range, WISOC_OC_range)
|
|
53
54
|
|
|
54
55
|
return self, out
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
# TEOM
|
|
57
58
|
@run_process('Chemistry - TEOM basic', 'teom_basic')
|
|
58
59
|
def TEOM_basic(self, df_teom, df_check=None):
|
|
59
60
|
from ._teom import _basic
|
|
@@ -7,9 +7,6 @@ from pandas import concat, DataFrame, to_numeric, read_csv
|
|
|
7
7
|
from ._calculate import _ug2umol
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
# TODO: fix isoropia2.exe can not run
|
|
11
|
-
|
|
12
|
-
|
|
13
10
|
def _basic(df_che, path_out, nam_lst):
|
|
14
11
|
# parameter
|
|
15
12
|
df_all = concat(df_che, axis=1)
|
|
@@ -18,8 +15,8 @@ def _basic(df_che, path_out, nam_lst):
|
|
|
18
15
|
|
|
19
16
|
df_umol = _ug2umol(df_all)
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
# output
|
|
19
|
+
# Na, SO4, NH3, NO3, Cl, Ca, K, Mg, RH, TEMP
|
|
23
20
|
df_input = DataFrame(index=index)
|
|
24
21
|
df_out = DataFrame(index=index)
|
|
25
22
|
|
|
@@ -29,25 +26,25 @@ def _basic(df_che, path_out, nam_lst):
|
|
|
29
26
|
pth_input.unlink(missing_ok=True)
|
|
30
27
|
pth_output.unlink(missing_ok=True)
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
# header
|
|
33
30
|
_header = 'Input units (0=umol/m3, 1=ug/m3)\n' + '0\n\n' + \
|
|
34
31
|
'Problem type (0=forward, 1=reverse); Phase state (0=solid+liquid, 1=metastable)\n' + '0, 1\n\n' + \
|
|
35
32
|
'NH4-SO4 system case\n'
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
# software
|
|
38
35
|
path_iso = Path(__file__).parent / 'isrpia2.exe'
|
|
39
36
|
|
|
40
37
|
# make input file and output temp input (without index)
|
|
41
|
-
|
|
38
|
+
# NH3
|
|
42
39
|
df_input['NH3'] = df_umol['NH4+'].fillna(0).copy() + df_umol['NH3']
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
# NO3
|
|
45
42
|
df_input['NO3'] = df_umol['HNO3'].fillna(0).copy() + df_umol['NO3-']
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
# Cl
|
|
48
45
|
df_input['Cl'] = df_umol['HCl'].fillna(0).copy() + df_umol['Cl-']
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
# temp, RH
|
|
51
48
|
df_input['RH'] = df_all['RH'] / 100
|
|
52
49
|
df_input['TEMP'] = df_all['temp'] + 273.15
|
|
53
50
|
|
|
@@ -55,7 +52,7 @@ def _basic(df_che, path_out, nam_lst):
|
|
|
55
52
|
|
|
56
53
|
df_input = df_input[['Na', 'SO4', 'NH3', 'NO3', 'Cl', 'Ca', 'K', 'Mg', 'RH', 'TEMP']].fillna('-').copy()
|
|
57
54
|
|
|
58
|
-
|
|
55
|
+
# output the input data
|
|
59
56
|
df_input.to_csv(pth_input, index=False)
|
|
60
57
|
with (pth_input).open('r+', encoding='utf-8', errors='ignore') as _f:
|
|
61
58
|
_cont = _f.read()
|
|
@@ -2,13 +2,14 @@ from pandas import concat, DataFrame
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
5
|
+
|
|
5
6
|
df_all = concat(df_che, axis=1)
|
|
6
7
|
index = df_all.index.copy()
|
|
7
8
|
df_all.columns = nam_lst
|
|
8
9
|
|
|
9
10
|
# parameter
|
|
10
11
|
mol_A, mol_S, mol_N = df_all['NH4+'] / 18, df_all['SO42-'] / 96, df_all['NO3-'] / 62
|
|
11
|
-
df_all['status'] =
|
|
12
|
+
df_all['status'] = mol_A / (2 * mol_S + mol_N)
|
|
12
13
|
|
|
13
14
|
convert_nam = {'AS': 'SO42-',
|
|
14
15
|
'AN': 'NO3-',
|
|
@@ -92,7 +93,7 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
92
93
|
df_mass['total'] = df_mass.sum(axis=1, min_count=6)
|
|
93
94
|
|
|
94
95
|
qc_ratio = df_mass['total'] / df_ref
|
|
95
|
-
qc_cond = (qc_ratio >= 0.
|
|
96
|
+
qc_cond = (qc_ratio >= 0.5) & (qc_ratio <= 1.5)
|
|
96
97
|
|
|
97
98
|
# volume
|
|
98
99
|
df_vol = DataFrame()
|
|
@@ -153,7 +154,7 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
153
154
|
out.update(ri_dic)
|
|
154
155
|
|
|
155
156
|
for _ky, _df in out.items():
|
|
156
|
-
out[_ky] = _df.reindex(index)
|
|
157
|
+
out[_ky] = _df.reindex(index)
|
|
157
158
|
|
|
158
159
|
return out
|
|
159
160
|
|
|
@@ -16,7 +16,7 @@ def _min_Rsq(_oc, _ec, _rng):
|
|
|
16
16
|
|
|
17
17
|
_out_table = DataFrame(_oc_mesh - _val_mesh * _ec_mesh, index=_oc.index, columns=_rng)
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# calculate R2
|
|
20
20
|
_r2_dic = {}
|
|
21
21
|
_func = lambda _x, _sl, _inte: _sl * _x + _inte
|
|
22
22
|
for _ocec, _out in _out_table.items():
|
|
@@ -30,28 +30,28 @@ def _min_Rsq(_oc, _ec, _rng):
|
|
|
30
30
|
|
|
31
31
|
_r2_dic[round(_ocec, 3)] = 1. - _rss / _tss
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
# get the min R2
|
|
34
34
|
_ratio = DataFrame(_r2_dic, index=[0]).idxmin(axis=1).values[0]
|
|
35
35
|
|
|
36
36
|
return _ratio, _out_table[_ratio]
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
def _ocec_ratio_cal(_nam, _lcres_splt, _hr_lim, _range_, _wisoc_range_):
|
|
40
|
-
|
|
40
|
+
# parameter
|
|
41
41
|
_out = DataFrame(index=_lcres_splt.index)
|
|
42
42
|
(_, _oc), (_, _ec) = _lcres_splt.items()
|
|
43
43
|
# _oc, _ec = _lcres_splt['Thermal_OC'], _lcres_splt['Thermal_EC']
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
# real data OC/EC
|
|
46
46
|
_ocec_ratio_real = (_oc / _ec).quantile(.5)
|
|
47
47
|
|
|
48
48
|
_out[f'OC/EC_real_{_nam}'] = _ocec_ratio_real
|
|
49
49
|
_out[f'POC_real_{_nam}'] = _ocec_ratio_real * _ec
|
|
50
50
|
_out[f'SOC_real_{_nam}'] = _oc - _out[f'POC_real_{_nam}']
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if
|
|
52
|
+
# the least R2 method
|
|
53
|
+
# estimated OC/EC
|
|
54
|
+
if len(_lcres_splt) <= _hr_lim:
|
|
55
55
|
print(f"\t\t{_lcres_splt.index[0].strftime('%Y-%m-%d %X')} to {_lcres_splt.index[-1].strftime('%Y-%m-%d %X')}")
|
|
56
56
|
print('\t\tPlease Modify the Values of "hour_limit" or Input Sufficient Amount of Data !!')
|
|
57
57
|
|
|
@@ -60,13 +60,13 @@ def _ocec_ratio_cal(_nam, _lcres_splt, _hr_lim, _range_, _wisoc_range_):
|
|
|
60
60
|
|
|
61
61
|
return _out
|
|
62
62
|
|
|
63
|
-
if
|
|
63
|
+
if len(_lcres_splt.dropna()) == 0:
|
|
64
64
|
_out[[f'OC/EC_{_nam}', f'POC_{_nam}', f'SOC_{_nam}', f'WISOC/OC_{_nam}', f'WSOC_{_nam}',
|
|
65
65
|
f'WISOC_{_nam}']] = np.nan
|
|
66
66
|
|
|
67
67
|
return _out
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
# OC/EC
|
|
70
70
|
_ocec_ratio = False
|
|
71
71
|
_st, _ed, _stp = _range_
|
|
72
72
|
|
|
@@ -78,12 +78,12 @@ def _ocec_ratio_cal(_nam, _lcres_splt, _hr_lim, _range_, _wisoc_range_):
|
|
|
78
78
|
|
|
79
79
|
_ocec_ratio, _soc = _min_Rsq(_oc, _ec, _ocec_rng)
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
# WISOC
|
|
82
82
|
_st, _ed, _stp = _wisoc_range_
|
|
83
83
|
_wisoc_rng = (np.arange(_st, _ed + _stp, _stp) * _ocec_ratio).round(5)
|
|
84
84
|
_wisoc_ratio, _wsoc = _min_Rsq(_oc, _ec, _wisoc_rng)
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
# out
|
|
87
87
|
_out[f'OC/EC_{_nam}'] = _ocec_ratio
|
|
88
88
|
_out[f'SOC_{_nam}'] = _soc
|
|
89
89
|
_out[f'POC_{_nam}'] = _oc - _out[f'SOC_{_nam}']
|
|
@@ -95,15 +95,16 @@ def _ocec_ratio_cal(_nam, _lcres_splt, _hr_lim, _range_, _wisoc_range_):
|
|
|
95
95
|
f'OC/EC_real_{_nam}', f'POC_real_{_nam}', f'SOC_real_{_nam}']]
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
def _basic(_lcres,
|
|
99
|
-
_lcres,
|
|
98
|
+
def _basic(_lcres, _mass, _ocec_ratio, _ocec_ratio_month, _hr_lim, _range, _wisoc_range):
|
|
99
|
+
_lcres, _mass = union_index(_lcres, _mass)
|
|
100
100
|
|
|
101
101
|
_out = {}
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
_df_bsc =
|
|
103
|
+
# OC1, OC2, OC3, OC4, PC
|
|
104
|
+
_df_bsc = _lcres[['OC1_raw', 'OC2_raw', 'OC3_raw', 'OC4_raw']] / _lcres['Sample_Volume'].to_frame().values.copy()
|
|
105
|
+
_df_bsc.rename(columns={'OC1_raw': 'OC1', 'OC2_raw': 'OC2', 'OC3_raw': 'OC3', 'OC4_raw': 'OC4'}, inplace=True)
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
# SOC, POC, OC/EC
|
|
107
108
|
if _ocec_ratio is not None:
|
|
108
109
|
try:
|
|
109
110
|
iter(_ocec_ratio)
|
|
@@ -126,7 +127,7 @@ def _basic(_lcres, _res, _mass, _ocec_ratio, _ocec_ratio_month, _hr_lim, _range,
|
|
|
126
127
|
|
|
127
128
|
_df_bsc = concat((_df_bsc.copy(), _prcs_df), axis=1)
|
|
128
129
|
|
|
129
|
-
|
|
130
|
+
# ratio
|
|
130
131
|
_df_ratio = DataFrame(index=_df_bsc.index)
|
|
131
132
|
|
|
132
133
|
for _ky, _val in _df_bsc.items():
|
|
@@ -144,41 +145,15 @@ def _basic(_lcres, _res, _mass, _ocec_ratio, _ocec_ratio_month, _hr_lim, _range,
|
|
|
144
145
|
_df_ratio[f'Optical_OC/PM'] = _lcres['Optical_OC'] / _mass
|
|
145
146
|
_df_ratio[f'Optical_EC/PM'] = _lcres['Optical_EC'] / _mass
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
# ratio status
|
|
148
149
|
_df_bsc = concat((_lcres, _df_bsc.copy()), axis=1)
|
|
149
150
|
|
|
150
151
|
for _ky, _df in _df_ratio.items():
|
|
151
152
|
_df_bsc[f'{_ky}_status'] = 'Normal'
|
|
152
153
|
_df_bsc[f'{_ky}_status'] = _df_bsc[f'{_ky}_status'].mask(_df > 1, 'Warning')
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
# out
|
|
155
156
|
_out['ratio'] = _df_ratio
|
|
156
157
|
_out['basic'] = _df_bsc
|
|
157
158
|
|
|
158
159
|
return _out
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
'''
|
|
162
|
-
_ocec_mesh, _oc_mesh = n.meshgrid(_ocec_rng, _oc)
|
|
163
|
-
_ocec_mesh, _ec_mesh = n.meshgrid(_ocec_rng, _ec)
|
|
164
|
-
|
|
165
|
-
_soc_table = DataFrame(_oc_mesh-_ocec_mesh*_ec_mesh, index=_oc.index, columns=_ocec_rng)
|
|
166
|
-
|
|
167
|
-
## calculate R2
|
|
168
|
-
_r2_dic = {}
|
|
169
|
-
_func = lambda _x, _sl, _inte : _sl*_x+_inte
|
|
170
|
-
for _ocec, _soc in _soc_table.items():
|
|
171
|
-
|
|
172
|
-
_df = DataFrame([_soc.values, _ec.values]).T.dropna()
|
|
173
|
-
_x, _y = _df[0], _df[1]
|
|
174
|
-
|
|
175
|
-
_opt, _ = curve_fit(_func, _x, _y)
|
|
176
|
-
|
|
177
|
-
_tss = n.sum((_y - _y.mean())**2.)
|
|
178
|
-
_rss = n.sum((_y - _func(_x, *_opt))**2.)
|
|
179
|
-
|
|
180
|
-
_r2_dic[round(_ocec,2)] = 1. - _rss / _tss
|
|
181
|
-
|
|
182
|
-
## get the min R2
|
|
183
|
-
_ocec_ratio = DataFrame(_r2_dic, index=[0]).idxmin(axis=1).values[0]
|
|
184
|
-
# '''
|
|
Binary file
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import pickle as pkl
|
|
2
1
|
from pathlib import Path
|
|
3
2
|
|
|
4
3
|
import numpy as np
|
|
5
|
-
from pandas import DataFrame
|
|
4
|
+
from pandas import DataFrame, read_pickle
|
|
6
5
|
|
|
7
6
|
from AeroViz.dataProcess.core import union_index
|
|
8
7
|
|
|
@@ -12,7 +11,7 @@ def _revised(_df_mass, _df_RH):
|
|
|
12
11
|
|
|
13
12
|
# fRH
|
|
14
13
|
with (Path(__file__).parent / 'fRH.pkl').open('rb') as f:
|
|
15
|
-
_fRH =
|
|
14
|
+
_fRH = read_pickle(f)
|
|
16
15
|
_fRH.loc[np.nan] = np.nan
|
|
17
16
|
|
|
18
17
|
def fRH(_RH):
|
|
Binary file
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
from ..core import Writer, run_process
|
|
2
2
|
|
|
3
|
-
__all__ = [
|
|
4
|
-
|
|
5
|
-
'SizeDistr',
|
|
6
|
-
|
|
7
|
-
]
|
|
3
|
+
__all__ = ['SizeDistr']
|
|
8
4
|
|
|
9
5
|
|
|
10
6
|
class SizeDistr(Writer):
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
# basic
|
|
13
9
|
@run_process('SizeDistr - basic', 'distr_basic')
|
|
14
10
|
def basic(self, df, hybrid_bin_start_loc=None, unit='nm', bin_range=(0, 20000), input_type='norm'):
|
|
15
11
|
from ._size_distr import _basic
|
|
@@ -18,7 +14,7 @@ class SizeDistr(Writer):
|
|
|
18
14
|
|
|
19
15
|
return self, out
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
# merge
|
|
22
18
|
@run_process('SizeDistr - merge_SMPS_APS_v4', 'distr_merge')
|
|
23
19
|
def merge_SMPS_APS_v4(self, df_smps, df_aps, df_pm25, aps_unit='um',
|
|
24
20
|
smps_overlap_lowbound=500, aps_fit_highbound=1000, dndsdv_alg=True,
|
|
@@ -30,7 +26,7 @@ class SizeDistr(Writer):
|
|
|
30
26
|
|
|
31
27
|
return self, out
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
# merge
|
|
34
30
|
@run_process('SizeDistr - merge_SMPS_APS_v3', 'distr_merge')
|
|
35
31
|
def merge_SMPS_APS_v3(self, df_smps, df_aps, aps_unit='um',
|
|
36
32
|
smps_overlap_lowbound=500, aps_fit_highbound=1000, dndsdv_alg=True):
|
|
@@ -40,7 +36,7 @@ class SizeDistr(Writer):
|
|
|
40
36
|
|
|
41
37
|
return self, out
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
# merge
|
|
44
40
|
@run_process('SizeDistr - merge_SMPS_APS_v2', 'distr_merge')
|
|
45
41
|
def merge_SMPS_APS_v2(self, df_smps, df_aps, aps_unit='um',
|
|
46
42
|
smps_overlap_lowbound=500, aps_fit_highbound=1000):
|
|
@@ -50,7 +46,7 @@ class SizeDistr(Writer):
|
|
|
50
46
|
|
|
51
47
|
return self, out
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
# merge
|
|
54
50
|
@run_process('SizeDistr - merge_SMPS_APS_v1', 'distr_merge')
|
|
55
51
|
def merge_SMPS_APS(self, df_smps, df_aps, aps_unit='um', shift_mode='mobility',
|
|
56
52
|
smps_overlap_lowbound=523, aps_fit_highbound=800):
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
from ..core import Writer, run_process
|
|
2
2
|
|
|
3
|
-
__all__ = [
|
|
4
|
-
|
|
5
|
-
'VOC',
|
|
6
|
-
|
|
7
|
-
]
|
|
3
|
+
__all__ = ['VOC']
|
|
8
4
|
|
|
9
5
|
|
|
10
6
|
class VOC(Writer):
|
|
11
7
|
|
|
12
|
-
## Reconstruction
|
|
13
8
|
@run_process('VOC - basic', 'voc_basic')
|
|
14
9
|
def VOC_basic(self, _df_voc):
|
|
15
10
|
from ._potential_par import _basic
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from pandas import DataFrame, read_json, concat
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _basic(_df_voc):
|
|
7
|
+
with (Path(__file__).parent / 'support_voc.json').open('r', encoding='utf-8', errors='ignore') as f:
|
|
8
|
+
_par = read_json(f)
|
|
9
|
+
|
|
10
|
+
# parameter
|
|
11
|
+
_keys = _df_voc.keys()
|
|
12
|
+
|
|
13
|
+
invalid_keys = [key for key in _df_voc.keys() if key not in set(_par.keys())]
|
|
14
|
+
|
|
15
|
+
if invalid_keys:
|
|
16
|
+
raise KeyError(f'\n\t\t{invalid_keys} are not supported keys.'
|
|
17
|
+
f'\n\t\tPlease check the\033[91m support_voc.md\033[0m file to use the correct name.')
|
|
18
|
+
|
|
19
|
+
_MW, _MIR, _SOAP, _KOH = _par.loc['MW', :], _par.loc['MIR', :], _par.loc['SOAP', :], _par.loc['KOH', :]
|
|
20
|
+
|
|
21
|
+
_voc_classify = {
|
|
22
|
+
'alkane_total': ['Ethane', 'Propane', 'Isobutane', 'n-Butane', 'Isopentane', 'n-Pentane', 'n-Hexane',
|
|
23
|
+
'n-Heptane', 'n-Octane', 'n-Nonane', 'n-Decane', 'n-Undecane', 'n-Dodecane',
|
|
24
|
+
|
|
25
|
+
'Cyclopentane', 'Methylcyclopentane', 'Cyclohexane', 'Methylcyclohexane',
|
|
26
|
+
|
|
27
|
+
'2,2-Dimethylbutane', '2,3-Dimethylbutane', '2-Methylpentane', '3-Methylpentane',
|
|
28
|
+
'2,4-Dimethylpentane', '2-Methylhexane', '3-Methylhexane',
|
|
29
|
+
'2,2,4-Trimethylpentane', '2,3,4-Trimethylpentane', '2-Methylheptane', '3-Methylheptane'],
|
|
30
|
+
|
|
31
|
+
'alkene_total': ['Ethylene', 'Propylene', '1-Butene', 't-2-Butene', 'cis-2-Butene', '1-Pentene', 't-2-Pentene',
|
|
32
|
+
'cis-2-Pentene', '1-Hexene', 'Isoprene', '1.3-Butadiene', '1-Octene'],
|
|
33
|
+
|
|
34
|
+
'aromatic_total': ['Benzene', 'Toluene', 'Ethylbenzene', 'm/p-Xylene', 'o-Xylene', 'Styrene',
|
|
35
|
+
'Isopropylbenzene',
|
|
36
|
+
'n-Propylbenzene', 'm-Ethyltoluene', 'p-Ethyltoluene', 'o-Ethyltoluene', 'm-Diethylbenzene',
|
|
37
|
+
'p-Diethylbenzene', '1,2,4-Trimethylbenzene', '1,2,3-Trimethylbenzene',
|
|
38
|
+
'1,3,5-Trimethylbenzene', ],
|
|
39
|
+
|
|
40
|
+
'alkyne_total': ['Acetylene'],
|
|
41
|
+
|
|
42
|
+
'OVOC': ['Acetaldehyde', 'Ethanol', 'Acetone', 'IPA', 'Ethyl Acetate', 'Butyl Acetate'],
|
|
43
|
+
|
|
44
|
+
'ClVOC': ['VCM', 'TCE', 'PCE', '1.4-DCB', '1.2-DCB'],
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_df_MW = (_df_voc * _MW).copy()
|
|
48
|
+
_df_dic = {
|
|
49
|
+
'Conc': _df_voc.copy(),
|
|
50
|
+
'OFP': _df_MW / 48 * _MIR,
|
|
51
|
+
'SOAP': _df_MW / 24.5 * _SOAP / 100 * 0.054,
|
|
52
|
+
'LOH': _df_MW / 24.5 / _MW * 0.602 * _KOH,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# calculate
|
|
56
|
+
_out = {}
|
|
57
|
+
for _nam, _df in _df_dic.items():
|
|
58
|
+
|
|
59
|
+
_df_out = DataFrame(index=_df_voc.index)
|
|
60
|
+
|
|
61
|
+
for _voc_nam, _voc_lst in _voc_classify.items():
|
|
62
|
+
_lst = list(set(_keys) & set(_voc_lst))
|
|
63
|
+
if len(_lst) == 0:
|
|
64
|
+
continue
|
|
65
|
+
|
|
66
|
+
_df_out = concat([_df[_lst], _df_out], axis=1)
|
|
67
|
+
|
|
68
|
+
_df_out[_voc_nam] = _df[_lst].sum(axis=1, min_count=1)
|
|
69
|
+
|
|
70
|
+
_df_out['Total'] = _df.sum(axis=1, min_count=1)
|
|
71
|
+
|
|
72
|
+
_out[_nam] = _df_out
|
|
73
|
+
|
|
74
|
+
return _out
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def markdown_table_to_dataframe():
|
|
78
|
+
import pandas as pd
|
|
79
|
+
from pathlib import Path
|
|
80
|
+
|
|
81
|
+
# support_voc.md
|
|
82
|
+
with open(Path(__file__).parent / 'support_voc.md', 'r', encoding='utf-8') as file:
|
|
83
|
+
markdown_content = file.read()
|
|
84
|
+
|
|
85
|
+
# 將內容分割成行
|
|
86
|
+
lines = markdown_content.strip().split('\n')
|
|
87
|
+
|
|
88
|
+
# 提取表頭
|
|
89
|
+
headers = [col.strip() for col in lines[0].split('|')[1:-1]]
|
|
90
|
+
|
|
91
|
+
# 解析數據行
|
|
92
|
+
data = []
|
|
93
|
+
for line in lines[2:]: # 跳過表頭和分隔行
|
|
94
|
+
columns = [col.strip() for col in line.split('|')[1:-1]]
|
|
95
|
+
data.append(columns)
|
|
96
|
+
|
|
97
|
+
# 創建 DataFrame
|
|
98
|
+
df = pd.DataFrame(data, columns=headers)
|
|
99
|
+
|
|
100
|
+
# 轉換數據類型
|
|
101
|
+
numeric_columns = ['MIR', 'MW', 'SOAP', 'KOH']
|
|
102
|
+
for col in numeric_columns:
|
|
103
|
+
df[col] = pd.to_numeric(df[col], errors='coerce')
|
|
104
|
+
df = df.set_index('Species').T
|
|
105
|
+
|
|
106
|
+
df = df.iloc[:, :-7]
|
|
107
|
+
|
|
108
|
+
df.to_json(Path(__file__).parent / 'support_voc.json', indent=4)
|