ecopipeline 0.8.1__py3-none-any.whl → 0.8.3__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.
- ecopipeline/event_tracking/event_tracking.py +8 -5
- ecopipeline/extract/extract.py +1 -1
- ecopipeline/load/load.py +2 -1
- {ecopipeline-0.8.1.dist-info → ecopipeline-0.8.3.dist-info}/METADATA +1 -1
- {ecopipeline-0.8.1.dist-info → ecopipeline-0.8.3.dist-info}/RECORD +8 -8
- {ecopipeline-0.8.1.dist-info → ecopipeline-0.8.3.dist-info}/WHEEL +0 -0
- {ecopipeline-0.8.1.dist-info → ecopipeline-0.8.3.dist-info}/licenses/LICENSE +0 -0
- {ecopipeline-0.8.1.dist-info → ecopipeline-0.8.3.dist-info}/top_level.txt +0 -0
|
@@ -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,
|
|
6
|
+
def flag_boundary_alarms(df: pd.DataFrame, config : ConfigManager, default_fault_time : int = 15, site: str = "") -> 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
|
|
@@ -11,9 +11,8 @@ def flag_boundary_alarms(df: pd.DataFrame, daily_df : pd.DataFrame, config : Con
|
|
|
11
11
|
Parameters
|
|
12
12
|
----------
|
|
13
13
|
df: pd.DataFrame
|
|
14
|
-
post-transformed dataframe for minute data
|
|
15
|
-
|
|
16
|
-
post-transformed dataframe for daily data
|
|
14
|
+
post-transformed dataframe for minute data. It should be noted that this function expects consecutive, in order minutes. If minutes
|
|
15
|
+
are out of order or have gaps, the function may return erroneous alarms.
|
|
17
16
|
config : ecopipeline.ConfigManager
|
|
18
17
|
The ConfigManager object that holds configuration data for the pipeline. Among other things, this object will point to a file
|
|
19
18
|
called Varriable_Names.csv in the input folder of the pipeline (e.g. "full/path/to/pipeline/input/Variable_Names.csv").
|
|
@@ -51,6 +50,10 @@ def flag_boundary_alarms(df: pd.DataFrame, daily_df : pd.DataFrame, config : Con
|
|
|
51
50
|
bounds_df['pretty_name'] = bounds_df['variable_name']
|
|
52
51
|
if not 'fault_time' in bounds_df.columns:
|
|
53
52
|
bounds_df['fault_time'] = default_fault_time
|
|
53
|
+
|
|
54
|
+
idx = df.index
|
|
55
|
+
unique_days = pd.to_datetime(pd.Series(idx).dt.normalize().unique())
|
|
56
|
+
|
|
54
57
|
bounds_df = bounds_df.loc[:, ["variable_name", "high_alarm", "low_alarm", "fault_time", "pretty_name"]]
|
|
55
58
|
bounds_df.dropna(axis=0, thresh=2, inplace=True)
|
|
56
59
|
bounds_df.set_index(['variable_name'], inplace=True)
|
|
@@ -66,7 +69,7 @@ def flag_boundary_alarms(df: pd.DataFrame, daily_df : pd.DataFrame, config : Con
|
|
|
66
69
|
upper_mask = df[bound_var] > bounds["high_alarm"]
|
|
67
70
|
if pd.isna(bounds['fault_time']):
|
|
68
71
|
bounds['fault_time'] = default_fault_time
|
|
69
|
-
for day in
|
|
72
|
+
for day in unique_days:
|
|
70
73
|
next_day = day + pd.Timedelta(days=1)
|
|
71
74
|
# low alert
|
|
72
75
|
low_filtered_df = lower_mask.loc[(lower_mask.index >= day) & (lower_mask.index < next_day)]
|
ecopipeline/extract/extract.py
CHANGED
|
@@ -760,7 +760,7 @@ def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: dat
|
|
|
760
760
|
# 28 hours to ensure encapsulation of last day
|
|
761
761
|
startTime = endTime - timedelta(hours=28)
|
|
762
762
|
|
|
763
|
-
if endTime - timedelta(hours=
|
|
763
|
+
if endTime - timedelta(hours=12) > startTime:
|
|
764
764
|
time_diff = endTime - startTime
|
|
765
765
|
midpointTime = startTime + time_diff / 2
|
|
766
766
|
# recursively construct the df
|
ecopipeline/load/load.py
CHANGED
|
@@ -385,8 +385,9 @@ def load_event_table(config : ConfigManager, event_df: pd.DataFrame, site_name :
|
|
|
385
385
|
(existing_rows['event_type'] == row['event_type'])
|
|
386
386
|
]
|
|
387
387
|
if not time_data[-1] is None and not filtered_existing_rows.empty:
|
|
388
|
+
# silent alarm only
|
|
388
389
|
filtered_existing_rows = filtered_existing_rows[(filtered_existing_rows['variable_name'] == row['variable_name']) &
|
|
389
|
-
(filtered_existing_rows['event_detail'] == row['event_detail'])]
|
|
390
|
+
(filtered_existing_rows['event_detail'].str[:20] == row['event_detail'][:20])] # the [:20] part is a bug fix for partial days for silent alarms
|
|
390
391
|
|
|
391
392
|
if not filtered_existing_rows.empty:
|
|
392
393
|
first_matching_row = filtered_existing_rows.iloc[0] # Retrieves the first row
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ecopipeline/__init__.py,sha256=d48mO5La6OrQDkRe_qqoY6lUx7x-e8krOH388jmWjwU,218
|
|
2
2
|
ecopipeline/event_tracking/__init__.py,sha256=q49j46fXMUjNUPzL4FvXEppB93i3lUni-QUZpp61tt0,64
|
|
3
|
-
ecopipeline/event_tracking/event_tracking.py,sha256=
|
|
3
|
+
ecopipeline/event_tracking/event_tracking.py,sha256=PHy4xYv71u79UZqFuXnMU7KRwbzOCIc-NNqArcmG9FM,12311
|
|
4
4
|
ecopipeline/extract/__init__.py,sha256=gQ3sak6NJ63Gpo-hZXrtZfeKOTHLRyAVXfTgxxRpqPo,675
|
|
5
|
-
ecopipeline/extract/extract.py,sha256=
|
|
5
|
+
ecopipeline/extract/extract.py,sha256=Fch2IvqGxMClKGniiJiKqyJhcFDwkckaeiGQRVnUGUg,46708
|
|
6
6
|
ecopipeline/load/__init__.py,sha256=NLa_efQJZ8aP-J0Y5xx9DP7mtfRH9jY6Jz1ZMZN_BAA,292
|
|
7
|
-
ecopipeline/load/load.py,sha256=
|
|
7
|
+
ecopipeline/load/load.py,sha256=Ptxr0MOjns_HeVSmZsLLApHJGB-z6XOB2m8LNiVaD7E,23860
|
|
8
8
|
ecopipeline/transform/__init__.py,sha256=hYb4F64fXdXtjBSYCqv6gLFBwKZjjnl0z7s291pFE98,2505
|
|
9
9
|
ecopipeline/transform/bayview.py,sha256=TP24dnTsUD95X-f6732egPZKjepFLJgDm9ImGr-fppY,17899
|
|
10
10
|
ecopipeline/transform/lbnl.py,sha256=EQ54G4rJXaZ7pwVusKcdK2KBehSdCsNo2ybphtMGs7o,33400
|
|
@@ -12,8 +12,8 @@ ecopipeline/transform/transform.py,sha256=DBQD4WqKmdXnGQMAj6tg75HtXiSemIc7c6nZxz
|
|
|
12
12
|
ecopipeline/utils/ConfigManager.py,sha256=-g1wtExdvhYO5Y6Q3cRbywa__DxRMFruLrB4YanwaPY,12168
|
|
13
13
|
ecopipeline/utils/__init__.py,sha256=ccWUR0m7gD9DfcgsxBCLOfi4lho6RdYuB2Ugy_g6ZdQ,28
|
|
14
14
|
ecopipeline/utils/unit_convert.py,sha256=VFh1we2Y8KV3u21BeWb-U3TlZJXo83q5vdxxkpgcuME,3064
|
|
15
|
-
ecopipeline-0.8.
|
|
16
|
-
ecopipeline-0.8.
|
|
17
|
-
ecopipeline-0.8.
|
|
18
|
-
ecopipeline-0.8.
|
|
19
|
-
ecopipeline-0.8.
|
|
15
|
+
ecopipeline-0.8.3.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
ecopipeline-0.8.3.dist-info/METADATA,sha256=N0ZTWUbmVtj99GIrkWfZ8gSdwHiQSla0TOJ9nMDiBCU,2329
|
|
17
|
+
ecopipeline-0.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
18
|
+
ecopipeline-0.8.3.dist-info/top_level.txt,sha256=WOPFJH2LIgKqm4lk2OnFF5cgVkYibkaBxIxgvLgO7y0,12
|
|
19
|
+
ecopipeline-0.8.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|