ecopipeline 0.4.17__tar.gz → 0.4.18__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.17/src/ecopipeline.egg-info → ecopipeline-0.4.18}/PKG-INFO +1 -1
  2. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/setup.cfg +1 -1
  3. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/extract/extract.py +3 -3
  4. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/transform/__init__.py +2 -2
  5. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/transform/transform.py +50 -1
  6. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/utils/unit_convert.py +4 -0
  7. {ecopipeline-0.4.17 → ecopipeline-0.4.18/src/ecopipeline.egg-info}/PKG-INFO +1 -1
  8. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/LICENSE +0 -0
  9. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/README.md +0 -0
  10. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/pyproject.toml +0 -0
  11. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/setup.py +0 -0
  12. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/__init__.py +0 -0
  13. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/extract/__init__.py +0 -0
  14. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/load/__init__.py +0 -0
  15. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/load/load.py +0 -0
  16. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/transform/bayview.py +0 -0
  17. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/transform/lbnl.py +0 -0
  18. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/utils/ConfigManager.py +0 -0
  19. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline/utils/__init__.py +0 -0
  20. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline.egg-info/SOURCES.txt +0 -0
  21. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline.egg-info/dependency_links.txt +0 -0
  22. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/src/ecopipeline.egg-info/requires.txt +0 -0
  23. {ecopipeline-0.4.17 → ecopipeline-0.4.18}/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.17
3
+ Version: 0.4.18
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.17
3
+ version = 0.4.18
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
@@ -800,8 +800,8 @@ def get_noaa_data(station_names: List[str], config : ConfigManager, station_ids
800
800
  noaa_dfs = _convert_to_df(station_ids, noaa_filenames, weather_directory)
801
801
  formatted_dfs = _format_df(station_ids, noaa_dfs)
802
802
  except:
803
- # temporary solution for NOAA ftp not including 2024
804
- noaa_df = pd.DataFrame(index=pd.date_range(start='2024-01-01', periods=10, freq='H'))
803
+ # temporary solution for NOAA ftp not including 2025
804
+ noaa_df = pd.DataFrame(index=pd.date_range(start='2025-01-01', periods=10, freq='H'))
805
805
  noaa_df['conditions'] = None
806
806
  noaa_df['airTemp_F'] = None
807
807
  noaa_df['dewPoint_F'] = None
@@ -940,7 +940,7 @@ def _download_noaa_data(stations: dict, weather_directory : str) -> List[str]:
940
940
  print("FTP ERROR")
941
941
  return
942
942
  # Download files for each station from 2010 till present year
943
- for year in range(2010, year_end + 1):
943
+ for year in range(2010, year_end):
944
944
  # Set FTP credentials and connect
945
945
  wd = f"/pub/data/noaa/isd-lite/{year}/"
946
946
  ftp_server.cwd(wd)
@@ -1,4 +1,4 @@
1
- from .transform import rename_sensors, avg_duplicate_times, remove_outliers, ffill_missing, nullify_erroneous, sensor_adjustment, round_time, aggregate_df, join_to_hourly, concat_last_row, join_to_daily, cop_method_1, cop_method_2, create_summary_tables, remove_partial_days,convert_c_to_f,convert_l_to_g, convert_on_off_col_to_bool, flag_dhw_outage,generate_event_log_df,convert_time_zone, shift_accumulative_columns,heat_output_calc
1
+ from .transform import rename_sensors, avg_duplicate_times, remove_outliers, ffill_missing, nullify_erroneous, sensor_adjustment, round_time, aggregate_df, join_to_hourly, concat_last_row, join_to_daily, cop_method_1, cop_method_2, create_summary_tables, remove_partial_days,convert_c_to_f,convert_l_to_g, convert_on_off_col_to_bool, flag_dhw_outage,generate_event_log_df,convert_time_zone, shift_accumulative_columns,heat_output_calc, add_relative_humidity
2
2
  from .lbnl import nclarity_filter_new, site_specific, condensate_calculations, gas_valve_diff, gather_outdoor_conditions, aqsuite_prep_time, nclarity_csv_to_df, _add_date, add_local_time, aqsuite_filter_new, get_refrig_charge, elev_correction, change_ID_to_HVAC, get_hvac_state, get_cop_values, get_cfm_values, replace_humidity, create_fan_curves, lbnl_temperature_conversions, lbnl_pressure_conversions, lbnl_sat_calculations, get_site_cfm_info, get_site_info, merge_indexlike_rows
3
3
  from .bayview import calculate_cop_values, aggregate_values, get_energy_by_min, verify_power_energy, get_temp_zones120, get_storage_gals120
4
4
  __all__ = ["rename_sensors", "avg_duplicate_times", "remove_outliers", "ffill_missing", "nullify_erroneous", "sensor_adjustment", "round_time", "aggregate_df", "join_to_hourly", "concat_last_row", "join_to_daily",
@@ -6,4 +6,4 @@ __all__ = ["rename_sensors", "avg_duplicate_times", "remove_outliers", "ffill_mi
6
6
  "nclarity_csv_to_df", "_add_date", "add_local_time", "aqsuite_filter_new", "get_refrig_charge", "elev_correction", "change_ID_to_HVAC", "get_hvac_state", "get_cop_values", "get_cfm_values", "replace_humidity",
7
7
  "create_fan_curves", "lbnl_temperature_conversions", "lbnl_pressure_conversions", "lbnl_sat_calculations", "get_site_cfm_info", "get_site_info", "merge_indexlike_rows", "calculate_cop_values", "aggregate_values",
8
8
  "get_energy_by_min", "verify_power_energy", "get_temp_zones120", "get_storage_gals120","convert_c_to_f","convert_l_to_g", "convert_on_off_col_to_bool", "flag_dhw_outage","generate_event_log_df","convert_time_zone",
9
- "shift_accumulative_columns","heat_output_calc"]
9
+ "shift_accumulative_columns","heat_output_calc", "add_relative_humidity"]
@@ -3,7 +3,7 @@ import numpy as np
3
3
  import datetime as dt
4
4
  import csv
5
5
  import os
6
- from ecopipeline.utils.unit_convert import temp_c_to_f_non_noaa, volume_l_to_g, power_btuhr_to_kw
6
+ from ecopipeline.utils.unit_convert import temp_c_to_f_non_noaa, volume_l_to_g, power_btuhr_to_kw, temp_f_to_c
7
7
  from ecopipeline import ConfigManager
8
8
 
9
9
  pd.set_option('display.max_columns', None)
@@ -425,6 +425,55 @@ def sensor_adjustment(df: pd.DataFrame, config : ConfigManager) -> pd.DataFrame:
425
425
 
426
426
  return df
427
427
 
428
+ def add_relative_humidity(df : pd.DataFrame, temp_col : str ='airTemp_F', dew_point_col : str ='dewPoint_F', degree_f : bool = True):
429
+ """
430
+ Add a column for relative humidity to the DataFrame.
431
+
432
+ Parameters
433
+ ----------
434
+ df : pd.DataFrame
435
+ DataFrame containing air temperature and dew point temperature.
436
+ temp_col : str
437
+ Column name for air temperature.
438
+ dew_point_col : str
439
+ Column name for dew point temperature.
440
+ degree_f : bool
441
+ True if temperature columns are in °F, false if in °C
442
+
443
+ Returns
444
+ -------
445
+ pd.DataFrame:
446
+ DataFrame with an added column for relative humidity.
447
+ """
448
+ # Define constants
449
+ A = 6.11
450
+ B = 7.5
451
+ C = 237.3
452
+
453
+ if degree_f:
454
+ df[f"{temp_col}_C"] = df[temp_col].apply(temp_f_to_c)
455
+ df[f"{dew_point_col}_C"] = df[dew_point_col].apply(temp_f_to_c)
456
+ temp_col_c = f"{temp_col}_C"
457
+ dew_point_col_c = f"{dew_point_col}_C"
458
+ else:
459
+ temp_col_c = temp_col
460
+ dew_point_col_c = dew_point_col
461
+
462
+ # Calculate saturation vapor pressure (e_s) and actual vapor pressure (e)
463
+ e_s = A * 10 ** ((B * df[temp_col_c]) / (df[temp_col_c] + C))
464
+ e = A * 10 ** ((B * df[dew_point_col_c]) / (df[dew_point_col_c] + C))
465
+
466
+ # Calculate relative humidity
467
+ df['relative_humidity'] = (e / e_s) * 100.0
468
+
469
+ # Handle cases where relative humidity exceeds 100% due to rounding
470
+ df['relative_humidity'] = np.clip(df['relative_humidity'], 0.0, 100.0)
471
+
472
+ if degree_f:
473
+ df.drop(columns=[temp_col_c, dew_point_col_c])
474
+
475
+ return df
476
+
428
477
  def cop_method_1(df: pd.DataFrame, recircLosses, heatout_primary_column : str = 'HeatOut_Primary', total_input_power_column : str = 'PowerIn_Total') -> pd.DataFrame:
429
478
  """
430
479
  Performs COP calculation method 1 (original AWS method).
@@ -14,6 +14,10 @@ def temp_c_to_f_non_noaa(temp_c : float):
14
14
  temp_f = 32 + (temp_c * 1.8)
15
15
  return temp_f
16
16
 
17
+ def temp_f_to_c(temp_f : float):
18
+ temp_c = (temp_f - 32) * 5.0 / 9.0
19
+ return temp_c
20
+
17
21
  def power_btuhr_to_kw(power_btuhr : float):
18
22
  power_kw = power_btuhr / 3412.0
19
23
  return power_kw
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecopipeline
3
- Version: 0.4.17
3
+ Version: 0.4.18
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