ecopipeline 0.7.2__tar.gz → 0.7.4__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.
Files changed (23) hide show
  1. {ecopipeline-0.7.2/src/ecopipeline.egg-info → ecopipeline-0.7.4}/PKG-INFO +1 -1
  2. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/setup.cfg +1 -1
  3. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/load/load.py +7 -3
  4. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/transform/transform.py +1 -1
  5. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/utils/ConfigManager.py +10 -2
  6. {ecopipeline-0.7.2 → ecopipeline-0.7.4/src/ecopipeline.egg-info}/PKG-INFO +1 -1
  7. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/LICENSE +0 -0
  8. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/README.md +0 -0
  9. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/pyproject.toml +0 -0
  10. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/setup.py +0 -0
  11. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/__init__.py +0 -0
  12. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/extract/__init__.py +0 -0
  13. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/extract/extract.py +0 -0
  14. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/load/__init__.py +0 -0
  15. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/transform/__init__.py +0 -0
  16. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/transform/bayview.py +0 -0
  17. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/transform/lbnl.py +0 -0
  18. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/utils/__init__.py +0 -0
  19. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline/utils/unit_convert.py +0 -0
  20. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline.egg-info/SOURCES.txt +0 -0
  21. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
  22. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline.egg-info/requires.txt +0 -0
  23. {ecopipeline-0.7.2 → ecopipeline-0.7.4}/src/ecopipeline.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ecopipeline
3
- Version: 0.7.2
3
+ Version: 0.7.4
4
4
  Summary: Contains functions for use in Ecotope Datapipelines
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: GNU General Public License (GPL)
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = ecopipeline
3
- version = 0.7.2
3
+ version = 0.7.4
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%
@@ -3,6 +3,7 @@ import os
3
3
  import mysql.connector
4
4
  import mysql.connector.cursor
5
5
  import requests
6
+ from datetime import datetime
6
7
 
7
8
  class ConfigManager:
8
9
  """
@@ -27,6 +28,8 @@ class ConfigManager:
27
28
  Defaults to False
28
29
  """
29
30
  def __init__(self, config_file_path : str = "config.ini", input_directory : str = None, output_directory : str = None, data_directory : str = None, eco_file_structure : bool = False):
31
+ print(f"<<<========== CONFIGMANAGER INITIALIZED AT {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} ==========>>>")
32
+
30
33
  os.chdir(os.getcwd())
31
34
 
32
35
  self.config_directory = config_file_path
@@ -156,15 +159,20 @@ class ConfigManager:
156
159
  """
157
160
  return self.db_connection_info['database']
158
161
 
159
- def get_site_name(self):
162
+ def get_site_name(self, config_key : str = "minute"):
160
163
  """
161
164
  returns name of site
165
+
166
+ Parameters
167
+ ----------
168
+ config_key : str
169
+ 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
170
  """
163
171
  # TODO needs an update
164
172
  configure = configparser.ConfigParser()
165
173
  configure.read(self.config_directory)
166
174
 
167
- return configure.get("minute", 'table_name')
175
+ return configure.get(config_key, 'table_name')
168
176
 
169
177
  def connect_db(self) -> (mysql.connector.MySQLConnection, mysql.connector.cursor.MySQLCursor):
170
178
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ecopipeline
3
- Version: 0.7.2
3
+ Version: 0.7.4
4
4
  Summary: Contains functions for use in Ecotope Datapipelines
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: GNU General Public License (GPL)
File without changes
File without changes
File without changes
File without changes