domainiac 9.3.0__tar.gz → 9.3.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.
Files changed (24) hide show
  1. {domainiac-9.3.0 → domainiac-9.3.1}/PKG-INFO +2 -2
  2. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/__init__.py +1 -0
  3. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/managers/__init__.py +1 -0
  4. domainiac-9.3.1/domainiac/managers/availability_manager.py +58 -0
  5. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/managers/outage_manager.py +4 -4
  6. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/managers/plant_manager.py +3 -3
  7. {domainiac-9.3.0 → domainiac-9.3.1}/pyproject.toml +2 -2
  8. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/functions/__init__.py +0 -0
  9. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/functions/conversions.py +0 -0
  10. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/functions/interpolation.py +0 -0
  11. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/functions/solar.py +0 -0
  12. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/functions/temperature.py +0 -0
  13. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/functions/typing.py +0 -0
  14. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/functions/wind.py +0 -0
  15. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/managers/masterdata_manager.py +0 -0
  16. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/managers/metering_manager.py +0 -0
  17. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/managers/nwp_manager.py +0 -0
  18. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/managers/resource_manager.py +0 -0
  19. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/managers/unit_manager.py +0 -0
  20. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/modeling/__init__.py +0 -0
  21. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/modeling/nwp.py +0 -0
  22. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/modeling/plant.py +0 -0
  23. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/wrappers/__init__.py +0 -0
  24. {domainiac-9.3.0 → domainiac-9.3.1}/domainiac/wrappers/cache_wrapper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: domainiac
3
- Version: 9.3.0
3
+ Version: 9.3.1
4
4
  Summary: Package for working with Energinet data, but with specialized functions used for Enigma.
5
5
  Author: Team Enigma
6
6
  Author-email: enigma@energinet.dk
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Classifier: Programming Language :: Python :: 3.14
14
- Requires-Dist: datamazing (>=5.1.6)
14
+ Requires-Dist: datamazing (>=6.0.0)
15
15
  Requires-Dist: pandas (>=2.2.0)
16
16
  Requires-Dist: pvlib (>=0.13.1)
17
17
  Requires-Dist: scikit-learn (>=1.3.0)
@@ -1,4 +1,5 @@
1
1
  from .managers import (
2
+ AvailabilityManager,
2
3
  MeteringManager,
3
4
  NWPManager,
4
5
  PlantManager,
@@ -1,3 +1,4 @@
1
+ from .availability_manager import AvailabilityManager
1
2
  from .masterdata_manager import MasterdataManager
2
3
  from .metering_manager import MeteringManager
3
4
  from .nwp_manager import NWPManager
@@ -0,0 +1,58 @@
1
+ import datamazing.pandas as pdz
2
+ import pandas as pd
3
+
4
+ from .outage_manager import OutageManager
5
+
6
+
7
+ class AvailabilityManager:
8
+ """
9
+ Manager which simplifies the process of getting availability data.
10
+ """
11
+
12
+ def __init__(
13
+ self,
14
+ db: pdz.Database,
15
+ time_interval: pdz.TimeInterval,
16
+ resolution: pd.Timedelta,
17
+ ) -> None:
18
+ self.db = db
19
+ self.time_interval = time_interval
20
+ self.resolution = resolution
21
+ self.outage_manager = OutageManager(db, time_interval, resolution)
22
+
23
+ def get_availability(self) -> pd.DataFrame:
24
+ df_availability = self.db.query("scheduleAvailability", self.time_interval)
25
+ df_outage = self.outage_manager.get_plant_outage_time_series()
26
+
27
+ # Rename resource_gsrn to plant_gsrn for consistent merge
28
+ df_availability = df_availability.rename(
29
+ columns={
30
+ "resource_gsrn": "plant_gsrn",
31
+ "schedule_resource_capacity_max_MW": "capacity_max_MW",
32
+ "schedule_resource_capacity_min_MW": "capacity_min_MW",
33
+ }
34
+ )
35
+
36
+ required_columns = [
37
+ "time_utc",
38
+ "plant_gsrn",
39
+ "capacity_max_MW",
40
+ "capacity_min_MW",
41
+ ]
42
+
43
+ # Create an indicator column in outage to mark where outages exist
44
+ df_outage["has_outage"] = True
45
+
46
+ # Merge availability with outage data
47
+ df_available = df_availability.merge(
48
+ df_outage, on=["plant_gsrn", "time_utc"], how="outer"
49
+ )
50
+
51
+ # Where there's an outage, set capacity to zero
52
+ has_outage = df_available["has_outage"].fillna(False)
53
+ df_available.loc[has_outage, "capacity_max_MW"] = 0
54
+ df_available.loc[has_outage, "capacity_min_MW"] = 0
55
+
56
+ # Return only the required columns
57
+ df_available = df_available[required_columns]
58
+ return df_available
@@ -22,7 +22,7 @@ class OutageManager:
22
22
 
23
23
  df_outage = df_outage[~df_outage["is_unapproved"]]
24
24
 
25
- df_outage = df_outage.dropna(subset="plant_gsrn")
25
+ df_outage = df_outage.dropna(subset=["plant_gsrn"])
26
26
 
27
27
  # make placeholder dataframe to explode outage
28
28
  # data to all time points for all plants
@@ -34,12 +34,12 @@ class OutageManager:
34
34
 
35
35
  df_idx = df_times.merge(df_plants, how="cross")
36
36
 
37
- df_outage = pdz.merge(
37
+ df_outage = pdz.merge_point_interval(
38
38
  df_idx,
39
39
  df_outage,
40
40
  on=["plant_gsrn"],
41
- left_time="time_utc",
42
- right_period=("start_time_utc", "end_time_utc"),
41
+ left_point="time_utc",
42
+ right_interval=("start_time_utc", "end_time_utc"),
43
43
  )
44
44
 
45
45
  df_outage = df_outage.filter(
@@ -72,11 +72,11 @@ class PlantManager(MasterdataManager):
72
72
  df_plant = self.get_operational_entities("masterdataPlant")
73
73
  df_plant = df_plant.query(f"masterdata_gsrn == '{gsrn}'")
74
74
 
75
- df_plant = pdz.merge(
75
+ df_plant = pdz.merge_point_interval(
76
76
  df_times,
77
77
  df_plant,
78
- left_time="time_utc",
79
- right_period=("valid_from_date_utc", "valid_to_date_utc"),
78
+ left_point="time_utc",
79
+ right_interval=("valid_from_date_utc", "valid_to_date_utc"),
80
80
  )
81
81
 
82
82
  return df_plant.filter(["time_utc", "installed_power_MW"]).reset_index(
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "domainiac"
3
- version = "9.3.0"
3
+ version = "9.3.1"
4
4
  description = "Package for working with Energinet data, but with specialized functions used for Enigma."
5
5
  authors = [{ name = "Team Enigma", email = "enigma@energinet.dk" }]
6
6
  requires-python = ">=3.10"
@@ -11,7 +11,7 @@ requires-poetry = ">=2.2"
11
11
 
12
12
  [tool.poetry.dependencies]
13
13
  pandas = ">=2.2.0"
14
- datamazing = ">=5.1.6"
14
+ datamazing = ">=6.0.0"
15
15
  typeguard = ">=4.2.1"
16
16
  scikit-learn = ">=1.3.0"
17
17
  scipy = ">=1.15.3"