ecopipeline 0.7.2__tar.gz → 0.7.3__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.7.2/src/ecopipeline.egg-info → ecopipeline-0.7.3}/PKG-INFO +1 -1
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/setup.cfg +1 -1
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/load/load.py +7 -3
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/transform/transform.py +1 -1
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/utils/ConfigManager.py +7 -2
- {ecopipeline-0.7.2 → ecopipeline-0.7.3/src/ecopipeline.egg-info}/PKG-INFO +1 -1
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/LICENSE +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/README.md +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/pyproject.toml +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/setup.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/__init__.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/extract/__init__.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/extract/extract.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/load/__init__.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/transform/__init__.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/transform/bayview.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/transform/lbnl.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/utils/__init__.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline/utils/unit_convert.py +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline.egg-info/SOURCES.txt +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline.egg-info/requires.txt +0 -0
- {ecopipeline-0.7.2 → ecopipeline-0.7.3}/src/ecopipeline.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = ecopipeline
|
|
3
|
-
version = 0.7.
|
|
3
|
+
version = 0.7.3
|
|
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
|
|
@@ -162,7 +162,8 @@ def create_new_columns(cursor : mysql.connector.cursor.MySQLCursor, table_name:
|
|
|
162
162
|
return True
|
|
163
163
|
|
|
164
164
|
def load_overwrite_database(config : ConfigManager, dataframe: pd.DataFrame, config_info: dict, data_type: str,
|
|
165
|
-
primary_key: str = "time_pt", table_name: str = None, auto_log_data_loss : bool = False
|
|
165
|
+
primary_key: str = "time_pt", table_name: str = None, auto_log_data_loss : bool = False,
|
|
166
|
+
config_key : str = "minute"):
|
|
166
167
|
"""
|
|
167
168
|
Loads given pandas DataFrame into a MySQL table overwriting any conflicting data. Uses an UPSERT strategy to ensure any gaps in data are filled.
|
|
168
169
|
Note: will not overwrite values with NULL. Must have a new value to overwrite existing values in database
|
|
@@ -184,6 +185,9 @@ def load_overwrite_database(config : ConfigManager, dataframe: pd.DataFrame, con
|
|
|
184
185
|
auto_log_data_loss : bool
|
|
185
186
|
if set to True, a data loss event will be reported if no data exits in the dataframe
|
|
186
187
|
for the last two days from the current date OR if an error occurs
|
|
188
|
+
config_key : str
|
|
189
|
+
The key in the config.ini file that points to the minute table data for the site. The name of this table is also the site name.
|
|
190
|
+
|
|
187
191
|
|
|
188
192
|
Returns
|
|
189
193
|
-------
|
|
@@ -208,7 +212,7 @@ def load_overwrite_database(config : ConfigManager, dataframe: pd.DataFrame, con
|
|
|
208
212
|
|
|
209
213
|
print(f"Attempting to write data for {dataframe.index[0]} to {dataframe.index[-1]} into {table_name}")
|
|
210
214
|
if auto_log_data_loss and dataframe.index[-1] < datetime.now() - timedelta(days=3):
|
|
211
|
-
report_data_loss(config)
|
|
215
|
+
report_data_loss(config, config.get_site_name(config_key))
|
|
212
216
|
|
|
213
217
|
# Get string of all column names for sql insert
|
|
214
218
|
sensor_names = primary_key
|
|
@@ -271,7 +275,7 @@ def load_overwrite_database(config : ConfigManager, dataframe: pd.DataFrame, con
|
|
|
271
275
|
except Exception as e:
|
|
272
276
|
print(f"Unable to load data into database. Exception: {e}")
|
|
273
277
|
if auto_log_data_loss:
|
|
274
|
-
report_data_loss(config)
|
|
278
|
+
report_data_loss(config, config.get_site_name(config_key))
|
|
275
279
|
ret_value = False
|
|
276
280
|
|
|
277
281
|
db_connection.close()
|
|
@@ -1029,7 +1029,7 @@ def join_to_daily(daily_data: pd.DataFrame, cop_data: pd.DataFrame) -> pd.DataFr
|
|
|
1029
1029
|
|
|
1030
1030
|
def apply_equipment_cop_derate(df: pd.DataFrame, equip_cop_col: str, r_val : int = 16) -> pd.DataFrame:
|
|
1031
1031
|
"""
|
|
1032
|
-
Function derates equipment COP based on R value
|
|
1032
|
+
Function derates equipment method system COP based on R value
|
|
1033
1033
|
R12 - R16 : 12 %
|
|
1034
1034
|
R16 - R20 : 10%
|
|
1035
1035
|
R20 - R24 : 8%
|
|
@@ -156,15 +156,20 @@ class ConfigManager:
|
|
|
156
156
|
"""
|
|
157
157
|
return self.db_connection_info['database']
|
|
158
158
|
|
|
159
|
-
def get_site_name(self):
|
|
159
|
+
def get_site_name(self, config_key : str = "minute"):
|
|
160
160
|
"""
|
|
161
161
|
returns name of site
|
|
162
|
+
|
|
163
|
+
Parameters
|
|
164
|
+
----------
|
|
165
|
+
config_key : str
|
|
166
|
+
The key in the config.ini file that points to the minute table data for the site. The name of this table is also the site name.
|
|
162
167
|
"""
|
|
163
168
|
# TODO needs an update
|
|
164
169
|
configure = configparser.ConfigParser()
|
|
165
170
|
configure.read(self.config_directory)
|
|
166
171
|
|
|
167
|
-
return configure.get(
|
|
172
|
+
return configure.get(config_key, 'table_name')
|
|
168
173
|
|
|
169
174
|
def connect_db(self) -> (mysql.connector.MySQLConnection, mysql.connector.cursor.MySQLCursor):
|
|
170
175
|
"""
|
|
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
|