ecopipeline 0.7.1__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.
Files changed (23) hide show
  1. {ecopipeline-0.7.1/src/ecopipeline.egg-info → ecopipeline-0.7.3}/PKG-INFO +1 -1
  2. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/setup.cfg +1 -1
  3. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/load/load.py +14 -5
  4. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/transform/transform.py +1 -1
  5. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/utils/ConfigManager.py +7 -2
  6. {ecopipeline-0.7.1 → ecopipeline-0.7.3/src/ecopipeline.egg-info}/PKG-INFO +1 -1
  7. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/LICENSE +0 -0
  8. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/README.md +0 -0
  9. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/pyproject.toml +0 -0
  10. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/setup.py +0 -0
  11. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/__init__.py +0 -0
  12. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/extract/__init__.py +0 -0
  13. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/extract/extract.py +0 -0
  14. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/load/__init__.py +0 -0
  15. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/transform/__init__.py +0 -0
  16. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/transform/bayview.py +0 -0
  17. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/transform/lbnl.py +0 -0
  18. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/utils/__init__.py +0 -0
  19. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline/utils/unit_convert.py +0 -0
  20. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline.egg-info/SOURCES.txt +0 -0
  21. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
  22. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/src/ecopipeline.egg-info/requires.txt +0 -0
  23. {ecopipeline-0.7.1 → ecopipeline-0.7.3}/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.1
3
+ Version: 0.7.3
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.1
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()
@@ -460,7 +464,7 @@ def report_data_loss(config : ConfigManager, site_name : str = None):
460
464
  cursor.close()
461
465
  return True
462
466
 
463
- def load_data_statistics(config : ConfigManager, daily_stats_df : pd.DataFrame, config_daily_indicator : str = "day"):
467
+ def load_data_statistics(config : ConfigManager, daily_stats_df : pd.DataFrame, config_daily_indicator : str = "day", custom_table_name : str = None):
464
468
  """
465
469
  Logs data statistics for the site in a table with name "{daily table name}_stats"
466
470
 
@@ -472,13 +476,18 @@ def load_data_statistics(config : ConfigManager, daily_stats_df : pd.DataFrame,
472
476
  dataframe created by the create_data_statistics_df() function in ecopipeline.transform
473
477
  config_daily_indicator : str
474
478
  the indicator of the daily_table name in the config.ini file of the data pipeline
479
+ custom_table_name : str
480
+ custom table name for data statistics. Overwrites the name "{daily table name}_stats" to your custom name.
481
+ In this sense config_daily_indicator's pointer is no longer used.
475
482
 
476
483
  Returns
477
484
  -------
478
485
  bool:
479
486
  A boolean value indicating if the data was successfully written to the database.
480
487
  """
481
- table_name = f"{config.get_table_name(config_daily_indicator)}_stats"
488
+ table_name = custom_table_name
489
+ if table_name is None:
490
+ table_name = f"{config.get_table_name(config_daily_indicator)}_stats"
482
491
  return load_overwrite_database(config, daily_stats_df, config.get_db_table_info([]), config_daily_indicator, table_name=table_name)
483
492
 
484
493
  def _generate_mysql_update_event_table(row, id):
@@ -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("minute", 'table_name')
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
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ecopipeline
3
- Version: 0.7.1
3
+ Version: 0.7.3
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