apmtools 0.2.35__tar.gz → 0.2.36__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.
- {apmtools-0.2.35 → apmtools-0.2.36}/PKG-INFO +1 -1
- {apmtools-0.2.35 → apmtools-0.2.36}/pyproject.toml +1 -1
- {apmtools-0.2.35 → apmtools-0.2.36}/src/apmtools/classes.py +4 -4
- {apmtools-0.2.35 → apmtools-0.2.36}/src/apmtools/data_processing.py +5 -3
- {apmtools-0.2.35 → apmtools-0.2.36}/.gitignore +0 -0
- {apmtools-0.2.35 → apmtools-0.2.36}/LICENSE +0 -0
- {apmtools-0.2.35 → apmtools-0.2.36}/README.md +0 -0
- {apmtools-0.2.35 → apmtools-0.2.36}/src/apmtools/__init__.py +0 -0
- {apmtools-0.2.35 → apmtools-0.2.36}/src/apmtools/functions.py +0 -0
- {apmtools-0.2.35 → apmtools-0.2.36}/src/apmtools/legacy.py +0 -0
- {apmtools-0.2.35 → apmtools-0.2.36}/src/apmtools/shiny/__init__.py +0 -0
- {apmtools-0.2.35 → apmtools-0.2.36}/src/apmtools/shiny/summary.py +0 -0
- {apmtools-0.2.35 → apmtools-0.2.36}/src/apmtools/units.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: apmtools
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.36
|
|
4
4
|
Summary: A collection of tools for processing air pollution monitoring data
|
|
5
5
|
Project-URL: Homepage, https://github.com/federlorenz/apmtools
|
|
6
6
|
Author-email: Federico Lorenzetti <lorenzetti.federico@gmail.com>
|
|
@@ -449,7 +449,7 @@ class Dataset(DictionaryPlus):
|
|
|
449
449
|
a.filter_key = self.filter_key
|
|
450
450
|
return a
|
|
451
451
|
|
|
452
|
-
def scan_folder(self, directory="./", levels=[], level=0, monitor=None, levels_dict=None,
|
|
452
|
+
def scan_folder(self, directory="./", levels=[], level=0, monitor=None, levels_dict=None, utc_timezone_shift=0, interpolate=False, add_m={}):
|
|
453
453
|
|
|
454
454
|
from .data_processing import upas_processing, lascar_processing, purple_processing, lcm_processing
|
|
455
455
|
|
|
@@ -523,7 +523,7 @@ class Dataset(DictionaryPlus):
|
|
|
523
523
|
case "lcm":
|
|
524
524
|
try:
|
|
525
525
|
processed = lcm_processing(
|
|
526
|
-
directory, file=j, interpolate_data=interpolate)
|
|
526
|
+
directory, file=j, interpolate_data=interpolate, timezone_shift=timedelta(hours=utc_timezone_shift))
|
|
527
527
|
for k, v in levels_dict.items():
|
|
528
528
|
if (v not in ["None", "_", "-", None]) and (k not in ["monitor", "", None, "-", "_"]):
|
|
529
529
|
processed.m[k] = v
|
|
@@ -538,7 +538,7 @@ class Dataset(DictionaryPlus):
|
|
|
538
538
|
case "purple":
|
|
539
539
|
try:
|
|
540
540
|
processed = purple_processing(
|
|
541
|
-
f"{directory}/", timezone_shift=timedelta(hours=
|
|
541
|
+
f"{directory}/", timezone_shift=timedelta(hours=utc_timezone_shift), interpolate_data=interpolate)
|
|
542
542
|
for k, v in levels_dict.items():
|
|
543
543
|
if (v not in ["None", "_", "-", None]) and (k not in ["monitor", "", None, "-", "_"]):
|
|
544
544
|
processed.m[k] = v
|
|
@@ -564,7 +564,7 @@ class Dataset(DictionaryPlus):
|
|
|
564
564
|
if levels[r] not in levels[:level+1]:
|
|
565
565
|
levels_dict[levels[r]] = None
|
|
566
566
|
self.scan_folder(directory=f"{directory}{j}/", levels=levels,
|
|
567
|
-
level=level+1, monitor=monitor, levels_dict=levels_dict,
|
|
567
|
+
level=level+1, monitor=monitor, levels_dict=levels_dict, utc_timezone_shift=utc_timezone_shift, interpolate=interpolate, add_m=add_m)
|
|
568
568
|
|
|
569
569
|
def save_summary(self, save_csv=True, filename="./", columns={}, merged=True):
|
|
570
570
|
types_in = list(set(type(v) for v in self.values()))
|
|
@@ -842,15 +842,17 @@ def lascar_processing(directory, file, interpolation=1,interval="30 seconds", in
|
|
|
842
842
|
return out
|
|
843
843
|
|
|
844
844
|
|
|
845
|
-
def lcm_processing(directory, file, interpolation=1, interval="300 seconds", interpolate_data=True):
|
|
845
|
+
def lcm_processing(directory, file, interpolation=1, interval="300 seconds", interpolate_data=True, timezone_shift=dt.timedelta(hours=0)):
|
|
846
846
|
numeric = ["PM2.5", "PM10", "CO2", "NO2", "Temperature", "Humidity"]
|
|
847
847
|
dtformat = '%Y-%m-%dT%H:%M:%S'
|
|
848
|
-
df = pd.read_csv(directory+file
|
|
849
|
-
|
|
848
|
+
df = pd.read_csv(directory+file)
|
|
849
|
+
df['timestamp'] = df['timestamp'].map(to_datetime)
|
|
850
|
+
df.set_index('timestamp', inplace=True)
|
|
850
851
|
if interpolate_data:
|
|
851
852
|
df = interpolate(df, 300, interpolation, pd.Timedelta(
|
|
852
853
|
'00:06:00'), numeric_columns=numeric, add_binary_counter=False)
|
|
853
854
|
df = keep_interval(df, interval)
|
|
855
|
+
df.index = df.index + timezone_shift
|
|
854
856
|
out = Lcm(df)
|
|
855
857
|
return out
|
|
856
858
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|