AeroViz 0.1.2__py3-none-any.whl → 0.1.3b0__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 +4 -4
- AeroViz/config/DEFAULT_DATA.csv +1417 -0
- AeroViz/config/DEFAULT_PNSD_DATA.csv +1417 -0
- AeroViz/dataProcess/Chemistry/__init__.py +38 -38
- AeroViz/dataProcess/Chemistry/_calculate.py +15 -15
- AeroViz/dataProcess/Chemistry/_isoropia.py +69 -68
- AeroViz/dataProcess/Chemistry/_mass_volume.py +158 -158
- AeroViz/dataProcess/Chemistry/_ocec.py +109 -109
- AeroViz/dataProcess/Chemistry/_partition.py +19 -18
- AeroViz/dataProcess/Chemistry/_teom.py +8 -11
- AeroViz/dataProcess/Optical/_IMPROVE.py +40 -39
- AeroViz/dataProcess/Optical/__init__.py +35 -35
- AeroViz/dataProcess/Optical/_absorption.py +35 -35
- AeroViz/dataProcess/Optical/_extinction.py +25 -24
- AeroViz/dataProcess/Optical/_mie.py +5 -6
- AeroViz/dataProcess/Optical/_mie_sd.py +89 -90
- AeroViz/dataProcess/Optical/_scattering.py +16 -16
- AeroViz/dataProcess/SizeDistr/__init__.py +37 -37
- 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 +326 -326
- AeroViz/dataProcess/SizeDistr/_merge_v4.py +272 -274
- AeroViz/dataProcess/SizeDistr/_size_distr.py +51 -51
- AeroViz/dataProcess/VOC/__init__.py +7 -7
- AeroViz/dataProcess/VOC/_potential_par.py +53 -55
- AeroViz/dataProcess/VOC/voc_par.json +464 -0
- AeroViz/dataProcess/__init__.py +4 -4
- AeroViz/dataProcess/core/__init__.py +59 -58
- AeroViz/plot/__init__.py +6 -1
- AeroViz/plot/bar.py +126 -0
- AeroViz/plot/box.py +68 -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 +210 -0
- AeroViz/plot/scatter.py +99 -0
- AeroViz/plot/templates/__init__.py +0 -3
- AeroViz/plot/templates/contour.py +25 -25
- AeroViz/plot/templates/corr_matrix.py +86 -93
- AeroViz/plot/templates/diurnal_pattern.py +24 -24
- AeroViz/plot/templates/koschmieder.py +106 -106
- AeroViz/plot/templates/metal_heatmap.py +34 -34
- AeroViz/plot/timeseries/timeseries.py +53 -60
- AeroViz/plot/utils/__init__.py +2 -1
- AeroViz/plot/utils/_color.py +57 -57
- AeroViz/plot/utils/_unit.py +48 -48
- AeroViz/plot/utils/fRH.json +390 -0
- AeroViz/plot/utils/plt_utils.py +92 -0
- AeroViz/plot/utils/sklearn_utils.py +49 -0
- AeroViz/plot/utils/units.json +84 -0
- AeroViz/plot/violin.py +79 -0
- AeroViz/process/__init__.py +15 -15
- 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 +166 -166
- 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 +57 -57
- AeroViz/rawDataReader/core/__init__.py +328 -326
- AeroViz/rawDataReader/script/AE33.py +18 -18
- AeroViz/rawDataReader/script/AE43.py +20 -20
- AeroViz/rawDataReader/script/APS_3321.py +30 -30
- AeroViz/rawDataReader/script/Aurora.py +23 -23
- AeroViz/rawDataReader/script/BC1054.py +40 -40
- AeroViz/rawDataReader/script/EPA_vertical.py +9 -9
- AeroViz/rawDataReader/script/GRIMM.py +21 -21
- AeroViz/rawDataReader/script/IGAC_TH.py +67 -67
- AeroViz/rawDataReader/script/IGAC_ZM.py +59 -59
- AeroViz/rawDataReader/script/MA350.py +39 -39
- AeroViz/rawDataReader/script/NEPH.py +74 -74
- AeroViz/rawDataReader/script/OCEC_LCRES.py +21 -21
- AeroViz/rawDataReader/script/OCEC_RES.py +16 -16
- 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/TEOM.py +28 -28
- AeroViz/rawDataReader/script/Table.py +12 -12
- AeroViz/rawDataReader/script/VOC_TH.py +16 -16
- AeroViz/rawDataReader/script/VOC_ZM.py +28 -28
- AeroViz/rawDataReader/script/__init__.py +20 -20
- AeroViz/rawDataReader/utils/config.py +161 -161
- AeroViz/tools/database.py +65 -65
- AeroViz/tools/dataclassifier.py +106 -106
- AeroViz/tools/dataprinter.py +51 -51
- AeroViz/tools/datareader.py +38 -38
- {AeroViz-0.1.2.dist-info → AeroViz-0.1.3b0.dist-info}/METADATA +5 -4
- AeroViz-0.1.3b0.dist-info/RECORD +110 -0
- AeroViz/config/__init__.py +0 -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-0.1.2.dist-info/RECORD +0 -106
- {AeroViz-0.1.2.dist-info → AeroViz-0.1.3b0.dist-info}/LICENSE +0 -0
- {AeroViz-0.1.2.dist-info → AeroViz-0.1.3b0.dist-info}/WHEEL +0 -0
- {AeroViz-0.1.2.dist-info → AeroViz-0.1.3b0.dist-info}/top_level.txt +0 -0
|
@@ -1,169 +1,169 @@
|
|
|
1
1
|
# Description: Configuration file for rawDataReader
|
|
2
2
|
|
|
3
3
|
instrument = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
]
|
|
16
16
|
|
|
17
17
|
meta = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
18
|
+
"NEPH": {
|
|
19
|
+
"pattern": "*.DAT",
|
|
20
|
+
"freq": "5min",
|
|
21
|
+
"deter_key": {"Scatter Coe. (550 nm)": ["G"]},
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
"Aurora": {
|
|
25
|
+
"pattern": "*.csv",
|
|
26
|
+
"freq": "1min",
|
|
27
|
+
"deter_key": {"Scatter Coe. (550 nm)": ["G"]},
|
|
28
|
+
},
|
|
29
|
+
|
|
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
|
+
"SMPS_TH": {
|
|
43
|
+
"pattern": "*.txt",
|
|
44
|
+
"freq": "6min",
|
|
45
|
+
"deter_key": {"Bins": ["all"]},
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
"SMPS_genr": {
|
|
49
|
+
"pattern": "*.txt",
|
|
50
|
+
"freq": "6min",
|
|
51
|
+
"deter_key": {"Bins": ["all"]},
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
"SMPS_aim11": {
|
|
55
|
+
"pattern": "*.csv",
|
|
56
|
+
"freq": "6min",
|
|
57
|
+
"deter_key": {"Bins": ["all"]},
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
"GRIMM": {
|
|
61
|
+
"pattern": "*.dat",
|
|
62
|
+
"freq": "6min",
|
|
63
|
+
"deter_key": {"Bins": ["all"]},
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
"APS_3321": {
|
|
67
|
+
"pattern": "*.TXT",
|
|
68
|
+
"freq": "6min",
|
|
69
|
+
"deter_key": {"Bins": ["all"]},
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
"AE33": {
|
|
73
|
+
"pattern": "[!ST|!CT|!FV]*[!log]_AE33*.dat",
|
|
74
|
+
"freq": "1min",
|
|
75
|
+
"deter_key": {"BC Mass Conc. (880 nm)": ["BC6"]},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
"AE43": {
|
|
79
|
+
"pattern": "[!ST|!CT|!FV]*[!log]_AE43*.dat",
|
|
80
|
+
"freq": "1min",
|
|
81
|
+
"deter_key": {"BC Mass Conc. (880 nm)": ["BC6"]},
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
"BC1054": {
|
|
85
|
+
"pattern": "*.csv",
|
|
86
|
+
"freq": "1min",
|
|
87
|
+
"deter_key": {"BC Mass Conc. (880 nm)": ["BC6"]},
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
"MA350": {
|
|
91
|
+
"pattern": "*.csv",
|
|
92
|
+
"freq": "1min",
|
|
93
|
+
"deter_key": {"BC Mass Conc. (880 nm)": ["BC5"]},
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
"TEOM": {
|
|
97
|
+
"pattern": "*.csv",
|
|
98
|
+
"freq": "6min",
|
|
99
|
+
"deter_key": {
|
|
100
|
+
"PM1.0 Mass Conc.": ["PM_Total"],
|
|
101
|
+
"PM1.0 NV Mass Conc.": ["PM_NV"],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
"OCEC_LCRES": {
|
|
106
|
+
"pattern": "*LCRes.csv",
|
|
107
|
+
"freq": "1h",
|
|
108
|
+
"deter_key": {
|
|
109
|
+
"Thermal OC/EC": ["Thermal_EC", "Thermal_OC"],
|
|
110
|
+
"Thermal OC": ["Thermal_OC"],
|
|
111
|
+
"Thermal EC": ["Thermal_EC"],
|
|
112
|
+
"Optical OC/EC": ["Optical_EC", "Optical_OC"],
|
|
113
|
+
"Optical OC": ["Optical_OC"],
|
|
114
|
+
"Optical EC": ["Optical_EC"],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
"OCEC_RES": {
|
|
119
|
+
"pattern": "*[!LC|!Blanks]Res.csv",
|
|
120
|
+
"freq": "1h",
|
|
121
|
+
"deter_key": None,
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
"IGAC_TH": {
|
|
125
|
+
"pattern": "*.csv",
|
|
126
|
+
"freq": "1h",
|
|
127
|
+
"deter_key": {
|
|
128
|
+
"Na+": ["Na+"],
|
|
129
|
+
"NH4+": ["NH4+"],
|
|
130
|
+
"K+": ["K+"],
|
|
131
|
+
"Mg2+": ["Mg2+"],
|
|
132
|
+
"Ca2+": ["Ca2+"],
|
|
133
|
+
"Cl-": ["Cl-"],
|
|
134
|
+
"NO2-": ["NO2-"],
|
|
135
|
+
"NO3-": ["NO3-"],
|
|
136
|
+
"SO42-": ["SO42-"],
|
|
137
|
+
"Main Salt (NH4+, NO3-, SO42-)": ["NO3-", "SO42-", "NH4+"],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
"IGAC_ZM": {
|
|
142
|
+
"pattern": "*.csv",
|
|
143
|
+
"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": {
|
|
158
|
+
"pattern": "*.csv",
|
|
159
|
+
"freq": "1h",
|
|
160
|
+
"deter_key": None,
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
"VOC_ZM": {
|
|
164
|
+
"pattern": "*.csv",
|
|
165
|
+
"freq": "1h",
|
|
166
|
+
"deter_key": None,
|
|
167
|
+
},
|
|
168
168
|
|
|
169
169
|
}
|
AeroViz/tools/database.py
CHANGED
|
@@ -6,92 +6,92 @@ from pandas import read_csv, DataFrame
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def load_default_chemical_data():
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
# The following data is from the chemical composition of real atmospheric particles.
|
|
10
|
+
#
|
|
11
|
+
# The six main chemical components that comprised PM2.5 are listed in the data.
|
|
12
|
+
# Here, we test the radar charts to see if we can clearly identify how the
|
|
13
|
+
# chemical components vary between the three pollutant scenarios:
|
|
14
|
+
#
|
|
15
|
+
# 1) Whole sampling period (Total)
|
|
16
|
+
# 2) Clean period (Clean)
|
|
17
|
+
# 3) Transition period (Transition)
|
|
18
|
+
# 4) Event period (Event)
|
|
19
|
+
|
|
20
|
+
data = {
|
|
21
|
+
'Sulfate': [0.01, 0.34, 0.02, 0.71],
|
|
22
|
+
'Nitrate': [0.88, 0.13, 0.34, 0.13],
|
|
23
|
+
'OC': [0.07, 0.95, 0.04, 0.05],
|
|
24
|
+
'EC': [0.20, 0.02, 0.85, 0.19],
|
|
25
|
+
'Soil': [0.20, 0.10, 0.07, 0.01],
|
|
26
|
+
'SS': [0.20, 0.10, 0.07, 0.01]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return DataFrame(data, index=['Total', 'Clean', 'Transition', 'Event'])
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def load_dataset_by_url(dataset_name: Literal["Tunghai", "Taipei"] = "Tunghai") -> DataFrame:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
import requests
|
|
34
|
+
dataset_uris = {
|
|
35
|
+
"Tunghai": "https://raw.githubusercontent.com/alex870521/DataPlot/main/DataPlot/config/default_data.csv"
|
|
36
|
+
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
# Ensure the dataset name is valid
|
|
39
|
+
if dataset_name not in dataset_uris:
|
|
40
|
+
raise ValueError(f"Dataset {dataset_name} is not supported.")
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
url = dataset_uris[dataset_name]
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
# Make a request to the URL
|
|
45
|
+
response = requests.get(url)
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
if response.status_code == 200:
|
|
48
|
+
return read_csv(StringIO(response.text), parse_dates=['Time'], index_col='Time')
|
|
49
|
+
else:
|
|
50
|
+
print(f"Failed to download file: {response.status_code}")
|
|
51
|
+
print(response.text) # Print the response text for debugging
|
|
52
|
+
return DataFrame() # Return an empty DataFrame in case of failure
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def load_dataset_local(dataset_name: Literal["Tunghai", "Taipei", "PNSD"] = "Tunghai") -> DataFrame:
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
base_dir = Path(__file__).resolve().parent.parent
|
|
57
|
+
config_dir = base_dir / 'config'
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
dataset_paths = {
|
|
60
|
+
"Tunghai": config_dir / 'DEFAULT_DATA.csv',
|
|
61
|
+
"Taipei": config_dir / 'DEFAULT_DATA.csv',
|
|
62
|
+
"PNSD": config_dir / 'DEFAULT_PNSD_DATA.csv'
|
|
63
|
+
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
if dataset_name not in dataset_paths:
|
|
66
|
+
raise ValueError(f"Dataset {dataset_name} is not supported.")
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
file_path = dataset_paths[dataset_name]
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
if not file_path.exists():
|
|
71
|
+
raise FileNotFoundError(f"The file {file_path} does not exist.")
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
return read_csv(file_path, parse_dates=['Time'], index_col='Time', na_values=('-', 'E', 'F'), low_memory=False)
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
class DataBase:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
def __new__(cls, file_path: Path | str = None, load_data: bool = False, load_PSD: bool = False):
|
|
78
|
+
print(f'Loading:\033[96m Default Data\033[0m')
|
|
79
|
+
if file_path is not None:
|
|
80
|
+
file_path = Path(file_path)
|
|
81
|
+
if file_path.exists():
|
|
82
|
+
return read_csv(file_path, parse_dates=['Time'], index_col='Time', na_values=('-', 'E', 'F'),
|
|
83
|
+
low_memory=False)
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if load_data ^ load_PSD:
|
|
86
|
+
if load_data:
|
|
87
|
+
return load_dataset_local("Tunghai")
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
elif load_PSD:
|
|
90
|
+
return load_dataset_local("PNSD")
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
else:
|
|
93
|
+
raise ValueError("Exactly one of 'load_data' or 'load_PSD' must be True.")
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
if __name__ == '__main__':
|
|
97
|
-
|
|
97
|
+
df = DataBase("Tunghai")
|