AeroViz 0.1.3b0__py3-none-any.whl → 0.1.4__py3-none-any.whl
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/__init__.py +5 -3
- AeroViz/{config → data}/DEFAULT_DATA.csv +1 -1
- AeroViz/dataProcess/Chemistry/__init__.py +7 -7
- AeroViz/dataProcess/Chemistry/_isoropia.py +5 -2
- AeroViz/dataProcess/Chemistry/_mass_volume.py +15 -18
- AeroViz/dataProcess/Chemistry/_ocec.py +2 -2
- AeroViz/dataProcess/Chemistry/_teom.py +2 -1
- AeroViz/dataProcess/Chemistry/isrpia.cnf +21 -0
- AeroViz/dataProcess/Optical/Angstrom_exponent.py +20 -0
- AeroViz/dataProcess/Optical/_IMPROVE.py +13 -15
- AeroViz/dataProcess/Optical/__init__.py +15 -30
- AeroViz/dataProcess/Optical/_absorption.py +21 -47
- AeroViz/dataProcess/Optical/_extinction.py +20 -15
- AeroViz/dataProcess/Optical/_mie.py +0 -1
- AeroViz/dataProcess/Optical/_scattering.py +19 -20
- AeroViz/dataProcess/SizeDistr/__init__.py +7 -7
- AeroViz/dataProcess/SizeDistr/_merge.py +2 -2
- AeroViz/dataProcess/SizeDistr/_merge_v1.py +2 -2
- AeroViz/dataProcess/SizeDistr/_merge_v2.py +2 -2
- AeroViz/dataProcess/SizeDistr/_merge_v3.py +1 -1
- AeroViz/dataProcess/SizeDistr/_merge_v4.py +1 -1
- AeroViz/dataProcess/VOC/__init__.py +3 -3
- AeroViz/dataProcess/__init__.py +28 -6
- AeroViz/dataProcess/core/__init__.py +10 -17
- AeroViz/plot/__init__.py +1 -1
- AeroViz/plot/box.py +2 -1
- AeroViz/plot/optical/optical.py +4 -4
- AeroViz/plot/regression.py +25 -39
- AeroViz/plot/scatter.py +68 -2
- AeroViz/plot/templates/__init__.py +2 -1
- AeroViz/plot/templates/ammonium_rich.py +34 -0
- AeroViz/plot/templates/diurnal_pattern.py +11 -9
- AeroViz/plot/templates/koschmieder.py +51 -115
- AeroViz/plot/templates/metal_heatmap.py +115 -17
- AeroViz/plot/timeseries/__init__.py +1 -0
- AeroViz/plot/timeseries/template.py +47 -0
- AeroViz/plot/timeseries/timeseries.py +275 -208
- AeroViz/plot/utils/plt_utils.py +2 -2
- AeroViz/plot/utils/units.json +5 -0
- AeroViz/plot/violin.py +9 -8
- AeroViz/process/__init__.py +2 -2
- AeroViz/process/script/AbstractDistCalc.py +1 -1
- AeroViz/process/script/Chemical.py +5 -4
- AeroViz/process/script/Others.py +1 -1
- AeroViz/rawDataReader/__init__.py +17 -22
- AeroViz/rawDataReader/{utils/config.py → config/supported_instruments.py} +38 -52
- AeroViz/rawDataReader/core/__init__.py +104 -229
- AeroViz/rawDataReader/script/AE33.py +10 -11
- AeroViz/rawDataReader/script/AE43.py +8 -11
- AeroViz/rawDataReader/script/APS_3321.py +6 -6
- AeroViz/rawDataReader/script/Aurora.py +18 -19
- AeroViz/rawDataReader/script/BC1054.py +11 -15
- AeroViz/rawDataReader/script/EPA_vertical.py +35 -7
- AeroViz/rawDataReader/script/GRIMM.py +2 -9
- AeroViz/rawDataReader/script/{IGAC_ZM.py → IGAC.py} +17 -17
- AeroViz/rawDataReader/script/MA350.py +7 -14
- AeroViz/rawDataReader/script/Minion.py +103 -0
- AeroViz/rawDataReader/script/NEPH.py +24 -29
- AeroViz/rawDataReader/script/SMPS_TH.py +4 -4
- AeroViz/rawDataReader/script/SMPS_aim11.py +6 -6
- AeroViz/rawDataReader/script/SMPS_genr.py +6 -6
- AeroViz/rawDataReader/script/Sunset_OCEC.py +60 -0
- AeroViz/rawDataReader/script/TEOM.py +8 -6
- AeroViz/rawDataReader/script/Table.py +7 -8
- AeroViz/rawDataReader/script/VOC.py +26 -0
- AeroViz/rawDataReader/script/__init__.py +10 -12
- AeroViz/tools/database.py +7 -9
- AeroViz/tools/datareader.py +3 -3
- {AeroViz-0.1.3b0.dist-info → AeroViz-0.1.4.dist-info}/METADATA +1 -1
- AeroViz-0.1.4.dist-info/RECORD +112 -0
- AeroViz/rawDataReader/script/IGAC_TH.py +0 -104
- AeroViz/rawDataReader/script/OCEC_LCRES.py +0 -34
- AeroViz/rawDataReader/script/OCEC_RES.py +0 -28
- AeroViz/rawDataReader/script/VOC_TH.py +0 -30
- AeroViz/rawDataReader/script/VOC_ZM.py +0 -37
- AeroViz-0.1.3b0.dist-info/RECORD +0 -110
- /AeroViz/{config → data}/DEFAULT_PNSD_DATA.csv +0 -0
- /AeroViz/rawDataReader/{utils → config}/__init__.py +0 -0
- {AeroViz-0.1.3b0.dist-info → AeroViz-0.1.4.dist-info}/LICENSE +0 -0
- {AeroViz-0.1.3b0.dist-info → AeroViz-0.1.4.dist-info}/WHEEL +0 -0
- {AeroViz-0.1.3b0.dist-info → AeroViz-0.1.4.dist-info}/top_level.txt +0 -0
AeroViz/__init__.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# This file is used to import all the modules in the AeroViz package
|
|
2
2
|
from AeroViz import plot
|
|
3
|
-
from AeroViz.dataProcess import
|
|
3
|
+
from AeroViz.dataProcess import DataProcess
|
|
4
4
|
from AeroViz.rawDataReader import RawDataReader
|
|
5
5
|
from AeroViz.tools import DataBase, DataReader, DataClassifier
|
|
6
6
|
|
|
7
7
|
__all__ = [
|
|
8
8
|
'plot',
|
|
9
9
|
'RawDataReader',
|
|
10
|
-
'
|
|
11
|
-
'DataBase',
|
|
10
|
+
'DataProcess',
|
|
11
|
+
'DataBase',
|
|
12
|
+
'DataReader',
|
|
13
|
+
'DataClassifier'
|
|
12
14
|
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Time,SO2,NO,NOx,NO2,CO,O3,THC,CH4,NMHC,PM10,
|
|
1
|
+
Time,SO2,NO,NOx,NO2,CO,O3,THC,CH4,NMHC,PM10,PM2.5,WS,WD,AT,RH,RT,Benzene,Toluene,EthylBenzene,m/p-Xylene,o-Xylene,Si,Ti,V,Cr,Mn,Fe,Co,Ni,Cu,Zn,Ga,As,Se,Br,Sr,Ag,Cd,Sn,Sb,Ba,Hg,Tl,Pb,NH3,HF,HCl,HNO2,HNO3,G-SO2,Na+,NH4+,K+,Mg2+,Ca2+,F-,Cl-,NO2-,NO3-,PO43-,SO42-,Extinction,Scattering,Absorption,MEE,MSE,MAE,SSA,SAE450700,AAE370880,Vis_Naked,Vis_LPV,BC,VC,PBLH,T_OC,T_EC,O_OC,O_EC,POC,SOC,NOR,SOR,PM1,ALWC,pH,NH4_status,AS,AN,OM,Soil,SS,EC,SIA,total_mass,unknown_mass,AS_ratio,AN_ratio,OM_ratio,Soil_ratio,SS_ratio,EC_ratio,SIA_ratio,unknown_mass_ratio,AS_volume,AN_volume,OM_volume,Soil_volume,SS_volume,EC_volume,total_volume,AS_volume_ratio,AN_volume_ratio,OM_volume_ratio,Soil_volume_ratio,SS_volume_ratio,EC_volume_ratio,density,ALWC_volume_ratio,gRH,k_amb,k_dry,kappa_chem,kappa_vam,n_amb,n_dry,AS_ext_dry,AN_ext_dry,OM_ext_dry,Soil_ext_dry,SS_ext_dry,EC_ext_dry,total_ext_dry,AS_ext,AN_ext,OM_ext,Soil_ext,SS_ext,EC_ext,total_ext,ALWC_AS_ext,ALWC_AN_ext,ALWC_SS_ext,ALWC_ext,fRH_IMPR,ScatteringByGas,AbsorptionByGas,ExtinctionByGas,Number,GMDn,GSDn,mode_n,ultra_n,accum_n,coarse_n,Surface,GMDs,GSDs,mode_s,ultra_s,accum_s,coarse_s,Volume,GMDv,GSDv,mode_v,ultra_v,accum_v,coarse_v,Bext_internal,GMDext_in,GSDext_in,mode_ext_in,ultra_ext_in,accum_ext_in,coarse_ext_in,Bsca_internal,Babs_internal,Bext_external,GMDext_ex,GSDext_ex,mode_ext_ex,ultra_ext_ex,accum_ext_ex,coarse_ext_ex,Bsca_external,Babs_external,Bext_Fixed_PNSD,Bext_Fixed_RI,PG,MAC,Ox,N2O5_tracer,Vis_cal,OCEC_ratio,PM1/PM25,MEE_PNSD
|
|
2
2
|
2021-02-01 00:00:00,2.5,10.4,53.0,42.6,1.3,14.6,2.2,2.0,0.2,84.0,56.0,1.3,306.0,20.5,76.8,24.4,0.99,2.67,0.19,0.68,0.21,,,,,,,,,,,,,,,,,,,,,,,,12.5774,,0.5693,0.4759,,0.0714,0.4765,11.6625,0.0743,0.2798,0.2885,,0.1486,0.5551,6.4869,,2.9681,179.879,129.306,50.573,3.212125969,2.309035714,0.903090254,0.718849677,1.624,1.356,,2.4,3593.466667,48.54,37.339,0.540278143,0.169467395,,,7.108993122,2.413756878,0.056,0.229,35.56,15.537361,3.88663594,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11.3805792163543,14.058,25.4385792163544,65073.8724853036,26.1370756001682,2.27387008559594,11.8,0.9,0.1,0.0,1056999978.60697,202.561522810954,2.46787275826095,175.1255164,0.17,0.8,0.03,51861790000.2695,421.511551165032,2.3298013391531,378.4899973,0.03,0.8,0.16,,,,,,,,,,,,,,,,,,,,,205.317579216354,298.423186359831,57.2,621.96,6.09298472862313,,0.635,
|
|
3
3
|
2021-02-01 01:00:00,2.1,1.8,36.7,34.8,0.9,21.1,2.2,2.1,0.1,73.0,49.0,1.2,291.0,19.7,80.5,24.4,1.14,1.84,0.12,0.43,0.11,,,,,,,,,,,,,,,,,,,,,,,,12.0403,,0.5965,0.3095,,0.0355,0.4456,11.057,0.0568,0.284,0.2534,,0.1092,0.2621,5.8583,,2.8003,162.183,120.322,41.861,3.309852291,2.45555102,0.854301271,0.741891421,1.668,1.285,10.0,2.4,3008.316667,50.13,41.775,0.466460746,0.148629793,,,6.036647232,1.923627768,0.061,0.25,32.2,18.378917,3.919787846,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11.4116843184148,11.484,22.8956843184148,42275.3347651561,32.3417554250119,2.43890896537368,11.8,0.85,0.15,0.0,979132241.788556,213.495369564376,2.34216600590469,192.8357499,0.16,0.81,0.03,49066097131.0516,420.683242663998,2.27756054854188,378.4899973,0.03,0.81,0.15,,,,,,,,,,,,,,,,,,,,,185.078684318415,281.646089623498,55.9,734.28,6.75779828958646,,0.657142857142857,
|
|
4
4
|
2021-02-01 02:00:00,2.9,9.8,61.0,51.1,0.99,10.7,2.4,2.1,0.3,94.0,70.0,1.3,299.0,19.4,82.8,24.4,1.08,1.98,0.14,0.14,0.12,0.479322,0.013841,0.001037,0.002118,0.026962,0.49815,,,0.039141,0.140642,,0.008099,0.003098,0.023387,,,,0.018278,0.011566,0.005437,,,0.009238,12.0026,,0.3118,0.2484,,0.0514,0.424,12.8777,0.0656,0.2885,0.2404,,0.1137,0.4371,8.3928,,2.7932,208.59,158.844,49.746,2.979859428,2.2692,0.710659428,0.761512432,1.75,1.31,,2.55,3570.75,58.135,44.719,0.624357056,0.20177276,,,7.06735645,2.12126855,0.06,0.194,34.93,24.048226,3.879511152,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11.4233926128591,16.863,28.2863926128591,62303.8712944327,30.3238605222433,2.49086526854534,11.8,0.85,0.15,0.0,1391459557.50536,211.541054105552,2.30001297386085,186.741787,0.15,0.82,0.02,67916033048.9499,402.359688194295,2.22606883392695,366.5290201,0.03,0.84,0.13,,,,,,,,,,,,,,,,,,,,,236.876392612859,246.544677289442,61.8,546.77,5.25432666954312,,0.499,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from ..core import
|
|
1
|
+
from ..core import Writer, run_process
|
|
2
2
|
|
|
3
3
|
__all__ = [
|
|
4
4
|
|
|
@@ -7,10 +7,10 @@ __all__ = [
|
|
|
7
7
|
]
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class Chemistry(
|
|
10
|
+
class Chemistry(Writer):
|
|
11
11
|
|
|
12
12
|
## Reconstruction
|
|
13
|
-
@
|
|
13
|
+
@run_process('Chemistry - reconstruction basic', 'reconstrc_basic')
|
|
14
14
|
def ReConstrc_basic(self, *df_chem, df_ref=None, df_water=None, df_density=None,
|
|
15
15
|
nam_lst=['NH4+', 'SO42-', 'NO3-', 'Fe', 'Na+', 'OC', 'EC']):
|
|
16
16
|
from ._mass_volume import _basic
|
|
@@ -20,7 +20,7 @@ class Chemistry(_writter):
|
|
|
20
20
|
return self, out
|
|
21
21
|
|
|
22
22
|
## Partition
|
|
23
|
-
@
|
|
23
|
+
@run_process('Chemistry - Partition', 'partition')
|
|
24
24
|
def Partition(self, *df_chem, nam_lst=['NH4+', 'SO42-', 'NO3-', 'Cl-', 'NO2', 'HNO3', 'SO2', 'NH3', 'HCl', 'temp']):
|
|
25
25
|
from ._partition import _basic
|
|
26
26
|
|
|
@@ -29,7 +29,7 @@ class Chemistry(_writter):
|
|
|
29
29
|
return self, out
|
|
30
30
|
|
|
31
31
|
## ISOROPIA
|
|
32
|
-
@
|
|
32
|
+
@run_process('Chemistry - ISOROPIA', 'isoropia')
|
|
33
33
|
def ISOROPIA(self, *df_chem,
|
|
34
34
|
nam_lst=['Na+', 'SO42-', 'NH4+', 'NO3-', 'Cl-', 'Ca2+', 'K+', 'Mg2+', 'NH3', 'HNO3', 'HCl', 'RH',
|
|
35
35
|
'temp']):
|
|
@@ -43,7 +43,7 @@ class Chemistry(_writter):
|
|
|
43
43
|
return self, out
|
|
44
44
|
|
|
45
45
|
## OCEC
|
|
46
|
-
@
|
|
46
|
+
@run_process('Chemistry - OC/EC basic', 'ocec_basic')
|
|
47
47
|
def OCEC_basic(self, df_lcres, df_res, df_mass=None, ocec_ratio=None, ocec_ratio_month=1, hr_lim=200,
|
|
48
48
|
least_square_range=(0.1, 2.5, 0.1), WISOC_OC_range=(0.2, 0.7, 0.01), ):
|
|
49
49
|
from ._ocec import _basic
|
|
@@ -54,7 +54,7 @@ class Chemistry(_writter):
|
|
|
54
54
|
return self, out
|
|
55
55
|
|
|
56
56
|
## TEOM
|
|
57
|
-
@
|
|
57
|
+
@run_process('Chemistry - TEOM basic', 'teom_basic')
|
|
58
58
|
def TEOM_basic(self, df_teom, df_check=None):
|
|
59
59
|
from ._teom import _basic
|
|
60
60
|
|
|
@@ -7,6 +7,9 @@ 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
|
+
|
|
10
13
|
def _basic(df_che, path_out, nam_lst):
|
|
11
14
|
# parameter
|
|
12
15
|
df_all = concat(df_che, axis=1)
|
|
@@ -68,8 +71,8 @@ def _basic(df_che, path_out, nam_lst):
|
|
|
68
71
|
# read dat file and transform to the normal name
|
|
69
72
|
cond_idx = df_all[['SO42-', 'NH4+', 'NO3-']].dropna().index
|
|
70
73
|
|
|
71
|
-
with
|
|
72
|
-
df_res = read_csv(f, delimiter='\s+').apply(to_numeric, errors='coerce').set_index(index)
|
|
74
|
+
with pth_output.open('r', encoding='utf-8', errors='ignore') as f:
|
|
75
|
+
df_res = read_csv(f, delimiter=r'\s+').apply(to_numeric, errors='coerce').set_index(index)
|
|
73
76
|
|
|
74
77
|
df_out['H'] = df_res['HLIQ'] / (df_res['WATER'] / 1000)
|
|
75
78
|
|
|
@@ -6,7 +6,7 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
6
6
|
index = df_all.index.copy()
|
|
7
7
|
df_all.columns = nam_lst
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
# parameter
|
|
10
10
|
mol_A, mol_S, mol_N = df_all['NH4+'] / 18, df_all['SO42-'] / 96, df_all['NO3-'] / 62
|
|
11
11
|
df_all['status'] = (mol_A) / (2 * mol_S + mol_N)
|
|
12
12
|
|
|
@@ -43,7 +43,7 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
43
43
|
'EC': 1.80 + 0.72j,
|
|
44
44
|
},
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
# m + kj -> m value is same as 550 current
|
|
47
47
|
'450': {'ALWC': 1.333 + 0j,
|
|
48
48
|
'AS': 1.57 + 0j,
|
|
49
49
|
'AN': 1.57 + 0j,
|
|
@@ -54,21 +54,21 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
54
54
|
},
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
# mass
|
|
58
|
+
# NH4 Enough
|
|
59
59
|
df_mass = DataFrame()
|
|
60
60
|
df_enough = df_all.where(df_all['status'] >= 1).dropna().copy()
|
|
61
61
|
|
|
62
62
|
for _mass_nam, _coe in mass_coe.items():
|
|
63
63
|
df_mass[_mass_nam] = df_all[convert_nam[_mass_nam]] * _coe
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
# NH4 Deficiency
|
|
66
66
|
defic_idx = df_all['status'] < 1
|
|
67
67
|
|
|
68
68
|
if defic_idx.any():
|
|
69
69
|
residual = mol_A - 2 * mol_S
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
# residual > 0
|
|
72
72
|
_status = residual > 0
|
|
73
73
|
if _status.any():
|
|
74
74
|
_cond = _status & (residual <= mol_N)
|
|
@@ -77,7 +77,7 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
77
77
|
_cond = _status & (residual > mol_N)
|
|
78
78
|
df_mass.loc[_cond, 'AN'] = mol_N.loc[_cond] * 80
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
# residual < 0
|
|
81
81
|
_status = residual <= 0
|
|
82
82
|
if _status.any():
|
|
83
83
|
df_mass.loc[_status, 'AN'] = 0
|
|
@@ -94,19 +94,19 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
94
94
|
qc_ratio = df_mass['total'] / df_ref
|
|
95
95
|
qc_cond = (qc_ratio >= 0.7) & (qc_ratio <= 1.3)
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
# volume
|
|
98
98
|
df_vol = DataFrame()
|
|
99
99
|
for _vol_nam, _coe in vol_coe.items():
|
|
100
100
|
df_vol[_vol_nam] = df_mass_cal[_vol_nam] / _coe
|
|
101
101
|
|
|
102
102
|
if df_water is not None:
|
|
103
|
-
df_vol['ALWC'] = df_water
|
|
103
|
+
df_vol['ALWC'] = df_water.copy()
|
|
104
104
|
df_vol = df_vol.dropna()
|
|
105
105
|
df_vol['total_wet'] = df_vol.sum(axis=1, min_count=6)
|
|
106
106
|
|
|
107
107
|
df_vol['total_dry'] = df_vol[vol_coe.keys()].sum(axis=1, min_count=6)
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
# density
|
|
110
110
|
df_vol_cal = DataFrame()
|
|
111
111
|
df_den_rec = df_mass['total'] / df_vol['total_dry']
|
|
112
112
|
if df_density is not None:
|
|
@@ -117,10 +117,10 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
117
117
|
df_den_all['OM'] / 1.4 + df_den_all['EC'] / 1.77
|
|
118
118
|
|
|
119
119
|
df_den = df_den_all.sum(axis=1, min_count=6) / df_vol_cal
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
else:
|
|
121
|
+
df_den = df_den_rec
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
# refractive index
|
|
124
124
|
ri_dic = {}
|
|
125
125
|
for _lambda, _coe in RI_coe.items():
|
|
126
126
|
|
|
@@ -138,11 +138,11 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
138
138
|
|
|
139
139
|
ri_dic[f'RI_{_lambda}'] = df_RI[['RI_dry', 'RI_wet']]
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
# mole and equivalent
|
|
142
142
|
df_eq = concat((mol_A, mol_S, mol_N, mol_A * 1, mol_S * 2, mol_N * 1), axis=1)
|
|
143
143
|
df_eq.columns = ['mol_NH4', 'mol_SO4', 'mol_NO3', 'eq_NH4', 'eq_SO4', 'eq_NO3', ]
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
# out
|
|
146
146
|
out = {'mass': df_mass,
|
|
147
147
|
'volume': df_vol,
|
|
148
148
|
'vol_cal': df_vol_cal,
|
|
@@ -158,9 +158,6 @@ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
|
|
|
158
158
|
return out
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
# '''
|
|
162
|
-
|
|
163
|
-
|
|
164
161
|
def mass_ratio(_df):
|
|
165
162
|
if _df['PM25'] >= _df['total_mass']:
|
|
166
163
|
_df['others'] = _df['PM25'] - _df['total_mass']
|
|
@@ -2,7 +2,7 @@ import numpy as np
|
|
|
2
2
|
from pandas import concat, DataFrame
|
|
3
3
|
from scipy.optimize import curve_fit
|
|
4
4
|
|
|
5
|
-
from AeroViz.dataProcess.core import
|
|
5
|
+
from AeroViz.dataProcess.core import union_index
|
|
6
6
|
|
|
7
7
|
__all__ = [
|
|
8
8
|
'_basic',
|
|
@@ -96,7 +96,7 @@ def _ocec_ratio_cal(_nam, _lcres_splt, _hr_lim, _range_, _wisoc_range_):
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
def _basic(_lcres, _res, _mass, _ocec_ratio, _ocec_ratio_month, _hr_lim, _range, _wisoc_range):
|
|
99
|
-
_lcres, _res, _mass =
|
|
99
|
+
_lcres, _res, _mass = union_index(_lcres, _res, _mass)
|
|
100
100
|
|
|
101
101
|
_out = {}
|
|
102
102
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
def _basic(_teom, _check):
|
|
2
|
+
import numpy as np
|
|
2
3
|
_teom['Volatile_Fraction'] = (_teom['PM_Total'] - _teom['PM_NV']) / _teom['PM_Total']
|
|
3
4
|
|
|
4
|
-
_teom.loc[(_teom['Volatile_Fraction'] < 0) | (_teom['Volatile_Fraction'] > 1)] =
|
|
5
|
+
_teom.loc[(_teom['Volatile_Fraction'] < 0) | (_teom['Volatile_Fraction'] > 1)] = np.nan
|
|
5
6
|
|
|
6
7
|
if _check is not None:
|
|
7
8
|
_ratio = _teom['PM_NV'] / _check
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
*** [ INPUT/OUTPUT PARAMETERS ] ***
|
|
2
|
+
CREATE REPORT IN FILE? (.T.=yes, .F.=no, on screen)
|
|
3
|
+
.F.
|
|
4
|
+
CREATE SPREADSHEET FILE? (.T.=yes, .F.=no)
|
|
5
|
+
.T.
|
|
6
|
+
|
|
7
|
+
*** [ SOLUTION CONTROL ] ***
|
|
8
|
+
Convergence criterion (DEFAULT:1.D-6)
|
|
9
|
+
1.D-6
|
|
10
|
+
Max iterations for bisection method (DEFAULT:100)
|
|
11
|
+
100
|
|
12
|
+
Sweeps for activity coef. calculation (DEFAULT:4)
|
|
13
|
+
4
|
|
14
|
+
Accuracy in activity coef. calculation (DEFAULT:5e-2)
|
|
15
|
+
5e-2
|
|
16
|
+
Subdivisions for root tracking (DEFAULT:5)
|
|
17
|
+
5
|
|
18
|
+
Method for binary activity coefs (0-online, 1-tables) (DEFAULT:1)
|
|
19
|
+
1
|
|
20
|
+
Force mass conservation to machine precision? (0-no, 1-yes) (DEFAULT:0)
|
|
21
|
+
0
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pandas as pd
|
|
3
|
+
from scipy.optimize import curve_fit
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_species_wavelength(df, specified_band):
|
|
7
|
+
func = lambda wavelength, _sl, _int: _sl * wavelength + _int
|
|
8
|
+
popt, pcov = curve_fit(func, specified_band, df.values)
|
|
9
|
+
|
|
10
|
+
return func(np.array(specified_band), *popt)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_Angstrom_exponent(df, band):
|
|
14
|
+
if (df <= 0).any():
|
|
15
|
+
return pd.Series([np.nan, np.nan], index=['slope', 'intercept']) # 返回包含 NaN 的 Series,保持 DataFrame 结构
|
|
16
|
+
|
|
17
|
+
func = lambda wavelength, _sl, _int: _sl * wavelength + _int
|
|
18
|
+
popt, _ = curve_fit(func, np.log(band), np.log(df))
|
|
19
|
+
|
|
20
|
+
return pd.Series(popt, index=['slope', 'intercept']) # 返回带有索引的 Series
|
|
@@ -4,13 +4,13 @@ from pathlib import Path
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
from pandas import DataFrame
|
|
6
6
|
|
|
7
|
-
from AeroViz.dataProcess.core import
|
|
7
|
+
from AeroViz.dataProcess.core import union_index
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def _revised(_df_mass, _df_RH):
|
|
11
|
-
_df_mass, _df_RH =
|
|
11
|
+
_df_mass, _df_RH = union_index(_df_mass, _df_RH)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
# fRH
|
|
14
14
|
with (Path(__file__).parent / 'fRH.pkl').open('rb') as f:
|
|
15
15
|
_fRH = pkl.load(f)
|
|
16
16
|
_fRH.loc[np.nan] = np.nan
|
|
@@ -22,19 +22,19 @@ def _revised(_df_mass, _df_RH):
|
|
|
22
22
|
|
|
23
23
|
return 1, 1, 1, 1
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
# different mode
|
|
26
|
+
# mass < 20 :
|
|
27
|
+
# large = mass**2/20
|
|
28
|
+
# small = mass-large
|
|
29
|
+
# mass >= 20 :
|
|
30
|
+
# large = mass
|
|
31
|
+
# small = 0
|
|
32
32
|
_df_mode = _df_mass[['AS', 'AN', 'OM']].copy()
|
|
33
33
|
|
|
34
34
|
_df_mass[['L_AS', 'L_AN', 'L_OM']] = _df_mode.mask(_df_mode < 20, _df_mode ** 2 / 20)
|
|
35
35
|
_df_mass[['S_AS', 'S_AN', 'S_OM']] = _df_mode.values - _df_mass[['L_AS', 'L_AN', 'L_OM']]
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
# apply IMPROVE ccoe.
|
|
38
38
|
def _ext_cal(_RH=None):
|
|
39
39
|
|
|
40
40
|
_frh, _frhss, _frhs, _frhl = fRH(_RH)
|
|
@@ -51,10 +51,8 @@ def _revised(_df_mass, _df_RH):
|
|
|
51
51
|
|
|
52
52
|
return _df.dropna().reindex(_df_mass.index)
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
_out = {}
|
|
56
|
-
|
|
57
|
-
_out['dry'] = _ext_cal()
|
|
54
|
+
# calculate
|
|
55
|
+
_out = {'dry': _ext_cal()}
|
|
58
56
|
|
|
59
57
|
if _df_RH is not None:
|
|
60
58
|
_out['wet'] = _ext_cal(_df_RH)
|
|
@@ -1,50 +1,35 @@
|
|
|
1
|
-
from ..core import
|
|
1
|
+
from ..core import Writer, run_process
|
|
2
2
|
|
|
3
|
-
__all__ = [
|
|
3
|
+
__all__ = ['Optical']
|
|
4
4
|
|
|
5
|
-
'Optical',
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
class Optical(Writer):
|
|
8
7
|
|
|
8
|
+
@run_process('Optical - scaCoe', 'scaCoe')
|
|
9
|
+
def scaCoe(self, df_sca, instru, specified_band):
|
|
10
|
+
from ._scattering import _scaCoe
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## scatter
|
|
13
|
-
@_run_process('Optical - SAE', 'SAE')
|
|
14
|
-
def SAE(self, df_sca):
|
|
15
|
-
from ._scattering import _SAE
|
|
16
|
-
|
|
17
|
-
out = _SAE(df_sca)
|
|
12
|
+
out = _scaCoe(df_sca, instru=instru, specified_band=[550] if specified_band is None else specified_band)
|
|
18
13
|
|
|
19
14
|
return self, out
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def absCoe(self, df_ae33, abs_band=[550]):
|
|
16
|
+
@run_process('Optical - absCoe', 'absCoe')
|
|
17
|
+
def absCoe(self, df_ae33, instru, specified_band):
|
|
24
18
|
from ._absorption import _absCoe
|
|
25
19
|
|
|
26
|
-
out = _absCoe(df_ae33,
|
|
27
|
-
|
|
28
|
-
return self, out
|
|
29
|
-
|
|
30
|
-
@_run_process('Optical - AAE', 'AAE')
|
|
31
|
-
def AAE(self, df_abs):
|
|
32
|
-
from ._absorption import _AAE
|
|
33
|
-
|
|
34
|
-
out = _AAE(df_abs)
|
|
20
|
+
out = _absCoe(df_ae33, instru=instru, specified_band=[550] if specified_band is None else specified_band)
|
|
35
21
|
|
|
36
22
|
return self, out
|
|
37
23
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def basic(self, df_abs, df_sca, df_ec=None, df_mass=None, df_no2=None):
|
|
24
|
+
@run_process('Optical - basic', 'opt_basic')
|
|
25
|
+
def basic(self, df_sca, df_abs, df_mass=None, df_no2=None, df_temp=None):
|
|
41
26
|
from ._extinction import _basic
|
|
42
27
|
|
|
43
|
-
out = _basic(
|
|
28
|
+
out = _basic(df_sca, df_abs, df_mass, df_no2, df_temp)
|
|
44
29
|
|
|
45
30
|
return self, out
|
|
46
31
|
|
|
47
|
-
@
|
|
32
|
+
@run_process('Optical - Mie', 'Mie')
|
|
48
33
|
def Mie(self, df_psd, df_m, wave_length=550):
|
|
49
34
|
from ._mie import _mie
|
|
50
35
|
|
|
@@ -52,7 +37,7 @@ class Optical(_writter):
|
|
|
52
37
|
|
|
53
38
|
return self, out
|
|
54
39
|
|
|
55
|
-
@
|
|
40
|
+
@run_process('Optical - IMPROVE', 'IMPROVE')
|
|
56
41
|
def IMPROVE(self, df_mass, df_RH, method='revised'):
|
|
57
42
|
# _fc = __import__(f'_IMPROVE._{method}')
|
|
58
43
|
from ._IMPROVE import _revised
|
|
@@ -1,54 +1,28 @@
|
|
|
1
|
-
def _absCoe(df,
|
|
2
|
-
import numpy as
|
|
3
|
-
from
|
|
1
|
+
def _absCoe(df, instru, specified_band: list):
|
|
2
|
+
import numpy as np
|
|
3
|
+
from pandas import concat
|
|
4
|
+
from .Angstrom_exponent import get_Angstrom_exponent, get_species_wavelength
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
band_AE33 = np.array([370, 470, 520, 590, 660, 880, 950])
|
|
7
|
+
band_BC1054 = np.array([370, 430, 470, 525, 565, 590, 660, 700, 880, 950])
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
MAE_AE33 = np.array([18.47, 14.54, 13.14, 11.58, 10.35, 7.77, 7.19]) * 1e-3
|
|
10
|
+
MAE_BC1054 = np.array([18.48, 15.90, 14.55, 13.02, 12.10, 11.59, 10.36, 9.77, 7.77, 7.20]) * 1e-3
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
band = band_AE33 if instru == 'AE33' else band_BC1054
|
|
13
|
+
MAE = MAE_AE33 if instru == 'AE33' else MAE_BC1054
|
|
14
|
+
eBC = 'BC6' if instru == 'AE33' else 'BC9'
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
# calculate
|
|
17
|
+
df_abs = (df.copy().dropna() * MAE).copy()
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
df_out = df_abs.apply(get_species_wavelength, axis=1, result_type='expand', args=(specified_band,))
|
|
20
|
+
df_out.columns = [f'abs_{_band}' for _band in specified_band]
|
|
21
|
+
df_out['eBC'] = df[eBC]
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
df_AAE = df_abs.apply(get_Angstrom_exponent, axis=1, result_type='expand', args=(band,))
|
|
24
|
+
df_AAE.columns = ['AAE', 'AAE_intercept']
|
|
25
|
+
df_AAE = df_AAE.mask((-df_AAE['AAE'] < 0.8) | (-df_AAE['AAE'] > 2.)).copy()
|
|
20
26
|
|
|
21
|
-
df_out['
|
|
22
|
-
|
|
23
|
-
return df_out
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def _AAE(df):
|
|
27
|
-
import numpy as n
|
|
28
|
-
from scipy.optimize import curve_fit
|
|
29
|
-
|
|
30
|
-
def _AAEcalc(_df):
|
|
31
|
-
## parameter
|
|
32
|
-
MAE = n.array([18.47, 14.54, 13.14, 11.58, 10.35, 7.77, 7.19]) * 1e-3
|
|
33
|
-
band = n.array([370, 470, 520, 590, 660, 880, 950])
|
|
34
|
-
_df *= MAE
|
|
35
|
-
|
|
36
|
-
## 7 pts fitting
|
|
37
|
-
## function
|
|
38
|
-
def _get_slope(__df):
|
|
39
|
-
func = lambda _x, _sl, _int: _sl * _x + _int
|
|
40
|
-
popt, pcov = curve_fit(func, n.log(band), n.log(__df))
|
|
41
|
-
|
|
42
|
-
return popt
|
|
43
|
-
|
|
44
|
-
## calculate
|
|
45
|
-
_AAE = _df.apply(_get_slope, axis=1, result_type='expand')
|
|
46
|
-
_AAE.columns = ['slope', 'intercept']
|
|
47
|
-
|
|
48
|
-
return _AAE
|
|
49
|
-
|
|
50
|
-
df_out = _AAEcalc(df[['BC1', 'BC2', 'BC3', 'BC4', 'BC5', 'BC6', 'BC7']].dropna())
|
|
51
|
-
df_out = df_out.mask((-df_out.slope < 0.8) | (-df_out.slope > 2.)).copy()
|
|
52
|
-
|
|
53
|
-
df_out['eBC'] = df['BC6']
|
|
54
|
-
return df_out.reindex(df.index)
|
|
27
|
+
_df = concat([df_out, df_AAE['AAE']], axis=1)
|
|
28
|
+
return _df.reindex(df.index)
|
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
from pandas import DataFrame
|
|
2
2
|
|
|
3
|
-
from AeroViz.dataProcess.core import
|
|
3
|
+
from AeroViz.dataProcess.core import union_index
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def _basic(
|
|
7
|
-
|
|
6
|
+
def _basic(df_sca, df_abs, df_mass, df_no2, df_temp):
|
|
7
|
+
df_sca, df_abs, df_mass, df_no2, df_temp = union_index(df_sca, df_abs, df_mass, df_no2, df_temp)
|
|
8
8
|
|
|
9
9
|
df_out = DataFrame()
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
df_out['abs'] = df_abs.copy()
|
|
13
|
-
df_out['sca'] = df_sca.copy()
|
|
11
|
+
# abs and sca coe
|
|
12
|
+
df_out['abs'] = df_abs['abs_550'].copy()
|
|
13
|
+
df_out['sca'] = df_sca['sca_550'].copy()
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
# extinction coe.
|
|
16
16
|
df_out['ext'] = df_out['abs'] + df_out['sca']
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
# SSA
|
|
19
19
|
df_out['SSA'] = df_out['sca'] / df_out['ext']
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
# SAE, AAE, eBC
|
|
22
|
+
df_out['SAE'] = df_sca['SAE'].copy()
|
|
23
|
+
df_out['AAE'] = df_abs['AAE'].copy()
|
|
24
|
+
df_out['eBC'] = df_abs['eBC'].copy() / 1e3
|
|
25
|
+
|
|
26
|
+
# MAE, MSE, MEE
|
|
22
27
|
if df_mass is not None:
|
|
23
28
|
df_out['MAE'] = df_out['abs'] / df_mass
|
|
24
29
|
df_out['MSE'] = df_out['sca'] / df_mass
|
|
25
30
|
df_out['MEE'] = df_out['MSE'] + df_out['MAE']
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
# gas absorbtion
|
|
28
33
|
if df_no2 is not None:
|
|
29
34
|
df_out['abs_gas'] = df_no2 * .33
|
|
30
|
-
df_out['sca_gas'] = 10
|
|
31
|
-
df_out['ext_all'] = df_out['ext'] + df_out['abs_gas'] + df_out['sca_gas']
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
if df_temp is not None:
|
|
37
|
+
df_out['sca_gas'] = (11.4 * 293 / (273 + df_temp))
|
|
38
|
+
|
|
39
|
+
if df_no2 is not None and df_temp is not None:
|
|
40
|
+
df_out['ext_all'] = df_out['ext'] + df_out['abs_gas'] + df_out['sca_gas']
|
|
36
41
|
|
|
37
42
|
return df_out
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
from
|
|
2
|
+
from pandas import concat
|
|
3
3
|
|
|
4
|
-
__all__ = [
|
|
5
|
-
'_SAE',
|
|
6
|
-
]
|
|
4
|
+
__all__ = ['_scaCoe']
|
|
7
5
|
|
|
8
6
|
|
|
9
|
-
def
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
def _scaCoe(df, instru, specified_band: list):
|
|
8
|
+
from .Angstrom_exponent import get_Angstrom_exponent, get_species_wavelength
|
|
9
|
+
band_Neph = np.array([450, 550, 700])
|
|
10
|
+
band_Aurora = np.array([450, 525, 635])
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
## function
|
|
16
|
-
def _get_slope(__df):
|
|
17
|
-
func = lambda _x, _sl, _int: _sl * _x + _int
|
|
18
|
-
popt, pcov = curve_fit(func, np.log(band), np.log(__df))
|
|
12
|
+
band = band_Neph if instru == 'Neph' else band_Aurora
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
df_sca = df.copy().dropna()
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
if instru == 'Neph':
|
|
17
|
+
df_out = df_sca[['B']].copy()
|
|
18
|
+
df_out.columns = [f'sca_{_band}' for _band in specified_band]
|
|
19
|
+
else:
|
|
20
|
+
df_out = df_sca.apply(get_species_wavelength, axis=1, result_type='expand', args=(specified_band,))
|
|
21
|
+
df_out.columns = [f'sca_{_band}' for _band in specified_band]
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
# calculate
|
|
24
|
+
df_SAE = df[['B', 'G', 'R']].dropna().apply(get_Angstrom_exponent, axis=1, result_type='expand', args=(band,))
|
|
25
|
+
df_SAE.columns = ['SAE', 'SAE_intercept']
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
_df = concat([df_out, df_SAE['SAE']], axis=1)
|
|
29
28
|
|
|
30
|
-
return
|
|
29
|
+
return _df.reindex(df.index)
|