ecopipeline 1.1.0__tar.gz → 1.1.1__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-1.1.0 → ecopipeline-1.1.1}/MANIFEST.in +1 -0
- {ecopipeline-1.1.0/src/ecopipeline.egg-info → ecopipeline-1.1.1}/PKG-INFO +1 -1
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/setup.cfg +1 -1
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/extract/extract.py +51 -0
- ecopipeline-1.1.1/src/ecopipeline/extract/zip_to_lat_long.csv +41490 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/ConfigManager.py +30 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1/src/ecopipeline.egg-info}/PKG-INFO +1 -1
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline.egg-info/SOURCES.txt +1 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/LICENSE +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/README.md +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/pyproject.toml +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/setup.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/__init__.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/Alarm.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/__init__.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/AbnormalCOP.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/BackupUse.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/BalancingValve.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/BlownFuse.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/Boundary.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/HPWHInlet.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/HPWHOutage.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/HPWHOutlet.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/LSInconsist.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/PowerRatio.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/SOOChange.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/ShortCycle.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/TMSetpoint.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/TempRange.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/alarms/__init__.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/event_tracking/event_tracking.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/extract/__init__.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/load/__init__.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/load/load.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/transform/__init__.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/transform/bayview.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/transform/lbnl.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/transform/transform.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/NOAADataDownloader.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/__init__.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/pkls/__init__.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/pkls/tasseron_resistance_to_temp_3.pkl +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/pkls/tasseron_temp_to_resistance_2.pkl +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/pkls/veris_resistance_to_temp_3.pkl +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/pkls/veris_temp_to_resistance_2.pkl +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline/utils/unit_convert.py +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline.egg-info/requires.txt +0 -0
- {ecopipeline-1.1.0 → ecopipeline-1.1.1}/src/ecopipeline.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = ecopipeline
|
|
3
|
-
version = 1.1.
|
|
3
|
+
version = 1.1.1
|
|
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
|
|
@@ -7,6 +7,7 @@ from datetime import datetime, timedelta
|
|
|
7
7
|
import gzip
|
|
8
8
|
import os
|
|
9
9
|
import json
|
|
10
|
+
import csv
|
|
10
11
|
from ecopipeline.utils.unit_convert import temp_c_to_f, divide_num_by_ten, windspeed_mps_to_knots, precip_cm_to_mm, conditions_index_to_desc
|
|
11
12
|
from ecopipeline import ConfigManager
|
|
12
13
|
import numpy as np
|
|
@@ -1190,6 +1191,7 @@ def get_noaa_data(station_names: List[str], config : ConfigManager, station_ids
|
|
|
1190
1191
|
#TODO swap out for this if empty: https://open-meteo.com/en/docs/historical-weather-api?start_date=2025-12-29&latitude=47.6&longitude=-122.33&temperature_unit=fahrenheit&end_date=2026-01-04
|
|
1191
1192
|
formatted_dfs = {}
|
|
1192
1193
|
weather_directory = config.get_weather_dir_path()
|
|
1194
|
+
noaa_retrieved = False
|
|
1193
1195
|
try:
|
|
1194
1196
|
noaa_dictionary = _get_noaa_dictionary(weather_directory)
|
|
1195
1197
|
if len(station_ids.keys()) == 0:
|
|
@@ -1198,6 +1200,15 @@ def get_noaa_data(station_names: List[str], config : ConfigManager, station_ids
|
|
|
1198
1200
|
noaa_filenames = _download_noaa_data(station_ids, weather_directory)
|
|
1199
1201
|
noaa_dfs = _convert_to_df(station_ids, noaa_filenames, weather_directory)
|
|
1200
1202
|
formatted_dfs = _format_df(station_ids, noaa_dfs)
|
|
1203
|
+
for station_name in station_names:
|
|
1204
|
+
df = formatted_dfs[station_name]
|
|
1205
|
+
if not df.empty:
|
|
1206
|
+
max_idx = df.index.max()
|
|
1207
|
+
if max_idx >= datetime.now() - timedelta(days=7):
|
|
1208
|
+
last_row = df.loc[max_idx]
|
|
1209
|
+
if last_row.notna().any() and not all(v is None for v in last_row):
|
|
1210
|
+
noaa_retrieved = True
|
|
1211
|
+
break
|
|
1201
1212
|
except:
|
|
1202
1213
|
# temporary solution for NOAA ftp not including 2025
|
|
1203
1214
|
noaa_df = pd.DataFrame(index=pd.date_range(start='2025-01-01', periods=10, freq='H'))
|
|
@@ -1207,6 +1218,46 @@ def get_noaa_data(station_names: List[str], config : ConfigManager, station_ids
|
|
|
1207
1218
|
for station_name in station_names:
|
|
1208
1219
|
formatted_dfs[station_name] = noaa_df
|
|
1209
1220
|
print("Unable to collect NOAA data for timeframe")
|
|
1221
|
+
|
|
1222
|
+
if not noaa_retrieved:
|
|
1223
|
+
print("No NOAA data available. Attempting to retrieve data from Open Meteo. Defaulting to last week time frame.")
|
|
1224
|
+
db_connection, db_cursor = config.connect_siteConfig_db()
|
|
1225
|
+
table_config_dict = config.get_db_table_info(["minute"])
|
|
1226
|
+
|
|
1227
|
+
try:
|
|
1228
|
+
db_cursor.execute(
|
|
1229
|
+
f"SELECT zip_code FROM site WHERE site_name = '{table_config_dict['minute']['table_name']}' LIMIT 1;")
|
|
1230
|
+
zip_code_data = pd.DataFrame(db_cursor.fetchall())
|
|
1231
|
+
if len(zip_code_data.index) > 0:
|
|
1232
|
+
zip_code = zip_code_data[0][0]
|
|
1233
|
+
print(f"Zip code for site retrieved: {zip_code}")
|
|
1234
|
+
csv_path = os.path.join(os.path.dirname(__file__), 'zip_to_lat_long.csv')
|
|
1235
|
+
latitude, longitude = None, None
|
|
1236
|
+
with open(csv_path, 'r') as csv_file:
|
|
1237
|
+
reader = csv.DictReader(csv_file)
|
|
1238
|
+
for row in reader:
|
|
1239
|
+
if int(row['zip']) == int(zip_code):
|
|
1240
|
+
latitude = float(row['lattitude'])
|
|
1241
|
+
longitude = float(row['longitude'])
|
|
1242
|
+
break
|
|
1243
|
+
if latitude is not None and longitude is not None:
|
|
1244
|
+
# default to last week of data
|
|
1245
|
+
# TODO use actual time frame and use appropriate time zones
|
|
1246
|
+
end_time = datetime.today()
|
|
1247
|
+
start_time = end_time - timedelta(7)
|
|
1248
|
+
open_meteo_df = get_OAT_open_meteo(latitude, longitude, start_time, end_time)
|
|
1249
|
+
for station_name in station_names:
|
|
1250
|
+
formatted_dfs[station_name] = open_meteo_df
|
|
1251
|
+
else:
|
|
1252
|
+
print(f"Zip code {zip_code} not found in datapipeline package zip code repository.")
|
|
1253
|
+
else:
|
|
1254
|
+
print(f"No available zipcode for {table_config_dict['minute']['table_name']}. Cannot retrieve OAT data")
|
|
1255
|
+
except mysqlerrors.Error:
|
|
1256
|
+
print("Unable to find zip code in database.")
|
|
1257
|
+
|
|
1258
|
+
db_cursor.close()
|
|
1259
|
+
db_connection.close()
|
|
1260
|
+
|
|
1210
1261
|
return formatted_dfs
|
|
1211
1262
|
|
|
1212
1263
|
|