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.

Files changed (121) hide show
  1. AeroViz/__init__.py +7 -5
  2. AeroViz/{config → data}/DEFAULT_DATA.csv +1 -1
  3. AeroViz/dataProcess/Chemistry/__init__.py +40 -40
  4. AeroViz/dataProcess/Chemistry/_calculate.py +15 -15
  5. AeroViz/dataProcess/Chemistry/_isoropia.py +72 -68
  6. AeroViz/dataProcess/Chemistry/_mass_volume.py +158 -161
  7. AeroViz/dataProcess/Chemistry/_ocec.py +109 -109
  8. AeroViz/dataProcess/Chemistry/_partition.py +19 -18
  9. AeroViz/dataProcess/Chemistry/_teom.py +9 -11
  10. AeroViz/dataProcess/Chemistry/isrpia.cnf +21 -0
  11. AeroViz/dataProcess/Optical/Angstrom_exponent.py +20 -0
  12. AeroViz/dataProcess/Optical/_IMPROVE.py +40 -41
  13. AeroViz/dataProcess/Optical/__init__.py +29 -44
  14. AeroViz/dataProcess/Optical/_absorption.py +21 -47
  15. AeroViz/dataProcess/Optical/_extinction.py +31 -25
  16. AeroViz/dataProcess/Optical/_mie.py +5 -7
  17. AeroViz/dataProcess/Optical/_mie_sd.py +89 -90
  18. AeroViz/dataProcess/Optical/_scattering.py +19 -20
  19. AeroViz/dataProcess/SizeDistr/__init__.py +39 -39
  20. AeroViz/dataProcess/SizeDistr/__merge.py +159 -158
  21. AeroViz/dataProcess/SizeDistr/_merge.py +155 -154
  22. AeroViz/dataProcess/SizeDistr/_merge_v1.py +162 -161
  23. AeroViz/dataProcess/SizeDistr/_merge_v2.py +153 -152
  24. AeroViz/dataProcess/SizeDistr/_merge_v3.py +327 -327
  25. AeroViz/dataProcess/SizeDistr/_merge_v4.py +273 -275
  26. AeroViz/dataProcess/SizeDistr/_size_distr.py +51 -51
  27. AeroViz/dataProcess/VOC/__init__.py +9 -9
  28. AeroViz/dataProcess/VOC/_potential_par.py +53 -55
  29. AeroViz/dataProcess/__init__.py +28 -6
  30. AeroViz/dataProcess/core/__init__.py +59 -65
  31. AeroViz/plot/__init__.py +7 -2
  32. AeroViz/plot/bar.py +126 -0
  33. AeroViz/plot/box.py +69 -0
  34. AeroViz/plot/distribution/distribution.py +421 -427
  35. AeroViz/plot/meteorology/meteorology.py +240 -292
  36. AeroViz/plot/optical/__init__.py +0 -1
  37. AeroViz/plot/optical/optical.py +230 -230
  38. AeroViz/plot/pie.py +198 -0
  39. AeroViz/plot/regression.py +196 -0
  40. AeroViz/plot/scatter.py +165 -0
  41. AeroViz/plot/templates/__init__.py +2 -4
  42. AeroViz/plot/templates/ammonium_rich.py +34 -0
  43. AeroViz/plot/templates/contour.py +25 -25
  44. AeroViz/plot/templates/corr_matrix.py +86 -93
  45. AeroViz/plot/templates/diurnal_pattern.py +28 -26
  46. AeroViz/plot/templates/koschmieder.py +59 -123
  47. AeroViz/plot/templates/metal_heatmap.py +135 -37
  48. AeroViz/plot/timeseries/__init__.py +1 -0
  49. AeroViz/plot/timeseries/template.py +47 -0
  50. AeroViz/plot/timeseries/timeseries.py +324 -264
  51. AeroViz/plot/utils/__init__.py +2 -1
  52. AeroViz/plot/utils/_color.py +57 -57
  53. AeroViz/plot/utils/_unit.py +48 -48
  54. AeroViz/plot/utils/plt_utils.py +92 -0
  55. AeroViz/plot/utils/sklearn_utils.py +49 -0
  56. AeroViz/plot/utils/units.json +5 -0
  57. AeroViz/plot/violin.py +80 -0
  58. AeroViz/process/__init__.py +17 -17
  59. AeroViz/process/core/DataProc.py +9 -9
  60. AeroViz/process/core/SizeDist.py +81 -81
  61. AeroViz/process/method/PyMieScatt_update.py +488 -488
  62. AeroViz/process/method/mie_theory.py +231 -229
  63. AeroViz/process/method/prop.py +40 -40
  64. AeroViz/process/script/AbstractDistCalc.py +103 -103
  65. AeroViz/process/script/Chemical.py +168 -167
  66. AeroViz/process/script/IMPACT.py +40 -40
  67. AeroViz/process/script/IMPROVE.py +152 -152
  68. AeroViz/process/script/Others.py +45 -45
  69. AeroViz/process/script/PSD.py +26 -26
  70. AeroViz/process/script/PSD_dry.py +69 -70
  71. AeroViz/process/script/retrieve_RI.py +50 -51
  72. AeroViz/rawDataReader/__init__.py +53 -58
  73. AeroViz/rawDataReader/config/supported_instruments.py +155 -0
  74. AeroViz/rawDataReader/core/__init__.py +233 -356
  75. AeroViz/rawDataReader/script/AE33.py +17 -18
  76. AeroViz/rawDataReader/script/AE43.py +18 -21
  77. AeroViz/rawDataReader/script/APS_3321.py +30 -30
  78. AeroViz/rawDataReader/script/Aurora.py +23 -24
  79. AeroViz/rawDataReader/script/BC1054.py +36 -40
  80. AeroViz/rawDataReader/script/EPA_vertical.py +37 -9
  81. AeroViz/rawDataReader/script/GRIMM.py +16 -23
  82. AeroViz/rawDataReader/script/IGAC.py +90 -0
  83. AeroViz/rawDataReader/script/MA350.py +32 -39
  84. AeroViz/rawDataReader/script/Minion.py +103 -0
  85. AeroViz/rawDataReader/script/NEPH.py +69 -74
  86. AeroViz/rawDataReader/script/SMPS_TH.py +25 -25
  87. AeroViz/rawDataReader/script/SMPS_aim11.py +32 -32
  88. AeroViz/rawDataReader/script/SMPS_genr.py +31 -31
  89. AeroViz/rawDataReader/script/Sunset_OCEC.py +60 -0
  90. AeroViz/rawDataReader/script/TEOM.py +30 -28
  91. AeroViz/rawDataReader/script/Table.py +13 -14
  92. AeroViz/rawDataReader/script/VOC.py +26 -0
  93. AeroViz/rawDataReader/script/__init__.py +18 -20
  94. AeroViz/tools/database.py +64 -66
  95. AeroViz/tools/dataclassifier.py +106 -106
  96. AeroViz/tools/dataprinter.py +51 -51
  97. AeroViz/tools/datareader.py +38 -38
  98. {AeroViz-0.1.3.dist-info → AeroViz-0.1.4.dist-info}/METADATA +5 -4
  99. AeroViz-0.1.4.dist-info/RECORD +112 -0
  100. AeroViz/plot/improve/__init__.py +0 -1
  101. AeroViz/plot/improve/improve.py +0 -240
  102. AeroViz/plot/optical/aethalometer.py +0 -77
  103. AeroViz/plot/templates/event_evolution.py +0 -65
  104. AeroViz/plot/templates/regression.py +0 -256
  105. AeroViz/plot/templates/scatter.py +0 -130
  106. AeroViz/plot/templates/templates.py +0 -398
  107. AeroViz/plot/utils/_decorator.py +0 -74
  108. AeroViz/rawDataReader/script/IGAC_TH.py +0 -104
  109. AeroViz/rawDataReader/script/IGAC_ZM.py +0 -90
  110. AeroViz/rawDataReader/script/OCEC_LCRES.py +0 -34
  111. AeroViz/rawDataReader/script/OCEC_RES.py +0 -28
  112. AeroViz/rawDataReader/script/VOC_TH.py +0 -30
  113. AeroViz/rawDataReader/script/VOC_ZM.py +0 -37
  114. AeroViz/rawDataReader/utils/__init__.py +0 -0
  115. AeroViz/rawDataReader/utils/config.py +0 -169
  116. AeroViz-0.1.3.dist-info/RECORD +0 -111
  117. /AeroViz/{config → data}/DEFAULT_PNSD_DATA.csv +0 -0
  118. /AeroViz/{config → rawDataReader/config}/__init__.py +0 -0
  119. {AeroViz-0.1.3.dist-info → AeroViz-0.1.4.dist-info}/LICENSE +0 -0
  120. {AeroViz-0.1.3.dist-info → AeroViz-0.1.4.dist-info}/WHEEL +0 -0
  121. {AeroViz-0.1.3.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 Optical, SizeDistr, Chemistry, VOC
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
- 'plot',
9
- 'RawDataReader',
10
- 'Optical', 'SizeDistr', 'Chemistry', 'VOC',
11
- 'DataBase', 'DataReader', 'DataClassifier'
8
+ 'plot',
9
+ 'RawDataReader',
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,PM25,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
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,63 +1,63 @@
1
- from ..core import _writter, _run_process
1
+ from ..core import Writer, run_process
2
2
 
3
3
  __all__ = [
4
4
 
5
- 'Chemistry',
5
+ 'Chemistry',
6
6
 
7
7
  ]
8
8
 
9
9
 
10
- class Chemistry(_writter):
10
+ class Chemistry(Writer):
11
11
 
12
- ## Reconstruction
13
- @_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']):
16
- from ._mass_volume import _basic
12
+ ## Reconstruction
13
+ @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']):
16
+ from ._mass_volume import _basic
17
17
 
18
- out = _basic(df_chem, df_ref, df_water, df_density, nam_lst=nam_lst)
18
+ out = _basic(df_chem, df_ref, df_water, df_density, nam_lst=nam_lst)
19
19
 
20
- return self, out
20
+ return self, out
21
21
 
22
- ## Partition
23
- @_run_process('Chemistry - Partition', 'partition')
24
- def Partition(self, *df_chem, nam_lst=['NH4+', 'SO42-', 'NO3-', 'Cl-', 'NO2', 'HNO3', 'SO2', 'NH3', 'HCl', 'temp']):
25
- from ._partition import _basic
22
+ ## Partition
23
+ @run_process('Chemistry - Partition', 'partition')
24
+ def Partition(self, *df_chem, nam_lst=['NH4+', 'SO42-', 'NO3-', 'Cl-', 'NO2', 'HNO3', 'SO2', 'NH3', 'HCl', 'temp']):
25
+ from ._partition import _basic
26
26
 
27
- out = _basic(df_chem, nam_lst=nam_lst)
27
+ out = _basic(df_chem, nam_lst=nam_lst)
28
28
 
29
- return self, out
29
+ return self, out
30
30
 
31
- ## ISOROPIA
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']):
36
- from ._isoropia import _basic
31
+ ## ISOROPIA
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']):
36
+ from ._isoropia import _basic
37
37
 
38
- if self.path_out is None:
39
- raise ValueError('Please Input "path_out" !!')
38
+ if self.path_out is None:
39
+ raise ValueError('Please Input "path_out" !!')
40
40
 
41
- out = _basic(df_chem, self.path_out, nam_lst=nam_lst)
41
+ out = _basic(df_chem, self.path_out, nam_lst=nam_lst)
42
42
 
43
- return self, out
43
+ return self, out
44
44
 
45
- ## OCEC
46
- @_run_process('Chemistry - OC/EC basic', 'ocec_basic')
47
- def OCEC_basic(self, df_lcres, df_res, df_mass=None, ocec_ratio=None, ocec_ratio_month=1, hr_lim=200,
48
- least_square_range=(0.1, 2.5, 0.1), WISOC_OC_range=(0.2, 0.7, 0.01), ):
49
- from ._ocec import _basic
45
+ ## OCEC
46
+ @run_process('Chemistry - OC/EC basic', 'ocec_basic')
47
+ def OCEC_basic(self, df_lcres, df_res, df_mass=None, ocec_ratio=None, ocec_ratio_month=1, hr_lim=200,
48
+ least_square_range=(0.1, 2.5, 0.1), WISOC_OC_range=(0.2, 0.7, 0.01), ):
49
+ from ._ocec import _basic
50
50
 
51
- out = _basic(df_lcres, df_res, df_mass, ocec_ratio, ocec_ratio_month, hr_lim, least_square_range,
52
- WISOC_OC_range)
51
+ out = _basic(df_lcres, df_res, df_mass, ocec_ratio, ocec_ratio_month, hr_lim, least_square_range,
52
+ WISOC_OC_range)
53
53
 
54
- return self, out
54
+ return self, out
55
55
 
56
- ## TEOM
57
- @_run_process('Chemistry - TEOM basic', 'teom_basic')
58
- def TEOM_basic(self, df_teom, df_check=None):
59
- from ._teom import _basic
56
+ ## TEOM
57
+ @run_process('Chemistry - TEOM basic', 'teom_basic')
58
+ def TEOM_basic(self, df_teom, df_check=None):
59
+ from ._teom import _basic
60
60
 
61
- out = _basic(df_teom, df_check)
61
+ out = _basic(df_teom, df_check)
62
62
 
63
- return self, out
63
+ return self, out
@@ -1,27 +1,27 @@
1
- from pandas import concat, DataFrame
1
+ from pandas import concat
2
2
 
3
3
  # parameter
4
4
  _mol_wg = {
5
- 'SO42-': 96.06,
6
- 'NO3-': 62.00,
7
- 'Cl-': 35.4,
5
+ 'SO42-': 96.06,
6
+ 'NO3-': 62.00,
7
+ 'Cl-': 35.4,
8
8
 
9
- 'Ca2+': 40.078,
10
- 'K+': 39.098,
11
- 'Mg2+': 24.305,
12
- 'Na+': 22.99,
13
- 'NH4+': 18.04,
9
+ 'Ca2+': 40.078,
10
+ 'K+': 39.098,
11
+ 'Mg2+': 24.305,
12
+ 'Na+': 22.99,
13
+ 'NH4+': 18.04,
14
14
  }
15
15
 
16
16
 
17
17
  # ug -> umol
18
18
  def _ug2umol(_df):
19
- _pt_ky = list(set(_df.keys()) & set(_mol_wg.keys()))
20
- _gas_ky = list(set(_df.keys()) - set(_mol_wg.keys()) - set(['temp', 'RH']))
19
+ _pt_ky = list(set(_df.keys()) & set(_mol_wg.keys()))
20
+ _gas_ky = list(set(_df.keys()) - set(_mol_wg.keys()) - set(['temp', 'RH']))
21
21
 
22
- _par = (_df['temp'].to_frame() + 273.15) * .082
22
+ _par = (_df['temp'].to_frame() + 273.15) * .082
23
23
 
24
- _df_pt = concat([(_df[_ky] / _mol_wg[_ky]).copy() for _ky in _pt_ky], axis=1)
25
- _df_gas = _df[_gas_ky] / _par.values
24
+ _df_pt = concat([(_df[_ky] / _mol_wg[_ky]).copy() for _ky in _pt_ky], axis=1)
25
+ _df_gas = _df[_gas_ky] / _par.values
26
26
 
27
- return concat([_df_pt, _df_gas], axis=1)
27
+ return concat([_df_pt, _df_gas], axis=1)
@@ -1,99 +1,103 @@
1
+ from pathlib import Path
1
2
  from subprocess import Popen, PIPE
2
- from pandas import date_range, concat, DataFrame, to_numeric, read_csv
3
- from ._calculate import _ug2umol
3
+
4
4
  import numpy as np
5
+ from pandas import concat, DataFrame, to_numeric, read_csv
5
6
 
6
- from pathlib import Path
7
+ from ._calculate import _ug2umol
8
+
9
+
10
+ # TODO: fix isoropia2.exe can not run
7
11
 
8
12
 
9
13
  def _basic(df_che, path_out, nam_lst):
10
- # parameter
11
- df_all = concat(df_che, axis=1)
12
- index = df_all.index.copy()
13
- df_all.columns = nam_lst
14
+ # parameter
15
+ df_all = concat(df_che, axis=1)
16
+ index = df_all.index.copy()
17
+ df_all.columns = nam_lst
14
18
 
15
- df_umol = _ug2umol(df_all)
19
+ df_umol = _ug2umol(df_all)
16
20
 
17
- ## output
18
- ## Na, SO4, NH3, NO3, Cl, Ca, K, Mg, RH, TEMP
19
- df_input = DataFrame(index=index)
20
- df_out = DataFrame(index=index)
21
+ ## output
22
+ ## Na, SO4, NH3, NO3, Cl, Ca, K, Mg, RH, TEMP
23
+ df_input = DataFrame(index=index)
24
+ df_out = DataFrame(index=index)
21
25
 
22
- pth_input = path_out / '_temp_input.txt'
23
- pth_output = path_out / '_temp_input.dat'
26
+ pth_input = path_out / '_temp_input.txt'
27
+ pth_output = path_out / '_temp_input.dat'
24
28
 
25
- pth_input.unlink(missing_ok=True)
26
- pth_output.unlink(missing_ok=True)
29
+ pth_input.unlink(missing_ok=True)
30
+ pth_output.unlink(missing_ok=True)
27
31
 
28
- ## header
29
- _header = 'Input units (0=umol/m3, 1=ug/m3)\n' + '0\n\n' + \
30
- 'Problem type (0=forward, 1=reverse); Phase state (0=solid+liquid, 1=metastable)\n' + '0, 1\n\n' + \
31
- 'NH4-SO4 system case\n'
32
+ ## header
33
+ _header = 'Input units (0=umol/m3, 1=ug/m3)\n' + '0\n\n' + \
34
+ 'Problem type (0=forward, 1=reverse); Phase state (0=solid+liquid, 1=metastable)\n' + '0, 1\n\n' + \
35
+ 'NH4-SO4 system case\n'
32
36
 
33
- ## software
34
- path_iso = Path(__file__).parent / 'isrpia2.exe'
37
+ ## software
38
+ path_iso = Path(__file__).parent / 'isrpia2.exe'
35
39
 
36
- # make input file and output temp input (without index)
37
- ## NH3
38
- df_input['NH3'] = df_umol['NH4+'].fillna(0).copy() + df_umol['NH3']
40
+ # make input file and output temp input (without index)
41
+ ## NH3
42
+ df_input['NH3'] = df_umol['NH4+'].fillna(0).copy() + df_umol['NH3']
39
43
 
40
- ## NO3
41
- df_input['NO3'] = df_umol['HNO3'].fillna(0).copy() + df_umol['NO3-']
44
+ ## NO3
45
+ df_input['NO3'] = df_umol['HNO3'].fillna(0).copy() + df_umol['NO3-']
42
46
 
43
- ## Cl
44
- df_input['Cl'] = df_umol['HCl'].fillna(0).copy() + df_umol['Cl-']
47
+ ## Cl
48
+ df_input['Cl'] = df_umol['HCl'].fillna(0).copy() + df_umol['Cl-']
45
49
 
46
- ## temp, RH
47
- df_input['RH'] = df_all['RH'] / 100
48
- df_input['TEMP'] = df_all['temp'] + 273.15
50
+ ## temp, RH
51
+ df_input['RH'] = df_all['RH'] / 100
52
+ df_input['TEMP'] = df_all['temp'] + 273.15
49
53
 
50
- df_input[['Na', 'SO4', 'Ca', 'K', 'Mg']] = df_umol[['Na+', 'SO42-', 'Ca2+', 'K+', 'Mg2+']].copy()
54
+ df_input[['Na', 'SO4', 'Ca', 'K', 'Mg']] = df_umol[['Na+', 'SO42-', 'Ca2+', 'K+', 'Mg2+']].copy()
51
55
 
52
- df_input = df_input[['Na', 'SO4', 'NH3', 'NO3', 'Cl', 'Ca', 'K', 'Mg', 'RH', 'TEMP']].fillna('-').copy()
56
+ df_input = df_input[['Na', 'SO4', 'NH3', 'NO3', 'Cl', 'Ca', 'K', 'Mg', 'RH', 'TEMP']].fillna('-').copy()
53
57
 
54
- ## output the input data
55
- df_input.to_csv(pth_input, index=False)
56
- with (pth_input).open('r+', encoding='utf-8', errors='ignore') as _f:
57
- _cont = _f.read()
58
- _f.seek(0)
58
+ ## output the input data
59
+ df_input.to_csv(pth_input, index=False)
60
+ with (pth_input).open('r+', encoding='utf-8', errors='ignore') as _f:
61
+ _cont = _f.read()
62
+ _f.seek(0)
59
63
 
60
- _f.write(_header)
61
- _f.write(_cont)
64
+ _f.write(_header)
65
+ _f.write(_cont)
62
66
 
63
- # use ISOROPIA2
64
- run = Popen([path_iso], stdin=PIPE, stdout=PIPE, stderr=PIPE)
65
- scrn_res, run_res = run.communicate(input=str(pth_input.resolve()).encode())
67
+ # use ISOROPIA2
68
+ run = Popen([path_iso], stdin=PIPE, stdout=PIPE, stderr=PIPE)
69
+ scrn_res, run_res = run.communicate(input=str(pth_input.resolve()).encode())
66
70
 
67
- # read dat file and transform to the normal name
68
- cond_idx = df_all[['SO42-', 'NH4+', 'NO3-']].dropna().index
71
+ # read dat file and transform to the normal name
72
+ cond_idx = df_all[['SO42-', 'NH4+', 'NO3-']].dropna().index
69
73
 
70
- with (pth_output).open('r', encoding='utf-8', errors='ignore') as f:
71
- 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)
72
76
 
73
- df_out['H'] = df_res['HLIQ'] / (df_res['WATER'] / 1000)
77
+ df_out['H'] = df_res['HLIQ'] / (df_res['WATER'] / 1000)
74
78
 
75
- df_out.loc[cond_idx, 'pH'] = -np.log10(df_out['H'].loc[cond_idx])
76
- df_out['pH'] = df_out['pH'].where((df_all['RH'] <= 95) & (df_all['RH'] >= 20))
79
+ df_out.loc[cond_idx, 'pH'] = -np.log10(df_out['H'].loc[cond_idx])
80
+ df_out['pH'] = df_out['pH'].where((df_all['RH'] <= 95) & (df_all['RH'] >= 20))
77
81
 
78
- cond_idx = df_out['pH'].dropna().index
79
- df_out.loc[cond_idx, 'ALWC'] = df_res['WATER'].loc[cond_idx]
82
+ cond_idx = df_out['pH'].dropna().index
83
+ df_out.loc[cond_idx, 'ALWC'] = df_res['WATER'].loc[cond_idx]
80
84
 
81
- df_out[['NH3', 'HNO3', 'HCl', 'NH4+', 'NO3-', 'Cl-']] = df_res[
82
- ['GNH3', 'GHNO3', 'GHCL', 'NH4AER', 'NO3AER', 'CLAER']]
85
+ df_out[['NH3', 'HNO3', 'HCl', 'NH4+', 'NO3-', 'Cl-']] = df_res[
86
+ ['GNH3', 'GHNO3', 'GHCL', 'NH4AER', 'NO3AER', 'CLAER']]
83
87
 
84
- # calculate partition
85
- # df_out['epls_NO3-'] = df_umol['NO3-'] / (df_umol['NO3-'] + df_umol['HNO3'])
86
- # df_out['epls_NH4+'] = df_umol['NH4+'] / (df_umol['NH4+'] + df_umol['NH3'])
87
- # df_out['epls_Cl-'] = df_umol['Cl-'] / (df_umol['Cl-'] + df_umol['HCl'])
88
+ # calculate partition
89
+ # df_out['epls_NO3-'] = df_umol['NO3-'] / (df_umol['NO3-'] + df_umol['HNO3'])
90
+ # df_out['epls_NH4+'] = df_umol['NH4+'] / (df_umol['NH4+'] + df_umol['NH3'])
91
+ # df_out['epls_Cl-'] = df_umol['Cl-'] / (df_umol['Cl-'] + df_umol['HCl'])
88
92
 
89
- # remove _temp file (input and output)
90
- pth_input.unlink(missing_ok=True)
91
- pth_output.unlink(missing_ok=True)
93
+ # remove _temp file (input and output)
94
+ pth_input.unlink(missing_ok=True)
95
+ pth_output.unlink(missing_ok=True)
92
96
 
93
- # output input and output
94
- out = {
95
- 'input': df_input,
96
- 'output': df_out,
97
- }
97
+ # output input and output
98
+ out = {
99
+ 'input': df_input,
100
+ 'output': df_out,
101
+ }
98
102
 
99
- return out
103
+ return out