ecopipeline 0.4.16__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.
- {ecopipeline-0.4.16/src/ecopipeline.egg-info → ecopipeline-0.4.17}/PKG-INFO +1 -1
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/setup.cfg +1 -1
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/extract/extract.py +19 -10
- {ecopipeline-0.4.16 → ecopipeline-0.4.17/src/ecopipeline.egg-info}/PKG-INFO +1 -1
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/LICENSE +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/README.md +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/pyproject.toml +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/setup.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/__init__.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/extract/__init__.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/load/__init__.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/load/load.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/transform/__init__.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/transform/bayview.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/transform/lbnl.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/transform/transform.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/utils/ConfigManager.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/utils/__init__.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline/utils/unit_convert.py +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline.egg-info/SOURCES.txt +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline.egg-info/requires.txt +0 -0
- {ecopipeline-0.4.16 → ecopipeline-0.4.17}/src/ecopipeline.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = ecopipeline
|
|
3
|
-
version = 0.4.
|
|
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([
|
|
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[
|
|
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
|
|
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
|
|
110
|
+
Currently, this function expects file names to be in one of three formats:
|
|
108
111
|
|
|
109
|
-
1.
|
|
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
|
|
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
|
-
|
|
149
|
-
|
|
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]:
|
|
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
|
|
File without changes
|
|
File without changes
|