AeroViz 0.1.3b0__py3-none-any.whl → 0.1.5__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 (85) hide show
  1. AeroViz/__init__.py +5 -3
  2. AeroViz/{config → data}/DEFAULT_DATA.csv +1 -1
  3. AeroViz/dataProcess/Chemistry/__init__.py +28 -27
  4. AeroViz/dataProcess/Chemistry/_isoropia.py +11 -11
  5. AeroViz/dataProcess/Chemistry/_mass_volume.py +15 -18
  6. AeroViz/dataProcess/Chemistry/_ocec.py +21 -46
  7. AeroViz/dataProcess/Chemistry/_teom.py +2 -1
  8. AeroViz/dataProcess/Chemistry/isrpia.cnf +21 -0
  9. AeroViz/dataProcess/Chemistry/isrpia2.exe +0 -0
  10. AeroViz/dataProcess/Optical/Angstrom_exponent.py +20 -0
  11. AeroViz/dataProcess/Optical/_IMPROVE.py +13 -15
  12. AeroViz/dataProcess/Optical/__init__.py +15 -30
  13. AeroViz/dataProcess/Optical/_absorption.py +21 -47
  14. AeroViz/dataProcess/Optical/_extinction.py +20 -15
  15. AeroViz/dataProcess/Optical/_mie.py +0 -1
  16. AeroViz/dataProcess/Optical/_scattering.py +19 -20
  17. AeroViz/dataProcess/Optical/fRH.pkl +0 -0
  18. AeroViz/dataProcess/SizeDistr/__init__.py +7 -7
  19. AeroViz/dataProcess/SizeDistr/_merge.py +2 -2
  20. AeroViz/dataProcess/SizeDistr/_merge_v1.py +2 -2
  21. AeroViz/dataProcess/SizeDistr/_merge_v2.py +2 -2
  22. AeroViz/dataProcess/SizeDistr/_merge_v3.py +1 -1
  23. AeroViz/dataProcess/SizeDistr/_merge_v4.py +1 -1
  24. AeroViz/dataProcess/VOC/__init__.py +4 -9
  25. AeroViz/dataProcess/VOC/_potential_par.py +71 -37
  26. AeroViz/dataProcess/VOC/{voc_par.json → support_voc.json} +321 -339
  27. AeroViz/dataProcess/__init__.py +28 -6
  28. AeroViz/dataProcess/core/__init__.py +10 -17
  29. AeroViz/plot/__init__.py +1 -1
  30. AeroViz/plot/box.py +2 -1
  31. AeroViz/plot/optical/optical.py +4 -4
  32. AeroViz/plot/regression.py +25 -39
  33. AeroViz/plot/scatter.py +68 -2
  34. AeroViz/plot/templates/__init__.py +2 -1
  35. AeroViz/plot/templates/ammonium_rich.py +34 -0
  36. AeroViz/plot/templates/diurnal_pattern.py +11 -9
  37. AeroViz/plot/templates/koschmieder.py +51 -115
  38. AeroViz/plot/templates/metal_heatmap.py +115 -17
  39. AeroViz/plot/timeseries/__init__.py +1 -0
  40. AeroViz/plot/timeseries/template.py +47 -0
  41. AeroViz/plot/timeseries/timeseries.py +275 -208
  42. AeroViz/plot/utils/plt_utils.py +2 -2
  43. AeroViz/plot/utils/units.json +5 -0
  44. AeroViz/plot/violin.py +9 -8
  45. AeroViz/process/__init__.py +2 -2
  46. AeroViz/process/script/AbstractDistCalc.py +1 -1
  47. AeroViz/process/script/Chemical.py +5 -4
  48. AeroViz/process/script/Others.py +1 -1
  49. AeroViz/rawDataReader/__init__.py +66 -22
  50. AeroViz/rawDataReader/{utils/config.py → config/supported_instruments.py} +33 -54
  51. AeroViz/rawDataReader/core/__init__.py +116 -231
  52. AeroViz/rawDataReader/script/AE33.py +12 -13
  53. AeroViz/rawDataReader/script/AE43.py +10 -13
  54. AeroViz/rawDataReader/script/APS_3321.py +8 -8
  55. AeroViz/rawDataReader/script/Aurora.py +21 -19
  56. AeroViz/rawDataReader/script/BC1054.py +13 -17
  57. AeroViz/rawDataReader/script/EPA_vertical.py +36 -8
  58. AeroViz/rawDataReader/script/GRIMM.py +6 -13
  59. AeroViz/rawDataReader/script/{IGAC_ZM.py → IGAC.py} +18 -18
  60. AeroViz/rawDataReader/script/MA350.py +9 -16
  61. AeroViz/rawDataReader/script/Minion.py +103 -0
  62. AeroViz/rawDataReader/script/NEPH.py +28 -38
  63. AeroViz/rawDataReader/script/SMPS_TH.py +6 -6
  64. AeroViz/rawDataReader/script/SMPS_aim11.py +8 -8
  65. AeroViz/rawDataReader/script/SMPS_genr.py +8 -8
  66. AeroViz/rawDataReader/script/Sunset_OCEC.py +66 -0
  67. AeroViz/rawDataReader/script/TEOM.py +10 -8
  68. AeroViz/rawDataReader/script/Table.py +9 -10
  69. AeroViz/rawDataReader/script/VOC.py +33 -0
  70. AeroViz/rawDataReader/script/__init__.py +10 -12
  71. AeroViz/tools/database.py +7 -9
  72. AeroViz/tools/datareader.py +3 -3
  73. {AeroViz-0.1.3b0.dist-info → AeroViz-0.1.5.dist-info}/METADATA +1 -1
  74. AeroViz-0.1.5.dist-info/RECORD +114 -0
  75. AeroViz/rawDataReader/script/IGAC_TH.py +0 -104
  76. AeroViz/rawDataReader/script/OCEC_LCRES.py +0 -34
  77. AeroViz/rawDataReader/script/OCEC_RES.py +0 -28
  78. AeroViz/rawDataReader/script/VOC_TH.py +0 -30
  79. AeroViz/rawDataReader/script/VOC_ZM.py +0 -37
  80. AeroViz-0.1.3b0.dist-info/RECORD +0 -110
  81. /AeroViz/{config → data}/DEFAULT_PNSD_DATA.csv +0 -0
  82. /AeroViz/rawDataReader/{utils → config}/__init__.py +0 -0
  83. {AeroViz-0.1.3b0.dist-info → AeroViz-0.1.5.dist-info}/LICENSE +0 -0
  84. {AeroViz-0.1.3b0.dist-info → AeroViz-0.1.5.dist-info}/WHEEL +0 -0
  85. {AeroViz-0.1.3b0.dist-info → AeroViz-0.1.5.dist-info}/top_level.txt +0 -0
@@ -5,10 +5,10 @@ from pandas import read_csv, concat
5
5
  from AeroViz.process.script import (ImpactProc, ImproveProc, ChemicalProc, ParticleSizeDistProc,
6
6
  ExtinctionDistProc, OthersProc)
7
7
 
8
- __all__ = ['DataProcess']
8
+ __all__ = ['DataProcessor', 'ImpactProc', 'ImproveProc', 'ChemicalProc', 'ParticleSizeDistProc', 'ExtinctionDistProc', ]
9
9
 
10
10
 
11
- class DataProcess:
11
+ class DataProcessor:
12
12
  def __new__(cls, file_path, reset: bool = False, save_file: Path | str = 'All_data.csv'):
13
13
  file_path = Path(file_path)
14
14
 
@@ -64,7 +64,7 @@ class ExtinctionDistCalc(AbstractDistCalc):
64
64
  def __init__(self,
65
65
  psd: SizeDist,
66
66
  RI: DataFrame,
67
- method: Literal['internal', 'external', 'utils-shell', 'sensitivity'],
67
+ method: Literal['internal', 'external', 'config-shell', 'sensitivity'],
68
68
  result_type: Literal['extinction', 'scattering', 'absorption'] = 'extinction'
69
69
  ):
70
70
  self.psd = psd
@@ -1,7 +1,7 @@
1
1
  from pathlib import Path
2
2
 
3
3
  import numpy as np
4
- from pandas import read_csv, concat, notna, DataFrame
4
+ from pandas import read_csv, concat, notna, DataFrame, to_numeric
5
5
 
6
6
  from AeroViz.process.core import DataProc
7
7
  from AeroViz.tools.datareader import DataReader
@@ -72,7 +72,7 @@ class ChemicalProc(DataProc):
72
72
  _df['AN'] = 0
73
73
 
74
74
  _df['OM'] = 1.8 * OC
75
- _df['Soil'] = 28.57 * Soil
75
+ _df['Soil'] = 28.57 * Soil / 1000
76
76
  _df['SS'] = 2.54 * SS
77
77
  _df['EC'] = EC
78
78
  _df['SIA'] = _df['AS'] + _df['AN']
@@ -159,9 +159,10 @@ class ChemicalProc(DataProc):
159
159
  if save_file.exists() and not reset:
160
160
  return read_csv(save_file, parse_dates=['Time'], index_col='Time')
161
161
  else:
162
- df = concat([DataReader(file) for file in self.file_paths], axis=1)
162
+ df = concat([DataReader(file) for file in self.file_paths], axis=1).apply(to_numeric, errors='coerce')
163
163
 
164
- df_mass = df[['NH4+', 'SO42-', 'NO3-', 'O_OC', 'Fe', 'Na+', 'O_EC', 'PM25']].dropna().apply(self.mass,
164
+ df_mass = df[['NH4+', 'SO42-', 'NO3-', 'Optical_OC', 'Fe', 'Na+', 'Optical_EC', 'PM2.5']].dropna().apply(
165
+ self.mass,
165
166
  axis=1)
166
167
  df_mass['ALWC'] = df['ALWC']
167
168
  df_volume = df_mass[['AS', 'AN', 'OM', 'Soil', 'SS', 'EC', 'total_mass', 'ALWC']].dropna().apply(
@@ -58,7 +58,7 @@ class OthersProc(DataProc):
58
58
  # results['fRH_PNSD'] = df['Bext_internal'] / df['Bext_dry']
59
59
  results['fRH_IMPR'] = df['total_ext'] / df['total_ext_dry']
60
60
  results['OCEC_ratio'] = df['O_OC'] / df['O_EC']
61
- results['PM1/PM25'] = np.where(df['PM1'] / df['PM25'] < 1, df['PM1'] / df['PM25'], np.nan)
61
+ results['PM1/PM25'] = np.where(df['PM1'] / df['PM2.5'] < 1, df['PM1'] / df['PM2.5'], np.nan)
62
62
  # results['MEE_PNSD'] = df['Bext_internal'] / df['PM25']
63
63
  # results['MEE_dry_PNSD'] = df['Bext_dry'] / df['PM25']
64
64
 
@@ -1,47 +1,93 @@
1
1
  from datetime import datetime
2
+ from pathlib import Path
2
3
 
4
+ from AeroViz.rawDataReader.config.supported_instruments import meta
3
5
  from AeroViz.rawDataReader.script import *
4
- from AeroViz.rawDataReader.utils.config import meta
5
6
 
6
7
  __all__ = ['RawDataReader']
7
8
 
8
9
 
9
10
  def RawDataReader(instrument_name: str,
10
- _path,
11
- QC: bool = True,
11
+ path: Path,
12
+ qc: bool = True,
12
13
  csv_raw: bool = True,
13
14
  reset: bool = False,
14
15
  rate: bool = False,
15
16
  append_data: bool = False,
16
- update_meta=None,
17
17
  start: datetime | None = None,
18
18
  end: datetime | None = None,
19
19
  mean_freq='1h',
20
20
  csv_out=True,
21
- **kwargs
22
21
  ):
22
+ """
23
+ Factory function to instantiate the appropriate reader module for a given instrument and
24
+ return the processed data over the specified time range.
25
+
26
+ Parameters
27
+ ----------
28
+ instrument_name : str
29
+ The name of the instrument for which to read data. Must be a valid key in the `meta` dictionary.
30
+ path : Path
31
+ The directory where raw data files for the instrument are stored.
32
+ qc : bool, optional (default=True)
33
+ If True, apply quality control (QC) to the raw data.
34
+ csv_raw : bool, optional (default=True)
35
+ If True, read raw data from CSV files.
36
+ reset : bool, optional (default=False)
37
+ If True, reset the state and reprocess the data from scratch.
38
+ rate : bool, optional (default=False)
39
+ If True, calculate rates from the data.
40
+ append_data : bool, optional (default=False)
41
+ If True, append new data to the existing dataset instead of overwriting it.
42
+ start : datetime, optional
43
+ Start time for filtering the data. If None, no start time filtering will be applied.
44
+ end : datetime, optional
45
+ End time for filtering the data. If None, no end time filtering will be applied.
46
+ mean_freq : str, optional (default='1h')
47
+ Resampling frequency for averaging the data. Example: '1h' for hourly mean.
48
+ csv_out : bool, optional (default=True)
49
+ If True, output the processed data as a CSV file.
50
+
51
+ Return
52
+ ------
53
+ reader_module : Reader
54
+ An instance of the reader module corresponding to the specified instrument, which processes
55
+ the data and returns it in a usable format.
56
+
57
+ Raises
58
+ ------
59
+ ValueError
60
+ If the `instrument_name` provided is not a valid key in the `meta` dictionary.
61
+
62
+ Example
63
+ -------
64
+ To read and process data for the BC1054 instrument:
65
+
66
+ >>> from pathlib import Path
67
+ >>> from datetime import datetime
68
+ >>> data = RawDataReader(instrument_name='BC1054', path=Path('/path/to/data'),
69
+ >>> start=datetime(2024, 1, 1), end=datetime(2024, 2, 1))
70
+ """
23
71
  # Mapping of instrument names to their respective classes
24
72
  instrument_class_map = {
25
73
  'NEPH': NEPH,
26
74
  'Aurora': Aurora,
27
- 'Table': Table,
28
- 'EPA_vertical': EPA_vertical,
29
- 'APS_3321': APS_3321,
75
+ 'SMPS_genr': SMPS_genr,
76
+ 'SMPS_aim11': SMPS_aim11,
30
77
  'SMPS_TH': SMPS_TH,
78
+ 'GRIMM': GRIMM,
79
+ 'APS_3321': APS_3321,
31
80
  'AE33': AE33,
32
81
  'AE43': AE43,
33
82
  'BC1054': BC1054,
34
83
  'MA350': MA350,
35
84
  'TEOM': TEOM,
36
- 'OCEC_RES': OCEC_RES,
37
- 'OCEC_LCRES': OCEC_LCRES,
38
- 'IGAC_TH': IGAC_TH,
39
- 'IGAC_ZM': IGAC_ZM,
40
- 'VOC_TH': VOC_TH,
41
- 'VOC_ZM': VOC_ZM,
42
- 'SMPS_genr': SMPS_genr,
43
- 'SMPS_aim11': SMPS_aim11,
44
- 'GRIMM': GRIMM
85
+ 'Sunset_OCEC': Sunset_OCEC,
86
+ 'IGAC': IGAC,
87
+ 'VOC': VOC,
88
+ 'Table': Table,
89
+ 'EPA_vertical': EPA_vertical,
90
+ 'Minion': Minion
45
91
  # Add other instruments and their corresponding classes here
46
92
  }
47
93
 
@@ -51,18 +97,16 @@ def RawDataReader(instrument_name: str,
51
97
 
52
98
  # Instantiate the class and return the instance
53
99
  reader_module = instrument_class_map[instrument_name].Reader(
54
- _path=_path,
55
- QC=QC,
100
+ path=path,
101
+ qc=qc,
56
102
  csv_raw=csv_raw,
57
103
  reset=reset,
58
104
  rate=rate,
59
- append_data=append_data,
60
- update_meta=update_meta
105
+ append_data=append_data
61
106
  )
62
107
  return reader_module(
63
108
  start=start,
64
109
  end=end,
65
110
  mean_freq=mean_freq,
66
111
  csv_out=csv_out,
67
- **kwargs
68
112
  )
@@ -1,22 +1,8 @@
1
1
  # Description: Configuration file for rawDataReader
2
2
 
3
- instrument = [
4
- "NEPH",
5
- "Aurora",
6
- "AE33",
7
- "AE43",
8
- "Table",
9
- "EPA_vertical",
10
- "SMPS_NTU(SMPS_3080_3788)",
11
- "SMPS_TH(SMPS_3080_3772)",
12
- "APS_3321",
13
- "TEOM",
14
- "OCEC"
15
- ]
16
-
17
3
  meta = {
18
4
  "NEPH": {
19
- "pattern": "*.DAT",
5
+ "pattern": "*.dat",
20
6
  "freq": "5min",
21
7
  "deter_key": {"Scatter Coe. (550 nm)": ["G"]},
22
8
  },
@@ -27,18 +13,6 @@ meta = {
27
13
  "deter_key": {"Scatter Coe. (550 nm)": ["G"]},
28
14
  },
29
15
 
30
- "Table": {
31
- "pattern": "*.csv",
32
- "freq": "1h",
33
- "deter_key": None,
34
- },
35
-
36
- "EPA_vertical": {
37
- "pattern": "*.csv",
38
- "freq": "1h",
39
- "deter_key": None,
40
- },
41
-
42
16
  "SMPS_TH": {
43
17
  "pattern": "*.txt",
44
18
  "freq": "6min",
@@ -73,18 +47,21 @@ meta = {
73
47
  "pattern": "[!ST|!CT|!FV]*[!log]_AE33*.dat",
74
48
  "freq": "1min",
75
49
  "deter_key": {"BC Mass Conc. (880 nm)": ["BC6"]},
50
+ "error_state": [],
76
51
  },
77
52
 
78
53
  "AE43": {
79
54
  "pattern": "[!ST|!CT|!FV]*[!log]_AE43*.dat",
80
55
  "freq": "1min",
81
56
  "deter_key": {"BC Mass Conc. (880 nm)": ["BC6"]},
57
+ "error_state": [],
82
58
  },
83
59
 
84
60
  "BC1054": {
85
61
  "pattern": "*.csv",
86
62
  "freq": "1min",
87
- "deter_key": {"BC Mass Conc. (880 nm)": ["BC6"]},
63
+ "deter_key": {"BC Mass Conc. (880 nm)": ["BC9"]},
64
+ "error_state": [1, 2, 4, 8, 16, 32, 65536],
88
65
  },
89
66
 
90
67
  "MA350": {
@@ -102,26 +79,18 @@ meta = {
102
79
  },
103
80
  },
104
81
 
105
- "OCEC_LCRES": {
82
+ "Sunset_OCEC": {
106
83
  "pattern": "*LCRes.csv",
107
84
  "freq": "1h",
108
85
  "deter_key": {
109
- "Thermal OC/EC": ["Thermal_EC", "Thermal_OC"],
110
86
  "Thermal OC": ["Thermal_OC"],
111
87
  "Thermal EC": ["Thermal_EC"],
112
- "Optical OC/EC": ["Optical_EC", "Optical_OC"],
113
88
  "Optical OC": ["Optical_OC"],
114
89
  "Optical EC": ["Optical_EC"],
115
90
  },
116
91
  },
117
92
 
118
- "OCEC_RES": {
119
- "pattern": "*[!LC|!Blanks]Res.csv",
120
- "freq": "1h",
121
- "deter_key": None,
122
- },
123
-
124
- "IGAC_TH": {
93
+ "IGAC": {
125
94
  "pattern": "*.csv",
126
95
  "freq": "1h",
127
96
  "deter_key": {
@@ -138,32 +107,42 @@ meta = {
138
107
  },
139
108
  },
140
109
 
141
- "IGAC_ZM": {
110
+ "VOC": {
142
111
  "pattern": "*.csv",
143
112
  "freq": "1h",
144
- "deter_key": {"Na+": ["Na+"],
145
- "NH4+": ["NH4+"],
146
- "K+": ["K+"],
147
- "Mg2+": ["Mg2+"],
148
- "Ca2+": ["Ca2+"],
149
- "Cl-": ["Cl-"],
150
- "NO2-": ["NO2-"],
151
- "NO3-": ["NO3-"],
152
- "SO42-": ["SO42-"],
153
- "Main Salt (NH4+, NO3-, SO42-)": ["NO3-", "SO42-", "NH4+"],
154
- },
155
- },
156
-
157
- "VOC_TH": {
113
+ "key": [
114
+ 'Benzene', 'Toluene', 'Ethylbenzene', 'm/p-Xylene', 'o-Xylene', 'Ethane', 'Propane', 'Isobutane',
115
+ 'n-Butane', 'Isopentane', 'n-Pentane', 'n-Hexane', 'n-Heptane', 'n-Octane', 'n-Nonane', 'n-Decane',
116
+ 'n-Undecane', 'n-Dodecane', 'Ethylene', 'Propylene', '1-Butene', 't-2-Butene', 'cis-2-Butene',
117
+ '1-Pentene', 't-2-Pentene', 'cis-2-Pentene', '1-Hexene', 'Acetylene', 'Cyclopentane', 'Methylcyclopentane',
118
+ 'Cyclohexane', 'Methylcyclohexane', 'Isoprene', '2,2-Dimethylbutane', '2,3-Dimethylbutane',
119
+ '2-Methylpentane', '3-Methylpentane', '2,4-Dimethylpentane', '2-Methylhexane', '2,3-Dimethylpentane',
120
+ '3-Methylheptane', '2,2,4-Trimethylpentane', '2,3,4-Trimethylpentane', '2-Methylheptane', '3-Methylhexane',
121
+ 'Styrene', 'Isopropylbenzene', 'n-Propylbenzene', 'm-Ethyltoluene', 'p-Ethyltoluene', 'm-Diethylbenzene',
122
+ 'p-Diethylbenzene', '1,3,5-Trimethylbenzene', 'o-Ethyltoluene', '1,2,4-Trimethylbenzene',
123
+ '1,2,3-Trimethylbenzene',
124
+ '1.2-DCB', '1.4-DCB', '1.3-Butadiene', '1-Octene', '2-Ethyltoluene', '3.4-Ethyltoluene', 'Acetaldehyde',
125
+ 'Acetone', 'Butyl Acetate', 'Ethanol', 'Ethyl Acetate', 'Hexane', 'IPA', 'Iso-Propylbenzene',
126
+ 'PCE', 'Propene', 'TCE', 'VCM',
127
+ ],
128
+ "deter_key": None,
129
+ },
130
+
131
+ "Table": {
158
132
  "pattern": "*.csv",
159
133
  "freq": "1h",
160
134
  "deter_key": None,
161
135
  },
162
136
 
163
- "VOC_ZM": {
137
+ "EPA_vertical": {
164
138
  "pattern": "*.csv",
165
139
  "freq": "1h",
166
140
  "deter_key": None,
167
141
  },
168
142
 
143
+ "Minion": {
144
+ "pattern": "*.csv",
145
+ "freq": "1h",
146
+ "deter_key": None,
147
+ },
169
148
  }