AeroViz 0.1.3__tar.gz → 0.1.3b0__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.

Files changed (205) hide show
  1. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/__init__.py +4 -4
  2. aeroviz-0.1.3b0/AeroViz/dataProcess/Chemistry/__init__.py +63 -0
  3. aeroviz-0.1.3b0/AeroViz/dataProcess/Chemistry/_calculate.py +27 -0
  4. aeroviz-0.1.3b0/AeroViz/dataProcess/Chemistry/_isoropia.py +100 -0
  5. aeroviz-0.1.3b0/AeroViz/dataProcess/Chemistry/_mass_volume.py +175 -0
  6. aeroviz-0.1.3b0/AeroViz/dataProcess/Chemistry/_ocec.py +184 -0
  7. aeroviz-0.1.3b0/AeroViz/dataProcess/Chemistry/_partition.py +30 -0
  8. aeroviz-0.1.3b0/AeroViz/dataProcess/Chemistry/_teom.py +13 -0
  9. aeroviz-0.1.3b0/AeroViz/dataProcess/Optical/_IMPROVE.py +62 -0
  10. aeroviz-0.1.3b0/AeroViz/dataProcess/Optical/__init__.py +62 -0
  11. aeroviz-0.1.3b0/AeroViz/dataProcess/Optical/_absorption.py +54 -0
  12. aeroviz-0.1.3b0/AeroViz/dataProcess/Optical/_extinction.py +37 -0
  13. aeroviz-0.1.3b0/AeroViz/dataProcess/Optical/_mie.py +15 -0
  14. aeroviz-0.1.3b0/AeroViz/dataProcess/Optical/_mie_sd.py +142 -0
  15. aeroviz-0.1.3b0/AeroViz/dataProcess/Optical/_scattering.py +30 -0
  16. aeroviz-0.1.3b0/AeroViz/dataProcess/SizeDistr/__init__.py +61 -0
  17. aeroviz-0.1.3b0/AeroViz/dataProcess/SizeDistr/__merge.py +251 -0
  18. aeroviz-0.1.3b0/AeroViz/dataProcess/SizeDistr/_merge.py +246 -0
  19. aeroviz-0.1.3b0/AeroViz/dataProcess/SizeDistr/_merge_v1.py +255 -0
  20. aeroviz-0.1.3b0/AeroViz/dataProcess/SizeDistr/_merge_v2.py +244 -0
  21. aeroviz-0.1.3b0/AeroViz/dataProcess/SizeDistr/_merge_v3.py +518 -0
  22. aeroviz-0.1.3b0/AeroViz/dataProcess/SizeDistr/_merge_v4.py +422 -0
  23. aeroviz-0.1.3b0/AeroViz/dataProcess/SizeDistr/_size_distr.py +93 -0
  24. aeroviz-0.1.3b0/AeroViz/dataProcess/VOC/__init__.py +19 -0
  25. aeroviz-0.1.3b0/AeroViz/dataProcess/VOC/_potential_par.py +74 -0
  26. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/dataProcess/__init__.py +4 -4
  27. aeroviz-0.1.3b0/AeroViz/dataProcess/core/__init__.py +93 -0
  28. aeroviz-0.1.3b0/AeroViz/plot/__init__.py +12 -0
  29. aeroviz-0.1.3b0/AeroViz/plot/bar.py +126 -0
  30. aeroviz-0.1.3b0/AeroViz/plot/box.py +68 -0
  31. aeroviz-0.1.3b0/AeroViz/plot/distribution/distribution.py +576 -0
  32. aeroviz-0.1.3b0/AeroViz/plot/meteorology/meteorology.py +265 -0
  33. aeroviz-0.1.3b0/AeroViz/plot/optical/__init__.py +1 -0
  34. aeroviz-0.1.3b0/AeroViz/plot/optical/optical.py +388 -0
  35. aeroviz-0.1.3b0/AeroViz/plot/pie.py +198 -0
  36. aeroviz-0.1.3b0/AeroViz/plot/regression.py +210 -0
  37. aeroviz-0.1.3b0/AeroViz/plot/scatter.py +99 -0
  38. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/plot/templates/__init__.py +0 -3
  39. aeroviz-0.1.3b0/AeroViz/plot/templates/contour.py +47 -0
  40. aeroviz-0.1.3b0/AeroViz/plot/templates/corr_matrix.py +101 -0
  41. aeroviz-0.1.3b0/AeroViz/plot/templates/diurnal_pattern.py +42 -0
  42. aeroviz-0.1.3b0/AeroViz/plot/templates/koschmieder.py +156 -0
  43. aeroviz-0.1.3b0/AeroViz/plot/templates/metal_heatmap.py +57 -0
  44. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/plot/timeseries/timeseries.py +53 -60
  45. aeroviz-0.1.3b0/AeroViz/plot/utils/__init__.py +4 -0
  46. aeroviz-0.1.3b0/AeroViz/plot/utils/_color.py +71 -0
  47. aeroviz-0.1.3b0/AeroViz/plot/utils/_unit.py +55 -0
  48. aeroviz-0.1.3b0/AeroViz/plot/utils/plt_utils.py +92 -0
  49. aeroviz-0.1.3b0/AeroViz/plot/utils/sklearn_utils.py +49 -0
  50. aeroviz-0.1.3b0/AeroViz/plot/violin.py +79 -0
  51. aeroviz-0.1.3b0/AeroViz/process/__init__.py +31 -0
  52. aeroviz-0.1.3b0/AeroViz/process/core/DataProc.py +19 -0
  53. aeroviz-0.1.3b0/AeroViz/process/core/SizeDist.py +90 -0
  54. aeroviz-0.1.3b0/AeroViz/process/method/PyMieScatt_update.py +567 -0
  55. aeroviz-0.1.3b0/AeroViz/process/method/mie_theory.py +260 -0
  56. aeroviz-0.1.3b0/AeroViz/process/method/prop.py +62 -0
  57. aeroviz-0.1.3b0/AeroViz/process/script/AbstractDistCalc.py +143 -0
  58. aeroviz-0.1.3b0/AeroViz/process/script/Chemical.py +176 -0
  59. aeroviz-0.1.3b0/AeroViz/process/script/IMPACT.py +49 -0
  60. aeroviz-0.1.3b0/AeroViz/process/script/IMPROVE.py +161 -0
  61. aeroviz-0.1.3b0/AeroViz/process/script/Others.py +65 -0
  62. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/process/script/PSD.py +26 -26
  63. aeroviz-0.1.3b0/AeroViz/process/script/PSD_dry.py +93 -0
  64. aeroviz-0.1.3b0/AeroViz/process/script/retrieve_RI.py +69 -0
  65. aeroviz-0.1.3b0/AeroViz/rawDataReader/__init__.py +68 -0
  66. aeroviz-0.1.3b0/AeroViz/rawDataReader/core/__init__.py +402 -0
  67. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/AE33.py +31 -0
  68. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/AE43.py +34 -0
  69. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/APS_3321.py +47 -0
  70. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/Aurora.py +38 -0
  71. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/BC1054.py +46 -0
  72. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/EPA_vertical.py +18 -0
  73. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/GRIMM.py +35 -0
  74. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/IGAC_TH.py +104 -0
  75. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/IGAC_ZM.py +90 -0
  76. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/MA350.py +45 -0
  77. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/NEPH.py +80 -0
  78. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/OCEC_LCRES.py +34 -0
  79. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/OCEC_RES.py +28 -0
  80. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/SMPS_TH.py +41 -0
  81. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/SMPS_aim11.py +51 -0
  82. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/SMPS_genr.py +51 -0
  83. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/TEOM.py +46 -0
  84. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/Table.py +28 -0
  85. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/VOC_TH.py +30 -0
  86. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/VOC_ZM.py +37 -0
  87. aeroviz-0.1.3b0/AeroViz/rawDataReader/script/__init__.py +22 -0
  88. aeroviz-0.1.3b0/AeroViz/rawDataReader/utils/config.py +169 -0
  89. aeroviz-0.1.3b0/AeroViz/tools/database.py +97 -0
  90. aeroviz-0.1.3b0/AeroViz/tools/dataclassifier.py +117 -0
  91. aeroviz-0.1.3b0/AeroViz/tools/dataprinter.py +58 -0
  92. aeroviz-0.1.3b0/AeroViz/tools/datareader.py +66 -0
  93. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz.egg-info/PKG-INFO +5 -4
  94. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz.egg-info/SOURCES.txt +8 -9
  95. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/PKG-INFO +5 -4
  96. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/README.md +4 -3
  97. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/setup.py +1 -1
  98. aeroviz-0.1.3/AeroViz/dataProcess/Chemistry/__init__.py +0 -63
  99. aeroviz-0.1.3/AeroViz/dataProcess/Chemistry/_calculate.py +0 -27
  100. aeroviz-0.1.3/AeroViz/dataProcess/Chemistry/_isoropia.py +0 -99
  101. aeroviz-0.1.3/AeroViz/dataProcess/Chemistry/_mass_volume.py +0 -175
  102. aeroviz-0.1.3/AeroViz/dataProcess/Chemistry/_ocec.py +0 -184
  103. aeroviz-0.1.3/AeroViz/dataProcess/Chemistry/_partition.py +0 -29
  104. aeroviz-0.1.3/AeroViz/dataProcess/Chemistry/_teom.py +0 -16
  105. aeroviz-0.1.3/AeroViz/dataProcess/Optical/_IMPROVE.py +0 -61
  106. aeroviz-0.1.3/AeroViz/dataProcess/Optical/__init__.py +0 -62
  107. aeroviz-0.1.3/AeroViz/dataProcess/Optical/_absorption.py +0 -54
  108. aeroviz-0.1.3/AeroViz/dataProcess/Optical/_extinction.py +0 -36
  109. aeroviz-0.1.3/AeroViz/dataProcess/Optical/_mie.py +0 -16
  110. aeroviz-0.1.3/AeroViz/dataProcess/Optical/_mie_sd.py +0 -143
  111. aeroviz-0.1.3/AeroViz/dataProcess/Optical/_scattering.py +0 -30
  112. aeroviz-0.1.3/AeroViz/dataProcess/SizeDistr/__init__.py +0 -61
  113. aeroviz-0.1.3/AeroViz/dataProcess/SizeDistr/__merge.py +0 -250
  114. aeroviz-0.1.3/AeroViz/dataProcess/SizeDistr/_merge.py +0 -245
  115. aeroviz-0.1.3/AeroViz/dataProcess/SizeDistr/_merge_v1.py +0 -254
  116. aeroviz-0.1.3/AeroViz/dataProcess/SizeDistr/_merge_v2.py +0 -243
  117. aeroviz-0.1.3/AeroViz/dataProcess/SizeDistr/_merge_v3.py +0 -518
  118. aeroviz-0.1.3/AeroViz/dataProcess/SizeDistr/_merge_v4.py +0 -424
  119. aeroviz-0.1.3/AeroViz/dataProcess/SizeDistr/_size_distr.py +0 -93
  120. aeroviz-0.1.3/AeroViz/dataProcess/VOC/__init__.py +0 -19
  121. aeroviz-0.1.3/AeroViz/dataProcess/VOC/_potential_par.py +0 -76
  122. aeroviz-0.1.3/AeroViz/dataProcess/core/__init__.py +0 -92
  123. aeroviz-0.1.3/AeroViz/plot/__init__.py +0 -7
  124. aeroviz-0.1.3/AeroViz/plot/distribution/distribution.py +0 -582
  125. aeroviz-0.1.3/AeroViz/plot/improve/__init__.py +0 -1
  126. aeroviz-0.1.3/AeroViz/plot/improve/improve.py +0 -240
  127. aeroviz-0.1.3/AeroViz/plot/meteorology/meteorology.py +0 -317
  128. aeroviz-0.1.3/AeroViz/plot/optical/__init__.py +0 -2
  129. aeroviz-0.1.3/AeroViz/plot/optical/aethalometer.py +0 -77
  130. aeroviz-0.1.3/AeroViz/plot/optical/optical.py +0 -388
  131. aeroviz-0.1.3/AeroViz/plot/templates/contour.py +0 -47
  132. aeroviz-0.1.3/AeroViz/plot/templates/corr_matrix.py +0 -108
  133. aeroviz-0.1.3/AeroViz/plot/templates/diurnal_pattern.py +0 -42
  134. aeroviz-0.1.3/AeroViz/plot/templates/event_evolution.py +0 -65
  135. aeroviz-0.1.3/AeroViz/plot/templates/koschmieder.py +0 -156
  136. aeroviz-0.1.3/AeroViz/plot/templates/metal_heatmap.py +0 -57
  137. aeroviz-0.1.3/AeroViz/plot/templates/regression.py +0 -256
  138. aeroviz-0.1.3/AeroViz/plot/templates/scatter.py +0 -130
  139. aeroviz-0.1.3/AeroViz/plot/templates/templates.py +0 -398
  140. aeroviz-0.1.3/AeroViz/plot/utils/__init__.py +0 -3
  141. aeroviz-0.1.3/AeroViz/plot/utils/_color.py +0 -71
  142. aeroviz-0.1.3/AeroViz/plot/utils/_decorator.py +0 -74
  143. aeroviz-0.1.3/AeroViz/plot/utils/_unit.py +0 -55
  144. aeroviz-0.1.3/AeroViz/process/__init__.py +0 -31
  145. aeroviz-0.1.3/AeroViz/process/core/DataProc.py +0 -19
  146. aeroviz-0.1.3/AeroViz/process/core/SizeDist.py +0 -90
  147. aeroviz-0.1.3/AeroViz/process/method/PyMieScatt_update.py +0 -567
  148. aeroviz-0.1.3/AeroViz/process/method/mie_theory.py +0 -258
  149. aeroviz-0.1.3/AeroViz/process/method/prop.py +0 -62
  150. aeroviz-0.1.3/AeroViz/process/script/AbstractDistCalc.py +0 -143
  151. aeroviz-0.1.3/AeroViz/process/script/Chemical.py +0 -176
  152. aeroviz-0.1.3/AeroViz/process/script/IMPACT.py +0 -49
  153. aeroviz-0.1.3/AeroViz/process/script/IMPROVE.py +0 -161
  154. aeroviz-0.1.3/AeroViz/process/script/Others.py +0 -65
  155. aeroviz-0.1.3/AeroViz/process/script/PSD_dry.py +0 -94
  156. aeroviz-0.1.3/AeroViz/process/script/retrieve_RI.py +0 -70
  157. aeroviz-0.1.3/AeroViz/rawDataReader/__init__.py +0 -68
  158. aeroviz-0.1.3/AeroViz/rawDataReader/core/__init__.py +0 -400
  159. aeroviz-0.1.3/AeroViz/rawDataReader/script/AE33.py +0 -31
  160. aeroviz-0.1.3/AeroViz/rawDataReader/script/AE43.py +0 -34
  161. aeroviz-0.1.3/AeroViz/rawDataReader/script/APS_3321.py +0 -47
  162. aeroviz-0.1.3/AeroViz/rawDataReader/script/Aurora.py +0 -38
  163. aeroviz-0.1.3/AeroViz/rawDataReader/script/BC1054.py +0 -46
  164. aeroviz-0.1.3/AeroViz/rawDataReader/script/EPA_vertical.py +0 -18
  165. aeroviz-0.1.3/AeroViz/rawDataReader/script/GRIMM.py +0 -35
  166. aeroviz-0.1.3/AeroViz/rawDataReader/script/IGAC_TH.py +0 -104
  167. aeroviz-0.1.3/AeroViz/rawDataReader/script/IGAC_ZM.py +0 -90
  168. aeroviz-0.1.3/AeroViz/rawDataReader/script/MA350.py +0 -45
  169. aeroviz-0.1.3/AeroViz/rawDataReader/script/NEPH.py +0 -80
  170. aeroviz-0.1.3/AeroViz/rawDataReader/script/OCEC_LCRES.py +0 -34
  171. aeroviz-0.1.3/AeroViz/rawDataReader/script/OCEC_RES.py +0 -28
  172. aeroviz-0.1.3/AeroViz/rawDataReader/script/SMPS_TH.py +0 -41
  173. aeroviz-0.1.3/AeroViz/rawDataReader/script/SMPS_aim11.py +0 -51
  174. aeroviz-0.1.3/AeroViz/rawDataReader/script/SMPS_genr.py +0 -51
  175. aeroviz-0.1.3/AeroViz/rawDataReader/script/TEOM.py +0 -46
  176. aeroviz-0.1.3/AeroViz/rawDataReader/script/Table.py +0 -28
  177. aeroviz-0.1.3/AeroViz/rawDataReader/script/VOC_TH.py +0 -30
  178. aeroviz-0.1.3/AeroViz/rawDataReader/script/VOC_ZM.py +0 -37
  179. aeroviz-0.1.3/AeroViz/rawDataReader/script/__init__.py +0 -22
  180. aeroviz-0.1.3/AeroViz/rawDataReader/utils/__init__.py +0 -0
  181. aeroviz-0.1.3/AeroViz/rawDataReader/utils/config.py +0 -169
  182. aeroviz-0.1.3/AeroViz/tools/database.py +0 -97
  183. aeroviz-0.1.3/AeroViz/tools/dataclassifier.py +0 -117
  184. aeroviz-0.1.3/AeroViz/tools/dataprinter.py +0 -58
  185. aeroviz-0.1.3/AeroViz/tools/datareader.py +0 -66
  186. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/config/DEFAULT_DATA.csv +0 -0
  187. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/config/DEFAULT_PNSD_DATA.csv +0 -0
  188. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/dataProcess/VOC/voc_par.json +0 -0
  189. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/plot/distribution/__init__.py +0 -0
  190. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/plot/meteorology/__init__.py +0 -0
  191. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/plot/timeseries/__init__.py +0 -0
  192. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/plot/utils/fRH.json +0 -0
  193. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/plot/utils/units.json +0 -0
  194. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/process/core/__init__.py +0 -0
  195. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/process/method/__init__.py +0 -0
  196. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/process/script/__init__.py +0 -0
  197. {aeroviz-0.1.3/AeroViz/config → aeroviz-0.1.3b0/AeroViz/rawDataReader/utils}/__init__.py +0 -0
  198. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz/tools/__init__.py +0 -0
  199. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz.egg-info/dependency_links.txt +0 -0
  200. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz.egg-info/requires.txt +0 -0
  201. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/AeroViz.egg-info/top_level.txt +0 -0
  202. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/LICENSE +0 -0
  203. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/MANIFEST.in +0 -0
  204. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/setup.cfg +0 -0
  205. {aeroviz-0.1.3 → aeroviz-0.1.3b0}/tests/test_plot.py +0 -0
@@ -5,8 +5,8 @@ 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
+ 'Optical', 'SizeDistr', 'Chemistry', 'VOC',
11
+ 'DataBase', 'DataReader', 'DataClassifier'
12
12
  ]
@@ -0,0 +1,63 @@
1
+ from ..core import _writter, _run_process
2
+
3
+ __all__ = [
4
+
5
+ 'Chemistry',
6
+
7
+ ]
8
+
9
+
10
+ class Chemistry(_writter):
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
17
+
18
+ out = _basic(df_chem, df_ref, df_water, df_density, nam_lst=nam_lst)
19
+
20
+ return self, out
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
26
+
27
+ out = _basic(df_chem, nam_lst=nam_lst)
28
+
29
+ return self, out
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
37
+
38
+ if self.path_out is None:
39
+ raise ValueError('Please Input "path_out" !!')
40
+
41
+ out = _basic(df_chem, self.path_out, nam_lst=nam_lst)
42
+
43
+ return self, out
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
50
+
51
+ out = _basic(df_lcres, df_res, df_mass, ocec_ratio, ocec_ratio_month, hr_lim, least_square_range,
52
+ WISOC_OC_range)
53
+
54
+ return self, out
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
60
+
61
+ out = _basic(df_teom, df_check)
62
+
63
+ return self, out
@@ -0,0 +1,27 @@
1
+ from pandas import concat
2
+
3
+ # parameter
4
+ _mol_wg = {
5
+ 'SO42-': 96.06,
6
+ 'NO3-': 62.00,
7
+ 'Cl-': 35.4,
8
+
9
+ 'Ca2+': 40.078,
10
+ 'K+': 39.098,
11
+ 'Mg2+': 24.305,
12
+ 'Na+': 22.99,
13
+ 'NH4+': 18.04,
14
+ }
15
+
16
+
17
+ # ug -> umol
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']))
21
+
22
+ _par = (_df['temp'].to_frame() + 273.15) * .082
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
26
+
27
+ return concat([_df_pt, _df_gas], axis=1)
@@ -0,0 +1,100 @@
1
+ from pathlib import Path
2
+ from subprocess import Popen, PIPE
3
+
4
+ import numpy as np
5
+ from pandas import concat, DataFrame, to_numeric, read_csv
6
+
7
+ from ._calculate import _ug2umol
8
+
9
+
10
+ def _basic(df_che, path_out, nam_lst):
11
+ # parameter
12
+ df_all = concat(df_che, axis=1)
13
+ index = df_all.index.copy()
14
+ df_all.columns = nam_lst
15
+
16
+ df_umol = _ug2umol(df_all)
17
+
18
+ ## output
19
+ ## Na, SO4, NH3, NO3, Cl, Ca, K, Mg, RH, TEMP
20
+ df_input = DataFrame(index=index)
21
+ df_out = DataFrame(index=index)
22
+
23
+ pth_input = path_out / '_temp_input.txt'
24
+ pth_output = path_out / '_temp_input.dat'
25
+
26
+ pth_input.unlink(missing_ok=True)
27
+ pth_output.unlink(missing_ok=True)
28
+
29
+ ## header
30
+ _header = 'Input units (0=umol/m3, 1=ug/m3)\n' + '0\n\n' + \
31
+ 'Problem type (0=forward, 1=reverse); Phase state (0=solid+liquid, 1=metastable)\n' + '0, 1\n\n' + \
32
+ 'NH4-SO4 system case\n'
33
+
34
+ ## software
35
+ path_iso = Path(__file__).parent / 'isrpia2.exe'
36
+
37
+ # make input file and output temp input (without index)
38
+ ## NH3
39
+ df_input['NH3'] = df_umol['NH4+'].fillna(0).copy() + df_umol['NH3']
40
+
41
+ ## NO3
42
+ df_input['NO3'] = df_umol['HNO3'].fillna(0).copy() + df_umol['NO3-']
43
+
44
+ ## Cl
45
+ df_input['Cl'] = df_umol['HCl'].fillna(0).copy() + df_umol['Cl-']
46
+
47
+ ## temp, RH
48
+ df_input['RH'] = df_all['RH'] / 100
49
+ df_input['TEMP'] = df_all['temp'] + 273.15
50
+
51
+ df_input[['Na', 'SO4', 'Ca', 'K', 'Mg']] = df_umol[['Na+', 'SO42-', 'Ca2+', 'K+', 'Mg2+']].copy()
52
+
53
+ df_input = df_input[['Na', 'SO4', 'NH3', 'NO3', 'Cl', 'Ca', 'K', 'Mg', 'RH', 'TEMP']].fillna('-').copy()
54
+
55
+ ## output the input data
56
+ df_input.to_csv(pth_input, index=False)
57
+ with (pth_input).open('r+', encoding='utf-8', errors='ignore') as _f:
58
+ _cont = _f.read()
59
+ _f.seek(0)
60
+
61
+ _f.write(_header)
62
+ _f.write(_cont)
63
+
64
+ # use ISOROPIA2
65
+ run = Popen([path_iso], stdin=PIPE, stdout=PIPE, stderr=PIPE)
66
+ scrn_res, run_res = run.communicate(input=str(pth_input.resolve()).encode())
67
+
68
+ # read dat file and transform to the normal name
69
+ cond_idx = df_all[['SO42-', 'NH4+', 'NO3-']].dropna().index
70
+
71
+ with (pth_output).open('r', encoding='utf-8', errors='ignore') as f:
72
+ df_res = read_csv(f, delimiter='\s+').apply(to_numeric, errors='coerce').set_index(index)
73
+
74
+ df_out['H'] = df_res['HLIQ'] / (df_res['WATER'] / 1000)
75
+
76
+ df_out.loc[cond_idx, 'pH'] = -np.log10(df_out['H'].loc[cond_idx])
77
+ df_out['pH'] = df_out['pH'].where((df_all['RH'] <= 95) & (df_all['RH'] >= 20))
78
+
79
+ cond_idx = df_out['pH'].dropna().index
80
+ df_out.loc[cond_idx, 'ALWC'] = df_res['WATER'].loc[cond_idx]
81
+
82
+ df_out[['NH3', 'HNO3', 'HCl', 'NH4+', 'NO3-', 'Cl-']] = df_res[
83
+ ['GNH3', 'GHNO3', 'GHCL', 'NH4AER', 'NO3AER', 'CLAER']]
84
+
85
+ # calculate partition
86
+ # df_out['epls_NO3-'] = df_umol['NO3-'] / (df_umol['NO3-'] + df_umol['HNO3'])
87
+ # df_out['epls_NH4+'] = df_umol['NH4+'] / (df_umol['NH4+'] + df_umol['NH3'])
88
+ # df_out['epls_Cl-'] = df_umol['Cl-'] / (df_umol['Cl-'] + df_umol['HCl'])
89
+
90
+ # remove _temp file (input and output)
91
+ pth_input.unlink(missing_ok=True)
92
+ pth_output.unlink(missing_ok=True)
93
+
94
+ # output input and output
95
+ out = {
96
+ 'input': df_input,
97
+ 'output': df_out,
98
+ }
99
+
100
+ return out
@@ -0,0 +1,175 @@
1
+ from pandas import concat, DataFrame
2
+
3
+
4
+ def _basic(df_che, df_ref, df_water, df_density, nam_lst):
5
+ df_all = concat(df_che, axis=1)
6
+ index = df_all.index.copy()
7
+ df_all.columns = nam_lst
8
+
9
+ ## parameter
10
+ mol_A, mol_S, mol_N = df_all['NH4+'] / 18, df_all['SO42-'] / 96, df_all['NO3-'] / 62
11
+ df_all['status'] = (mol_A) / (2 * mol_S + mol_N)
12
+
13
+ convert_nam = {'AS': 'SO42-',
14
+ 'AN': 'NO3-',
15
+ 'OM': 'OC',
16
+ 'Soil': 'Fe',
17
+ 'SS': 'Na+',
18
+ 'EC': 'EC',
19
+ }
20
+
21
+ mass_coe = {'AS': 1.375,
22
+ 'AN': 1.29,
23
+ 'OM': 1.8,
24
+ 'Soil': 28.57,
25
+ 'SS': 2.54,
26
+ 'EC': 1,
27
+ }
28
+
29
+ vol_coe = {'AS': 1.76,
30
+ 'AN': 1.73,
31
+ 'OM': 1.4,
32
+ 'Soil': 2.6,
33
+ 'SS': 2.16,
34
+ 'EC': 1.5,
35
+ }
36
+
37
+ RI_coe = {'550': {'ALWC': 1.333 + 0j,
38
+ 'AS': 1.53 + 0j,
39
+ 'AN': 1.55 + 0j,
40
+ 'OM': 1.55 + 0.0163j,
41
+ 'Soil': 1.56 + 0.006j,
42
+ 'SS': 1.54 + 0j,
43
+ 'EC': 1.80 + 0.72j,
44
+ },
45
+
46
+ ## m + kj -> m value is same as 550 current
47
+ '450': {'ALWC': 1.333 + 0j,
48
+ 'AS': 1.57 + 0j,
49
+ 'AN': 1.57 + 0j,
50
+ 'OM': 1.58 + 0.056,
51
+ 'Soil': 1.56 + 0.009j,
52
+ 'SS': 1.54 + 0j,
53
+ 'EC': 1.80 + 0.79j,
54
+ },
55
+ }
56
+
57
+ ## mass
58
+ ## NH4 Enough
59
+ df_mass = DataFrame()
60
+ df_enough = df_all.where(df_all['status'] >= 1).dropna().copy()
61
+
62
+ for _mass_nam, _coe in mass_coe.items():
63
+ df_mass[_mass_nam] = df_all[convert_nam[_mass_nam]] * _coe
64
+
65
+ ## NH4 Deficiency
66
+ defic_idx = df_all['status'] < 1
67
+
68
+ if defic_idx.any():
69
+ residual = mol_A - 2 * mol_S
70
+
71
+ ## residual > 0
72
+ _status = residual > 0
73
+ if _status.any():
74
+ _cond = _status & (residual <= mol_N)
75
+ df_mass.loc[_cond, 'AN'] = residual.loc[_cond] * 80
76
+
77
+ _cond = _status & (residual > mol_N)
78
+ df_mass.loc[_cond, 'AN'] = mol_N.loc[_cond] * 80
79
+
80
+ ## residual < 0
81
+ _status = residual <= 0
82
+ if _status.any():
83
+ df_mass.loc[_status, 'AN'] = 0
84
+
85
+ _cond = _status & (mol_A <= 2 * mol_S)
86
+ df_mass.loc[_cond, 'AS'] = mol_A.loc[_cond] / 2 * 132
87
+
88
+ _cond = _status & (mol_A > 2 * mol_S)
89
+ df_mass.loc[_cond, 'AS'] = mol_S.loc[_cond] * 132
90
+
91
+ df_mass_cal = df_mass.dropna().copy()
92
+ df_mass['total'] = df_mass.sum(axis=1, min_count=6)
93
+
94
+ qc_ratio = df_mass['total'] / df_ref
95
+ qc_cond = (qc_ratio >= 0.7) & (qc_ratio <= 1.3)
96
+
97
+ ## volume
98
+ df_vol = DataFrame()
99
+ for _vol_nam, _coe in vol_coe.items():
100
+ df_vol[_vol_nam] = df_mass_cal[_vol_nam] / _coe
101
+
102
+ if df_water is not None:
103
+ df_vol['ALWC'] = df_water
104
+ df_vol = df_vol.dropna()
105
+ df_vol['total_wet'] = df_vol.sum(axis=1, min_count=6)
106
+
107
+ df_vol['total_dry'] = df_vol[vol_coe.keys()].sum(axis=1, min_count=6)
108
+
109
+ ## density
110
+ df_vol_cal = DataFrame()
111
+ df_den_rec = df_mass['total'] / df_vol['total_dry']
112
+ if df_density is not None:
113
+ df_den_all = concat([df_all[['SO42-', 'NO3-', 'NH4+', 'EC']], df_density, df_mass['OM']], axis=1).dropna()
114
+
115
+ df_vol_cal = (df_den_all[['SO42-', 'NO3-', 'NH4+']].sum(axis=1) / 1.75) + \
116
+ df_den_all['Cl-'] / 1.52 + \
117
+ df_den_all['OM'] / 1.4 + df_den_all['EC'] / 1.77
118
+
119
+ df_den = df_den_all.sum(axis=1, min_count=6) / df_vol_cal
120
+ # df_den = df_den_all.sum(axis=1) / df_vol_cal
121
+ # df_den = df_mass['total'].loc[df_den_all.index] / df_vol_cal
122
+
123
+ ## refractive index
124
+ ri_dic = {}
125
+ for _lambda, _coe in RI_coe.items():
126
+
127
+ df_RI = DataFrame()
128
+
129
+ for _ky, _df in df_vol.items():
130
+ if 'total' in _ky: continue
131
+ df_RI[_ky] = (_df * _coe[_ky])
132
+
133
+ df_RI['RI_wet'] = None
134
+ if df_water is not None:
135
+ df_RI['RI_wet'] = (df_RI / df_vol['total_wet'].to_frame().values).sum(axis=1)
136
+
137
+ df_RI['RI_dry'] = (df_RI[vol_coe.keys()] / df_vol['total_dry'].to_frame().values).sum(axis=1)
138
+
139
+ ri_dic[f'RI_{_lambda}'] = df_RI[['RI_dry', 'RI_wet']]
140
+
141
+ ## mole and equivalent
142
+ df_eq = concat((mol_A, mol_S, mol_N, mol_A * 1, mol_S * 2, mol_N * 1), axis=1)
143
+ df_eq.columns = ['mol_NH4', 'mol_SO4', 'mol_NO3', 'eq_NH4', 'eq_SO4', 'eq_NO3', ]
144
+
145
+ ## out
146
+ out = {'mass': df_mass,
147
+ 'volume': df_vol,
148
+ 'vol_cal': df_vol_cal,
149
+ 'eq': df_eq,
150
+ 'density_mat': df_den,
151
+ 'density_rec': df_den_rec,
152
+ }
153
+ out.update(ri_dic)
154
+
155
+ for _ky, _df in out.items():
156
+ out[_ky] = _df.reindex(index).where(qc_cond)
157
+
158
+ return out
159
+
160
+
161
+ # '''
162
+
163
+
164
+ def mass_ratio(_df):
165
+ if _df['PM25'] >= _df['total_mass']:
166
+ _df['others'] = _df['PM25'] - _df['total_mass']
167
+ for _val, _species in zip(_df.values, _df.index):
168
+ _df[f'{_species}_ratio'] = _val / _df['PM25'].__round__(3)
169
+
170
+ if _df['PM25'] < _df['total_mass']:
171
+ _df['others'] = 0
172
+ for _val, _species in zip(_df.values, _df.index):
173
+ _df[f'{_species}_ratio'] = _val / _df['PM25'].__round__(3)
174
+
175
+ return _df['others':].drop(labels=['PM25_ratio', 'total_mass_ratio'])
@@ -0,0 +1,184 @@
1
+ import numpy as np
2
+ from pandas import concat, DataFrame
3
+ from scipy.optimize import curve_fit
4
+
5
+ from AeroViz.dataProcess.core import _union_index
6
+
7
+ __all__ = [
8
+ '_basic',
9
+ # '_ocec_ratio_cal',
10
+ ]
11
+
12
+
13
+ def _min_Rsq(_oc, _ec, _rng):
14
+ _val_mesh, _oc_mesh = np.meshgrid(_rng, _oc)
15
+ _val_mesh, _ec_mesh = np.meshgrid(_rng, _ec)
16
+
17
+ _out_table = DataFrame(_oc_mesh - _val_mesh * _ec_mesh, index=_oc.index, columns=_rng)
18
+
19
+ ## calculate R2
20
+ _r2_dic = {}
21
+ _func = lambda _x, _sl, _inte: _sl * _x + _inte
22
+ for _ocec, _out in _out_table.items():
23
+ _df = DataFrame([_out.values, _ec.values]).T.dropna()
24
+
25
+ _x, _y = _df[0], _df[1]
26
+ _opt, _ = curve_fit(_func, _x, _y)
27
+
28
+ _tss = np.sum((_y - _y.mean()) ** 2.)
29
+ _rss = np.sum((_y - _func(_x, *_opt)) ** 2.)
30
+
31
+ _r2_dic[round(_ocec, 3)] = 1. - _rss / _tss
32
+
33
+ ## get the min R2
34
+ _ratio = DataFrame(_r2_dic, index=[0]).idxmin(axis=1).values[0]
35
+
36
+ return _ratio, _out_table[_ratio]
37
+
38
+
39
+ def _ocec_ratio_cal(_nam, _lcres_splt, _hr_lim, _range_, _wisoc_range_):
40
+ ## parameter
41
+ _out = DataFrame(index=_lcres_splt.index)
42
+ (_, _oc), (_, _ec) = _lcres_splt.items()
43
+ # _oc, _ec = _lcres_splt['Thermal_OC'], _lcres_splt['Thermal_EC']
44
+
45
+ ## real data OC/EC
46
+ _ocec_ratio_real = (_oc / _ec).quantile(.5)
47
+
48
+ _out[f'OC/EC_real_{_nam}'] = _ocec_ratio_real
49
+ _out[f'POC_real_{_nam}'] = _ocec_ratio_real * _ec
50
+ _out[f'SOC_real_{_nam}'] = _oc - _out[f'POC_real_{_nam}']
51
+
52
+ ## the least R2 method
53
+ ## estimated OC/EC
54
+ if (len(_lcres_splt) <= _hr_lim):
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
+ print('\t\tPlease Modify the Values of "hour_limit" or Input Sufficient Amount of Data !!')
57
+
58
+ _out[[f'OC/EC_{_nam}', f'POC_{_nam}', f'SOC_{_nam}', f'WISOC/OC_{_nam}', f'WSOC_{_nam}',
59
+ f'WISOC_{_nam}']] = np.nan
60
+
61
+ return _out
62
+
63
+ if (len(_lcres_splt.dropna()) == 0):
64
+ _out[[f'OC/EC_{_nam}', f'POC_{_nam}', f'SOC_{_nam}', f'WISOC/OC_{_nam}', f'WSOC_{_nam}',
65
+ f'WISOC_{_nam}']] = np.nan
66
+
67
+ return _out
68
+
69
+ ## OC/EC
70
+ _ocec_ratio = False
71
+ _st, _ed, _stp = _range_
72
+
73
+ for _ in range(2):
74
+ if _ocec_ratio:
75
+ _ocec_rng = np.arange(_ocec_ratio - _stp / 2, _ocec_ratio + _stp / 2, .01).round(3)
76
+ else:
77
+ _ocec_rng = np.arange(_st, _ed + _stp, _stp).round(3)
78
+
79
+ _ocec_ratio, _soc = _min_Rsq(_oc, _ec, _ocec_rng)
80
+
81
+ ## WISOC
82
+ _st, _ed, _stp = _wisoc_range_
83
+ _wisoc_rng = (np.arange(_st, _ed + _stp, _stp) * _ocec_ratio).round(5)
84
+ _wisoc_ratio, _wsoc = _min_Rsq(_oc, _ec, _wisoc_rng)
85
+
86
+ ## out
87
+ _out[f'OC/EC_{_nam}'] = _ocec_ratio
88
+ _out[f'SOC_{_nam}'] = _soc
89
+ _out[f'POC_{_nam}'] = _oc - _out[f'SOC_{_nam}']
90
+ _out[f'WISOC/OC_{_nam}'] = _wisoc_ratio
91
+ _out[f'WSOC_{_nam}'] = _wsoc
92
+ _out[f'WISOC_{_nam}'] = _oc - _out[f'WSOC_{_nam}']
93
+
94
+ return _out[[f'OC/EC_{_nam}', f'POC_{_nam}', f'SOC_{_nam}', f'WISOC/OC_{_nam}', f'WSOC_{_nam}', f'WISOC_{_nam}',
95
+ f'OC/EC_real_{_nam}', f'POC_real_{_nam}', f'SOC_real_{_nam}']]
96
+
97
+
98
+ def _basic(_lcres, _res, _mass, _ocec_ratio, _ocec_ratio_month, _hr_lim, _range, _wisoc_range):
99
+ _lcres, _res, _mass = _union_index(_lcres, _res, _mass)
100
+
101
+ _out = {}
102
+
103
+ ## OC1, OC2, OC3, OC4, PC
104
+ _df_bsc = _res / _lcres['Sample_Volume'].to_frame().values.copy()
105
+
106
+ ## SOC, POC, OC/EC
107
+ if _ocec_ratio is not None:
108
+ try:
109
+ iter(_ocec_ratio)
110
+ except TypeError:
111
+ raise TypeError('"ocec_ratio" Only Accept a Single Value !!')
112
+
113
+ _prcs_df = DataFrame(index=_df_bsc.index)
114
+ _prcs_df['OC/EC'] = _ocec_ratio
115
+ _prcs_df['POC'] = _ocec_ratio * _lcres['Thermal_EC']
116
+ _prcs_df['SOC'] = _lcres['Thermal_OC'] - _prcs_df['POC']
117
+
118
+ else:
119
+ _df_lst = []
120
+ for _, _df in _lcres.resample(f'{_ocec_ratio_month}MS', closed='left'):
121
+ _thm_cal = _ocec_ratio_cal('thm', _df[['Thermal_OC', 'Thermal_EC']], _hr_lim, _range, _wisoc_range)
122
+ _opt_cal = _ocec_ratio_cal('opt', _df[['Optical_OC', 'Optical_EC']], _hr_lim, _range, _wisoc_range)
123
+ _df_lst.append(concat([_thm_cal, _opt_cal], axis=1))
124
+
125
+ _prcs_df = concat(_df_lst)
126
+
127
+ _df_bsc = concat((_df_bsc.copy(), _prcs_df), axis=1)
128
+
129
+ ## ratio
130
+ _df_ratio = DataFrame(index=_df_bsc.index)
131
+
132
+ for _ky, _val in _df_bsc.items():
133
+ if 'OC/EC' in _ky: continue
134
+ _df_ratio[f'{_ky}/Thermal_OC'] = _val / _lcres['Thermal_OC']
135
+ _df_ratio[f'{_ky}/Optical_OC'] = _val / _lcres['Optical_OC']
136
+
137
+ if _mass is not None:
138
+ for _ky, _val in _df_bsc.items():
139
+ _df_ratio[f'{_ky}/PM'] = _val / _mass
140
+
141
+ _df_ratio[f'Thermal_OC/PM'] = _lcres['Thermal_OC'] / _mass
142
+ _df_ratio[f'Thermal_EC/PM'] = _lcres['Thermal_EC'] / _mass
143
+
144
+ _df_ratio[f'Optical_OC/PM'] = _lcres['Optical_OC'] / _mass
145
+ _df_ratio[f'Optical_EC/PM'] = _lcres['Optical_EC'] / _mass
146
+
147
+ ## ratio status
148
+ _df_bsc = concat((_lcres, _df_bsc.copy()), axis=1)
149
+
150
+ for _ky, _df in _df_ratio.items():
151
+ _df_bsc[f'{_ky}_status'] = 'Normal'
152
+ _df_bsc[f'{_ky}_status'] = _df_bsc[f'{_ky}_status'].mask(_df > 1, 'Warning')
153
+
154
+ ## out
155
+ _out['ratio'] = _df_ratio
156
+ _out['basic'] = _df_bsc
157
+
158
+ 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
+ # '''
@@ -0,0 +1,30 @@
1
+ from pandas import concat, DataFrame
2
+
3
+ from ._calculate import _ug2umol
4
+
5
+
6
+ def _basic(df_che, nam_lst):
7
+ # parameter
8
+ df_all = concat(df_che, axis=1)
9
+ index = df_all.index.copy()
10
+ df_all.columns = nam_lst
11
+
12
+ df_umol = _ug2umol(df_all)
13
+
14
+ # calculate
15
+ df_out = DataFrame(index=df_umol.index)
16
+
17
+ # df_out['NTR'] = df_umol['NH4+'] / (df_umol['NH4+'] + df_all['NH3'] / 22.4)
18
+ df_out['NTR+'] = df_umol['NH4+'] / (df_umol['NH4+'] + df_umol['NH3'])
19
+
20
+ df_out['NOR'] = df_umol['NO3-'] / (df_umol['NO3-'] + df_umol['NO2'])
21
+ df_out['NOR_2'] = (df_umol['NO3-'] + df_umol['HNO3']) / (df_umol['NO3-'] + df_umol['NO2'] + df_umol['HNO3'])
22
+
23
+ df_out['SOR'] = df_umol['SO42-'] / (df_umol['SO42-'] + df_umol['SO2'])
24
+
25
+ df_out['epls_NO3-'] = df_umol['NO3-'] / (df_umol['NO3-'] + df_umol['HNO3'])
26
+ df_out['epls_NH4+'] = df_umol['NH4+'] / (df_umol['NH4+'] + df_umol['NH3'])
27
+ df_out['epls_SO42-'] = df_out['SOR']
28
+ df_out['epls_Cl-'] = df_umol['Cl-'] / (df_umol['Cl-'] + df_umol['HCl'])
29
+
30
+ return df_out
@@ -0,0 +1,13 @@
1
+ def _basic(_teom, _check):
2
+ _teom['Volatile_Fraction'] = (_teom['PM_Total'] - _teom['PM_NV']) / _teom['PM_Total']
3
+
4
+ _teom.loc[(_teom['Volatile_Fraction'] < 0) | (_teom['Volatile_Fraction'] > 1)] = n.nan
5
+
6
+ if _check is not None:
7
+ _ratio = _teom['PM_NV'] / _check
8
+ _teom['PM_Check'] = _check
9
+
10
+ _teom.loc[_teom.dropna().index, 'status'] = 'Warning'
11
+ _teom.loc[(_ratio > 0) & (_ratio < 1), 'status'] = 'Normal'
12
+
13
+ return _teom
@@ -0,0 +1,62 @@
1
+ import pickle as pkl
2
+ from pathlib import Path
3
+
4
+ import numpy as np
5
+ from pandas import DataFrame
6
+
7
+ from AeroViz.dataProcess.core import _union_index
8
+
9
+
10
+ def _revised(_df_mass, _df_RH):
11
+ _df_mass, _df_RH = _union_index(_df_mass, _df_RH)
12
+
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
17
+
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
22
+
23
+ return 1, 1, 1, 1
24
+
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()
33
+
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']]
36
+
37
+ ## apply IMPROVE ccoe.
38
+ def _ext_cal(_RH=None):
39
+
40
+ _frh, _frhss, _frhs, _frhl = fRH(_RH)
41
+ _df = DataFrame(index=_df_mass.index)
42
+
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']
49
+
50
+ _df['total'] = _df.sum(axis=1)
51
+
52
+ return _df.dropna().reindex(_df_mass.index)
53
+
54
+ ## calculate
55
+ _out = {}
56
+
57
+ _out['dry'] = _ext_cal()
58
+
59
+ if _df_RH is not None:
60
+ _out['wet'] = _ext_cal(_df_RH)
61
+
62
+ return _out