AeroViz 0.1.3__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 +7 -5
- AeroViz/{config → data}/DEFAULT_DATA.csv +1 -1
- AeroViz/dataProcess/Chemistry/__init__.py +40 -40
- AeroViz/dataProcess/Chemistry/_calculate.py +15 -15
- AeroViz/dataProcess/Chemistry/_isoropia.py +72 -68
- AeroViz/dataProcess/Chemistry/_mass_volume.py +158 -161
- AeroViz/dataProcess/Chemistry/_ocec.py +109 -109
- AeroViz/dataProcess/Chemistry/_partition.py +19 -18
- AeroViz/dataProcess/Chemistry/_teom.py +9 -11
- AeroViz/dataProcess/Chemistry/isrpia.cnf +21 -0
- AeroViz/dataProcess/Optical/Angstrom_exponent.py +20 -0
- AeroViz/dataProcess/Optical/_IMPROVE.py +40 -41
- AeroViz/dataProcess/Optical/__init__.py +29 -44
- AeroViz/dataProcess/Optical/_absorption.py +21 -47
- AeroViz/dataProcess/Optical/_extinction.py +31 -25
- AeroViz/dataProcess/Optical/_mie.py +5 -7
- AeroViz/dataProcess/Optical/_mie_sd.py +89 -90
- AeroViz/dataProcess/Optical/_scattering.py +19 -20
- AeroViz/dataProcess/SizeDistr/__init__.py +39 -39
- AeroViz/dataProcess/SizeDistr/__merge.py +159 -158
- AeroViz/dataProcess/SizeDistr/_merge.py +155 -154
- AeroViz/dataProcess/SizeDistr/_merge_v1.py +162 -161
- AeroViz/dataProcess/SizeDistr/_merge_v2.py +153 -152
- AeroViz/dataProcess/SizeDistr/_merge_v3.py +327 -327
- AeroViz/dataProcess/SizeDistr/_merge_v4.py +273 -275
- AeroViz/dataProcess/SizeDistr/_size_distr.py +51 -51
- AeroViz/dataProcess/VOC/__init__.py +9 -9
- AeroViz/dataProcess/VOC/_potential_par.py +53 -55
- AeroViz/dataProcess/__init__.py +28 -6
- AeroViz/dataProcess/core/__init__.py +59 -65
- AeroViz/plot/__init__.py +7 -2
- AeroViz/plot/bar.py +126 -0
- AeroViz/plot/box.py +69 -0
- AeroViz/plot/distribution/distribution.py +421 -427
- AeroViz/plot/meteorology/meteorology.py +240 -292
- AeroViz/plot/optical/__init__.py +0 -1
- AeroViz/plot/optical/optical.py +230 -230
- AeroViz/plot/pie.py +198 -0
- AeroViz/plot/regression.py +196 -0
- AeroViz/plot/scatter.py +165 -0
- AeroViz/plot/templates/__init__.py +2 -4
- AeroViz/plot/templates/ammonium_rich.py +34 -0
- AeroViz/plot/templates/contour.py +25 -25
- AeroViz/plot/templates/corr_matrix.py +86 -93
- AeroViz/plot/templates/diurnal_pattern.py +28 -26
- AeroViz/plot/templates/koschmieder.py +59 -123
- AeroViz/plot/templates/metal_heatmap.py +135 -37
- AeroViz/plot/timeseries/__init__.py +1 -0
- AeroViz/plot/timeseries/template.py +47 -0
- AeroViz/plot/timeseries/timeseries.py +324 -264
- AeroViz/plot/utils/__init__.py +2 -1
- AeroViz/plot/utils/_color.py +57 -57
- AeroViz/plot/utils/_unit.py +48 -48
- AeroViz/plot/utils/plt_utils.py +92 -0
- AeroViz/plot/utils/sklearn_utils.py +49 -0
- AeroViz/plot/utils/units.json +5 -0
- AeroViz/plot/violin.py +80 -0
- AeroViz/process/__init__.py +17 -17
- AeroViz/process/core/DataProc.py +9 -9
- AeroViz/process/core/SizeDist.py +81 -81
- AeroViz/process/method/PyMieScatt_update.py +488 -488
- AeroViz/process/method/mie_theory.py +231 -229
- AeroViz/process/method/prop.py +40 -40
- AeroViz/process/script/AbstractDistCalc.py +103 -103
- AeroViz/process/script/Chemical.py +168 -167
- AeroViz/process/script/IMPACT.py +40 -40
- AeroViz/process/script/IMPROVE.py +152 -152
- AeroViz/process/script/Others.py +45 -45
- AeroViz/process/script/PSD.py +26 -26
- AeroViz/process/script/PSD_dry.py +69 -70
- AeroViz/process/script/retrieve_RI.py +50 -51
- AeroViz/rawDataReader/__init__.py +53 -58
- AeroViz/rawDataReader/config/supported_instruments.py +155 -0
- AeroViz/rawDataReader/core/__init__.py +233 -356
- AeroViz/rawDataReader/script/AE33.py +17 -18
- AeroViz/rawDataReader/script/AE43.py +18 -21
- AeroViz/rawDataReader/script/APS_3321.py +30 -30
- AeroViz/rawDataReader/script/Aurora.py +23 -24
- AeroViz/rawDataReader/script/BC1054.py +36 -40
- AeroViz/rawDataReader/script/EPA_vertical.py +37 -9
- AeroViz/rawDataReader/script/GRIMM.py +16 -23
- AeroViz/rawDataReader/script/IGAC.py +90 -0
- AeroViz/rawDataReader/script/MA350.py +32 -39
- AeroViz/rawDataReader/script/Minion.py +103 -0
- AeroViz/rawDataReader/script/NEPH.py +69 -74
- AeroViz/rawDataReader/script/SMPS_TH.py +25 -25
- AeroViz/rawDataReader/script/SMPS_aim11.py +32 -32
- AeroViz/rawDataReader/script/SMPS_genr.py +31 -31
- AeroViz/rawDataReader/script/Sunset_OCEC.py +60 -0
- AeroViz/rawDataReader/script/TEOM.py +30 -28
- AeroViz/rawDataReader/script/Table.py +13 -14
- AeroViz/rawDataReader/script/VOC.py +26 -0
- AeroViz/rawDataReader/script/__init__.py +18 -20
- AeroViz/tools/database.py +64 -66
- AeroViz/tools/dataclassifier.py +106 -106
- AeroViz/tools/dataprinter.py +51 -51
- AeroViz/tools/datareader.py +38 -38
- {AeroViz-0.1.3.dist-info → AeroViz-0.1.4.dist-info}/METADATA +5 -4
- AeroViz-0.1.4.dist-info/RECORD +112 -0
- AeroViz/plot/improve/__init__.py +0 -1
- AeroViz/plot/improve/improve.py +0 -240
- AeroViz/plot/optical/aethalometer.py +0 -77
- AeroViz/plot/templates/event_evolution.py +0 -65
- AeroViz/plot/templates/regression.py +0 -256
- AeroViz/plot/templates/scatter.py +0 -130
- AeroViz/plot/templates/templates.py +0 -398
- AeroViz/plot/utils/_decorator.py +0 -74
- AeroViz/rawDataReader/script/IGAC_TH.py +0 -104
- AeroViz/rawDataReader/script/IGAC_ZM.py +0 -90
- 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/rawDataReader/utils/__init__.py +0 -0
- AeroViz/rawDataReader/utils/config.py +0 -169
- AeroViz-0.1.3.dist-info/RECORD +0 -111
- /AeroViz/{config → data}/DEFAULT_PNSD_DATA.csv +0 -0
- /AeroViz/{config → rawDataReader/config}/__init__.py +0 -0
- {AeroViz-0.1.3.dist-info → AeroViz-0.1.4.dist-info}/LICENSE +0 -0
- {AeroViz-0.1.3.dist-info → AeroViz-0.1.4.dist-info}/WHEEL +0 -0
- {AeroViz-0.1.3.dist-info → AeroViz-0.1.4.dist-info}/top_level.txt +0 -0
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
def _basic(_teom, _check):
|
|
5
|
-
|
|
2
|
+
import numpy as np
|
|
3
|
+
_teom['Volatile_Fraction'] = (_teom['PM_Total'] - _teom['PM_NV']) / _teom['PM_Total']
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
_teom.loc[(_teom['Volatile_Fraction'] < 0) | (_teom['Volatile_Fraction'] > 1)] = np.nan
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
if _check is not None:
|
|
8
|
+
_ratio = _teom['PM_NV'] / _check
|
|
9
|
+
_teom['PM_Check'] = _check
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
_teom.loc[_teom.dropna().index, 'status'] = 'Warning'
|
|
12
|
+
_teom.loc[(_ratio > 0) & (_ratio < 1), 'status'] = 'Normal'
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
return _teom
|
|
@@ -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
|
|
@@ -1,61 +1,60 @@
|
|
|
1
1
|
import pickle as pkl
|
|
2
2
|
from pathlib import Path
|
|
3
|
+
|
|
3
4
|
import numpy as np
|
|
5
|
+
from pandas import DataFrame
|
|
4
6
|
|
|
5
|
-
from
|
|
6
|
-
from AeroViz.dataProcess.core import _union_index
|
|
7
|
+
from AeroViz.dataProcess.core import union_index
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def _revised(_df_mass, _df_RH):
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## fRH
|
|
13
|
-
with (Path(__file__).parent / 'fRH.pkl').open('rb') as f:
|
|
14
|
-
_fRH = pkl.load(f)
|
|
15
|
-
_fRH.loc[np.nan] = np.nan
|
|
11
|
+
_df_mass, _df_RH = union_index(_df_mass, _df_RH)
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
# fRH
|
|
14
|
+
with (Path(__file__).parent / 'fRH.pkl').open('rb') as f:
|
|
15
|
+
_fRH = pkl.load(f)
|
|
16
|
+
_fRH.loc[np.nan] = np.nan
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
def fRH(_RH):
|
|
19
|
+
if _RH is not None:
|
|
20
|
+
_RH = _RH.mask(_RH > 95, 95).round(0)
|
|
21
|
+
return _fRH.loc[_RH].values.T
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
## mass < 20 :
|
|
26
|
-
## large = mass**2/20
|
|
27
|
-
## small = mass-large
|
|
28
|
-
## mass >= 20 :
|
|
29
|
-
## large = mass
|
|
30
|
-
## small = 0
|
|
31
|
-
_df_mode = _df_mass[['AS', 'AN', 'OM']].copy()
|
|
23
|
+
return 1, 1, 1, 1
|
|
32
24
|
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
_df_mode = _df_mass[['AS', 'AN', 'OM']].copy()
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
_df_mass[['L_AS', 'L_AN', 'L_OM']] = _df_mode.mask(_df_mode < 20, _df_mode ** 2 / 20)
|
|
35
|
+
_df_mass[['S_AS', 'S_AN', 'S_OM']] = _df_mode.values - _df_mass[['L_AS', 'L_AN', 'L_OM']]
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
# apply IMPROVE ccoe.
|
|
38
|
+
def _ext_cal(_RH=None):
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
_df['OM'] = 2.8 * _df_mass['S_OM'] + 6.1 * _frhl * _df_mass['L_OM']
|
|
45
|
-
_df['Soil'] = _df_mass['Soil']
|
|
46
|
-
_df['SS'] = 1.7 * _frhss * _df_mass['SS']
|
|
47
|
-
_df['EC'] = 10 * _df_mass['EC']
|
|
40
|
+
_frh, _frhss, _frhs, _frhl = fRH(_RH)
|
|
41
|
+
_df = DataFrame(index=_df_mass.index)
|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
_df['AS'] = 2.2 * _frhs * _df_mass['S_AS'] + 4.8 * _frhl * _df_mass['L_AS']
|
|
44
|
+
_df['AN'] = 2.4 * _frhs * _df_mass['S_AN'] + 5.1 * _frhl * _df_mass['L_AN']
|
|
45
|
+
_df['OM'] = 2.8 * _df_mass['S_OM'] + 6.1 * _frhl * _df_mass['L_OM']
|
|
46
|
+
_df['Soil'] = _df_mass['Soil']
|
|
47
|
+
_df['SS'] = 1.7 * _frhss * _df_mass['SS']
|
|
48
|
+
_df['EC'] = 10 * _df_mass['EC']
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
_df['total'] = _df.sum(axis=1)
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
_out = {}
|
|
52
|
+
return _df.dropna().reindex(_df_mass.index)
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
# calculate
|
|
55
|
+
_out = {'dry': _ext_cal()}
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
if _df_RH is not None:
|
|
58
|
+
_out['wet'] = _ext_cal(_df_RH)
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
return _out
|
|
@@ -1,62 +1,47 @@
|
|
|
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
|
-
|
|
12
|
+
out = _scaCoe(df_sca, instru=instru, specified_band=[550] if specified_band is None else specified_band)
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
@_run_process('Optical - SAE', 'SAE')
|
|
14
|
-
def SAE(self, df_sca):
|
|
15
|
-
from ._scattering import _SAE
|
|
14
|
+
return self, out
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
@run_process('Optical - absCoe', 'absCoe')
|
|
17
|
+
def absCoe(self, df_ae33, instru, specified_band):
|
|
18
|
+
from ._absorption import _absCoe
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
out = _absCoe(df_ae33, instru=instru, specified_band=[550] if specified_band is None else specified_band)
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
@_run_process('Optical - absCoe', 'absCoe')
|
|
23
|
-
def absCoe(self, df_ae33, abs_band=[550]):
|
|
24
|
-
from ._absorption import _absCoe
|
|
22
|
+
return self, out
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
@run_process('Optical - basic', 'opt_basic')
|
|
25
|
+
def basic(self, df_sca, df_abs, df_mass=None, df_no2=None, df_temp=None):
|
|
26
|
+
from ._extinction import _basic
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
out = _basic(df_sca, df_abs, df_mass, df_no2, df_temp)
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
def AAE(self, df_abs):
|
|
32
|
-
from ._absorption import _AAE
|
|
30
|
+
return self, out
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
@run_process('Optical - Mie', 'Mie')
|
|
33
|
+
def Mie(self, df_psd, df_m, wave_length=550):
|
|
34
|
+
from ._mie import _mie
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
out = _mie(df_psd, df_m, wave_length)
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
@_run_process('Optical - basic', 'opt_basic')
|
|
40
|
-
def basic(self, df_abs, df_sca, df_ec=None, df_mass=None, df_no2=None):
|
|
41
|
-
from ._extinction import _basic
|
|
38
|
+
return self, out
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
@run_process('Optical - IMPROVE', 'IMPROVE')
|
|
41
|
+
def IMPROVE(self, df_mass, df_RH, method='revised'):
|
|
42
|
+
# _fc = __import__(f'_IMPROVE._{method}')
|
|
43
|
+
from ._IMPROVE import _revised
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
out = _revised(df_mass, df_RH)
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
def Mie(self, df_psd, df_m, wave_length=550):
|
|
49
|
-
from ._mie import _mie
|
|
50
|
-
|
|
51
|
-
out = _mie(df_psd, df_m, wave_length)
|
|
52
|
-
|
|
53
|
-
return self, out
|
|
54
|
-
|
|
55
|
-
@_run_process('Optical - IMPROVE', 'IMPROVE')
|
|
56
|
-
def IMPROVE(self, df_mass, df_RH, method='revised'):
|
|
57
|
-
# _fc = __import__(f'_IMPROVE._{method}')
|
|
58
|
-
from ._IMPROVE import _revised
|
|
59
|
-
|
|
60
|
-
out = _revised(df_mass, df_RH)
|
|
61
|
-
|
|
62
|
-
return self, out
|
|
47
|
+
return self, out
|
|
@@ -1,54 +1,28 @@
|
|
|
1
|
-
def _absCoe(df,
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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,36 +1,42 @@
|
|
|
1
|
-
from AeroViz.dataProcess.core import _union_index
|
|
2
1
|
from pandas import DataFrame
|
|
3
2
|
|
|
3
|
+
from AeroViz.dataProcess.core import union_index
|
|
4
4
|
|
|
5
|
-
def _basic(df_abs, df_sca, df_ec, df_mass, df_no2):
|
|
6
|
-
df_abs, df_sca, df_ec, df_mass, df_no2 = _union_index(df_abs, df_sca, df_ec, df_mass, df_no2)
|
|
7
5
|
|
|
8
|
-
|
|
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)
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
df_out['abs'] = df_abs.copy()
|
|
12
|
-
df_out['sca'] = df_sca.copy()
|
|
9
|
+
df_out = DataFrame()
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
# abs and sca coe
|
|
12
|
+
df_out['abs'] = df_abs['abs_550'].copy()
|
|
13
|
+
df_out['sca'] = df_sca['sca_550'].copy()
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
# extinction coe.
|
|
16
|
+
df_out['ext'] = df_out['abs'] + df_out['sca']
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
df_out['MAE'] = df_out['abs'] / df_mass
|
|
23
|
-
df_out['MSE'] = df_out['sca'] / df_mass
|
|
24
|
-
df_out['MEE'] = df_out['MSE'] + df_out['MAE']
|
|
18
|
+
# SSA
|
|
19
|
+
df_out['SSA'] = df_out['sca'] / df_out['ext']
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
df_out['ext_all'] = df_out['ext'] + df_out['abs_gas'] + df_out['sca_gas']
|
|
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
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
# MAE, MSE, MEE
|
|
27
|
+
if df_mass is not None:
|
|
28
|
+
df_out['MAE'] = df_out['abs'] / df_mass
|
|
29
|
+
df_out['MSE'] = df_out['sca'] / df_mass
|
|
30
|
+
df_out['MEE'] = df_out['MSE'] + df_out['MAE']
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
# gas absorbtion
|
|
33
|
+
if df_no2 is not None:
|
|
34
|
+
df_out['abs_gas'] = df_no2 * .33
|
|
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']
|
|
41
|
+
|
|
42
|
+
return df_out
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
# from PyMieScatt import Mie_SD
|
|
2
|
-
# from PyMieScatt import Mie_SD
|
|
3
2
|
|
|
4
3
|
from ._mie_sd import Mie_SD
|
|
5
|
-
from pandas import date_range, concat, DataFrame, to_numeric
|
|
6
4
|
|
|
7
5
|
|
|
8
6
|
def _mie(_psd_ori, _RI_ori, _wave):
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
_ori_idx = _psd_ori.index.copy()
|
|
8
|
+
_cal_idx = _psd_ori.loc[_RI_ori.dropna().index].dropna(how='all').index
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
_psd, _RI = _psd_ori.loc[_cal_idx], _RI_ori.loc[_cal_idx]
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
_out = Mie_SD(_RI.values, 550, _psd)
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
return _out.reindex(_ori_idx)
|