ecopipeline 0.4.15__tar.gz → 0.4.17__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.4.15/src/ecopipeline.egg-info → ecopipeline-0.4.17}/PKG-INFO +1 -1
  2. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/setup.cfg +1 -1
  3. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/extract/extract.py +19 -10
  4. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/load/load.py +1 -1
  5. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/transform/transform.py +1 -1
  6. {ecopipeline-0.4.15 → ecopipeline-0.4.17/src/ecopipeline.egg-info}/PKG-INFO +1 -1
  7. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/LICENSE +0 -0
  8. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/README.md +0 -0
  9. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/pyproject.toml +0 -0
  10. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/setup.py +0 -0
  11. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/__init__.py +0 -0
  12. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/extract/__init__.py +0 -0
  13. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/load/__init__.py +0 -0
  14. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/transform/__init__.py +0 -0
  15. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/transform/bayview.py +0 -0
  16. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/transform/lbnl.py +0 -0
  17. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/utils/ConfigManager.py +0 -0
  18. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/utils/__init__.py +0 -0
  19. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline/utils/unit_convert.py +0 -0
  20. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline.egg-info/SOURCES.txt +0 -0
  21. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
  22. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline.egg-info/requires.txt +0 -0
  23. {ecopipeline-0.4.15 → ecopipeline-0.4.17}/src/ecopipeline.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecopipeline
3
- Version: 0.4.15
3
+ Version: 0.4.17
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.4.15
3
+ version = 0.4.17
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
@@ -16,7 +16,7 @@ import requests
16
16
  import subprocess
17
17
 
18
18
 
19
- def get_last_full_day_from_db(config : ConfigManager) -> datetime:
19
+ def get_last_full_day_from_db(config : ConfigManager, table_identifier : str = "minute") -> datetime:
20
20
  """
21
21
  Function retrieves the last line from the database with the most recent datetime
22
22
  in local time.
@@ -25,6 +25,8 @@ def get_last_full_day_from_db(config : ConfigManager) -> datetime:
25
25
  ----------
26
26
  config : ecopipeline.ConfigManager
27
27
  The ConfigManager object that holds configuration data for the pipeline
28
+ table_identifier : str
29
+ Table identifier in config.ini with minute data. Default: "minute"
28
30
 
29
31
  Returns
30
32
  -------
@@ -32,14 +34,14 @@ def get_last_full_day_from_db(config : ConfigManager) -> datetime:
32
34
  end of last full day populated in database or default past time if no data found
33
35
  """
34
36
  # config_dict = get_login_info(["minute"], config)
35
- table_config_dict = config.get_db_table_info(["minute"])
37
+ table_config_dict = config.get_db_table_info([table_identifier])
36
38
  # db_connection, db_cursor = connect_db(config_info=config_dict['database'])
37
39
  db_connection, db_cursor = config.connect_db()
38
40
  return_time = datetime(year=2000, month=1, day=9, hour=23, minute=59, second=0).astimezone(timezone('US/Pacific')) # arbitrary default time
39
41
 
40
42
  try:
41
43
  db_cursor.execute(
42
- f"select * from {table_config_dict['minute']['table_name']} order by time_pt DESC LIMIT 1")
44
+ f"select * from {table_config_dict[table_identifier]['table_name']} order by time_pt DESC LIMIT 1")
43
45
 
44
46
  last_row_data = pd.DataFrame(db_cursor.fetchall())
45
47
  if len(last_row_data.index) > 0:
@@ -98,18 +100,20 @@ def get_db_row_from_time(time: datetime, config : ConfigManager) -> pd.DataFrame
98
100
 
99
101
  return row_data
100
102
 
101
- def extract_new(startTime: datetime, filenames: List[str], decihex = False, timeZone: str = None, endTime: datetime = None, dateStringStartIdx : int = -17) -> List[str]:
103
+ def extract_new(startTime: datetime, filenames: List[str], decihex = False, timeZone: str = None, endTime: datetime = None, dateStringStartIdx : int = -17,
104
+ dateStringEndIdx : int = -3, dateFormat : str = "%Y%m%d%H%M%S", epochFormat : bool = False) -> List[str]:
102
105
  """
103
106
  Function filters the filenames to only those equal to or newer than the date specified startTime.
104
107
  If filenames are in deciheximal, The function can still handel it. Note that for some projects,
105
108
  files are dropped at irregular intervals so data cannot be filtered by exact date.
106
109
 
107
- Currently, this function expects file names to be in one of two formats:
110
+ Currently, this function expects file names to be in one of three formats:
108
111
 
109
- 1. normal (set decihex = False) format assumes file names are in format such that characters [-17,-3] in the file names string
110
- are the files date in the form "%Y%m%d%H%M%S"
112
+ 1. default (set decihex = False) format assumes file names are in format such that characters [-17,-3] in the file names string
113
+ are the files date in the form "%Y%m%d%H%M%S"
111
114
  2. deciheximal (set decihex = True) format assumes file names are in format such there is a deciheximal value between a '.' and '_' character in each filename string
112
115
  that has a deciheximal value equal to the number of seconds since January 1, 1970 to represent the timestamp of the data in the file.
116
+ 3. custom format is the same as default format but uses a custom date format with the dateFormat parameter and expects the date to be characters [dateStringStartIdx,dateStringEndIdx]
113
117
 
114
118
  Parameters
115
119
  ----------
@@ -125,7 +129,9 @@ def extract_new(startTime: datetime, filenames: List[str], decihex = False, time
125
129
  time stamp by the pandas tz_localize() function https://pandas.pydata.org/docs/reference/api/pandas.Series.tz_localize.html
126
130
  defaults to None
127
131
  dateStringStartIdx: int
128
- The character index in each file where the date in format "%Y%m%d%H%M%S" starts. Default is -17 (meaning 17 characters from the end of the filename string)
132
+ The character index in each file where the date in format starts. Default is -17 (meaning 17 characters from the end of the filename string)
133
+ dateStringEndIdx: int
134
+ The character index in each file where the date in format ends. Default is -3 (meaning 3 characters from the end of the filename string)
129
135
 
130
136
  Returns
131
137
  -------
@@ -145,8 +151,11 @@ def extract_new(startTime: datetime, filenames: List[str], decihex = False, time
145
151
 
146
152
 
147
153
  else:
148
- startTime_int = int(startTime.strftime("%Y%m%d%H%M%S"))
149
- return_list = list(filter(lambda filename: int(filename[dateStringStartIdx:dateStringStartIdx+14]) >= startTime_int and (endTime is None or int(filename[dateStringStartIdx:dateStringStartIdx+14]) < int(endTime.strftime("%Y%m%d%H%M%S"))), filenames))
154
+ if epochFormat:
155
+ startTime_int = int(startTime.timestamp())
156
+ else:
157
+ startTime_int = int(startTime.strftime(dateFormat))
158
+ return_list = list(filter(lambda filename: int(filename[dateStringStartIdx:dateStringEndIdx]) >= startTime_int and (endTime is None or int(filename[dateStringStartIdx:dateStringStartIdx+14]) < int(endTime.strftime("%Y%m%d%H%M%S"))), filenames))
150
159
  return return_list
151
160
 
152
161
  def extract_files(extension: str, config: ConfigManager, data_sub_dir : str = "", file_prefix : str = "") -> List[str]:
@@ -289,7 +289,7 @@ def load_event_table(config : ConfigManager, event_df: pd.DataFrame, site_name :
289
289
  site_name = config.get_site_name()
290
290
  column_names = f"start_time_pt,site_name"
291
291
  column_types = ["datetime","varchar(25)","datetime",
292
- "ENUM('HW_OUTAGE', 'HW_LOSS','PIPELINE_STATUS', 'MISC_EVENT', 'PIPELINE_UPLOAD', 'DATA_LOSS', 'DATA_LOSS_COP', 'SITE_VISIT', 'COMMISIONING', 'SYSTEM_MAINTENENCE', 'POWER_OUTAGE', 'EQUIPMENT_MALFUNCTION','PARTIAL_OCCUPANCY','INSTALLATION_ERROR')",
292
+ "ENUM('HW_OUTAGE', 'HW_LOSS','PIPELINE_STATUS', 'MISC_EVENT', 'PIPELINE_UPLOAD', 'DATA_LOSS', 'DATA_LOSS_COP', 'SITE_VISIT', 'COMMISIONING', 'SYSTEM_MAINTENENCE', 'POWER_OUTAGE', 'EQUIPMENT_MALFUNCTION','PARTIAL_OCCUPANCY','INSTALLATION_ERROR','SETPOINT_ADJUSTMENT')",
293
293
  "varchar(200)"]
294
294
  column_list = ['end_time_pt','event_type', 'event_detail']
295
295
  if not set(column_list).issubset(event_df.columns):
@@ -346,7 +346,7 @@ def nullify_erroneous(original_df: pd.DataFrame, config : ConfigManager) -> pd.D
346
346
 
347
347
  return df
348
348
 
349
- def heat_output_calc(df: pd.DataFrame, flow_var : str, hot_temp : str, cold_temp : str, heat_out_col_name : str, return_as_kw : bool = True):
349
+ def heat_output_calc(df: pd.DataFrame, flow_var : str, hot_temp : str, cold_temp : str, heat_out_col_name : str, return_as_kw : bool = True) -> pd.DataFrame:
350
350
  """
351
351
  Function will take a flow varriable and two temperature inputs to calculate heat output
352
352
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecopipeline
3
- Version: 0.4.15
3
+ Version: 0.4.17
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