ecopipeline 0.8.5__tar.gz → 0.8.7__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.
- {ecopipeline-0.8.5/src/ecopipeline.egg-info → ecopipeline-0.8.7}/PKG-INFO +1 -1
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/setup.cfg +1 -1
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/event_tracking/event_tracking.py +7 -7
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/extract/extract.py +8 -3
- {ecopipeline-0.8.5 → ecopipeline-0.8.7/src/ecopipeline.egg-info}/PKG-INFO +1 -1
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/LICENSE +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/README.md +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/pyproject.toml +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/setup.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/__init__.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/event_tracking/__init__.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/extract/__init__.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/load/__init__.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/load/load.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/transform/__init__.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/transform/bayview.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/transform/lbnl.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/transform/transform.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/utils/ConfigManager.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/utils/__init__.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline/utils/unit_convert.py +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline.egg-info/SOURCES.txt +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline.egg-info/requires.txt +0 -0
- {ecopipeline-0.8.5 → ecopipeline-0.8.7}/src/ecopipeline.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = ecopipeline
|
|
3
|
-
version = 0.8.
|
|
3
|
+
version = 0.8.7
|
|
4
4
|
authors = ["Carlos Bello, <bellocarlos@seattleu.edu>, Emil Fahrig <fahrigemil@seattleu.edu>, Casey Mang <cmang@seattleu.edu>, Julian Harris <harrisjulian@seattleu.edu>, Roger Tram <rtram@seattleu.edu>, Nolan Price <nolan@ecotope.com>"]
|
|
5
5
|
description = Contains functions for use in Ecotope Datapipelines
|
|
6
6
|
long_description = file: README.md
|
|
@@ -3,7 +3,7 @@ import numpy as np
|
|
|
3
3
|
import datetime as dt
|
|
4
4
|
from ecopipeline import ConfigManager
|
|
5
5
|
|
|
6
|
-
def flag_boundary_alarms(df: pd.DataFrame, config : ConfigManager, default_fault_time : int = 15,
|
|
6
|
+
def flag_boundary_alarms(df: pd.DataFrame, config : ConfigManager, default_fault_time : int = 15, system: str = "", full_days : list = None) -> pd.DataFrame:
|
|
7
7
|
"""
|
|
8
8
|
Function will take a pandas dataframe and location of alarm information in a csv,
|
|
9
9
|
and create an dataframe with applicable alarm events
|
|
@@ -22,8 +22,8 @@ def flag_boundary_alarms(df: pd.DataFrame, config : ConfigManager, default_fault
|
|
|
22
22
|
default_fault_time : int
|
|
23
23
|
Number of consecutive minutes that a sensor must be out of bounds for to trigger an alarm. Can be customized for each variable with
|
|
24
24
|
the fault_time column in Varriable_Names.csv
|
|
25
|
-
|
|
26
|
-
string of
|
|
25
|
+
system: str
|
|
26
|
+
string of system name if processing a particular system in a Variable_Names.csv file with multiple systems. Leave as an empty string if not aplicable.
|
|
27
27
|
full_days : list
|
|
28
28
|
list of pd.Datetimes that should be considered full days here. If set to none, will take any day at all present in df
|
|
29
29
|
|
|
@@ -39,10 +39,10 @@ def flag_boundary_alarms(df: pd.DataFrame, config : ConfigManager, default_fault
|
|
|
39
39
|
print("File Not Found: ", variable_names_path)
|
|
40
40
|
return pd.DataFrame()
|
|
41
41
|
|
|
42
|
-
if (
|
|
43
|
-
if not '
|
|
44
|
-
raise Exception("
|
|
45
|
-
bounds_df = bounds_df.loc[bounds_df['
|
|
42
|
+
if (system != ""):
|
|
43
|
+
if not 'system' in bounds_df.columns:
|
|
44
|
+
raise Exception("system parameter is non null, however, system is not present in Variable_Names.csv")
|
|
45
|
+
bounds_df = bounds_df.loc[bounds_df['system'] == system]
|
|
46
46
|
|
|
47
47
|
required_columns = ["variable_name", "high_alarm", "low_alarm"]
|
|
48
48
|
for required_column in required_columns:
|
|
@@ -753,7 +753,7 @@ def pull_egauge_data(config: ConfigManager, eGauge_ids: list, eGauge_usr : str,
|
|
|
753
753
|
|
|
754
754
|
os.chdir(original_directory)
|
|
755
755
|
|
|
756
|
-
def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: datetime = None):
|
|
756
|
+
def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: datetime = None, create_csv = True):
|
|
757
757
|
if endTime is None:
|
|
758
758
|
endTime = datetime.now()
|
|
759
759
|
if startTime is None:
|
|
@@ -770,7 +770,6 @@ def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: dat
|
|
|
770
770
|
df = df.sort_index()
|
|
771
771
|
df = df.groupby(df.index).mean()
|
|
772
772
|
return df
|
|
773
|
-
|
|
774
773
|
url = f'https://thingsboard.cloud/api/plugins/telemetry/DEVICE/{config.api_device_id}/values/timeseries'
|
|
775
774
|
token = config.get_thingsboard_token()
|
|
776
775
|
keys = _get_tb_keys(config, token)
|
|
@@ -808,8 +807,14 @@ def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: dat
|
|
|
808
807
|
df = pd.DataFrame(data)
|
|
809
808
|
df.index = pd.to_datetime(df.index, unit='ms')
|
|
810
809
|
df = df.sort_index()
|
|
810
|
+
# save to file
|
|
811
|
+
if create_csv:
|
|
812
|
+
filename = f"{startTime.strftime('%Y%m%d%H%M%S')}.csv"
|
|
813
|
+
original_directory = os.getcwd()
|
|
814
|
+
os.chdir(config.data_directory)
|
|
815
|
+
df.to_csv(filename, index_label='time_pt')
|
|
816
|
+
os.chdir(original_directory)
|
|
811
817
|
return df
|
|
812
|
-
|
|
813
818
|
print(f"Failed to make GET request. Status code: {response.status_code} {response.json()}")
|
|
814
819
|
return pd.DataFrame()
|
|
815
820
|
except Exception as e:
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|