domainiac 0.1.3__tar.gz → 0.1.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: domainiac
3
- Version: 0.1.3
3
+ Version: 0.1.4
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: gridop-enigma@energinet.dk
@@ -6,42 +6,55 @@ from typeguard import typechecked
6
6
  class ResourceManager:
7
7
  """
8
8
  Manager which simplifies the process of handling resource schedules.
9
+ Scheduled resources are delivered in a 5 min resolution. If a higher
10
+ resolution is chosen,
11
+ the result will be the most conservative value in the time interval,
12
+ e.i. max of minimum capacity and min of maximum capacity.
13
+ If no resolution is given, the default is 5 min.
14
+ If resolution is less than 5 min, the resulting time series will
15
+ default to 5 min resolution.
9
16
  """
10
17
 
11
18
  def __init__(
12
19
  self,
13
20
  db: pdz.Database,
14
21
  time_interval: pdz.TimeInterval,
22
+ resolution: pd.Timedelta = pd.Timedelta("PT5M"),
15
23
  ) -> None:
16
24
  self.db = db
17
25
  self.time_interval = time_interval
26
+ self.resolution = resolution
18
27
 
19
28
  @typechecked
20
- def get_resource_schedules(
21
- self,
22
- resource_gsrns: list,
23
- ) -> pd.DataFrame:
29
+ def get_resource_schedules(self, resource_gsrns: list) -> pd.DataFrame:
24
30
  """Gets resource schedules for a given list of resource gsrns."""
25
31
  df_resource_schedules = self.db.query(
26
- table_name="resourceSchedule",
32
+ table_name="scheduleResourcePowerPlan",
27
33
  time_interval=self.time_interval,
28
34
  filters={"resource_gsrn": resource_gsrns},
29
35
  )
30
- df_resource_schedules = df_resource_schedules.filter(
31
- [
32
- "market_participant",
33
- "created_time_utc",
34
- "price_area",
35
- "resource_gsrn",
36
- "main_fuel_type",
37
- "is_sum_plan",
38
- "time_utc",
39
- "schedule_power_MW",
40
- "schedule_capacity_min_MW",
41
- "schedule_capacity_max_MW",
42
- ]
36
+
37
+ df_resource_resampled = (
38
+ pdz.group(
39
+ df_resource_schedules,
40
+ by=[
41
+ "market_participant",
42
+ "created_time_utc",
43
+ "price_area",
44
+ "resource_gsrn",
45
+ ],
46
+ )
47
+ .resample(on="time_utc", resolution=self.resolution)
48
+ .agg(
49
+ {
50
+ "schedule_power_MW": "mean",
51
+ "schedule_capacity_min_MW": "max",
52
+ "schedule_capacity_max_MW": "min",
53
+ }
54
+ )
55
+ .dropna()
43
56
  )
44
- return df_resource_schedules
57
+ return df_resource_resampled
45
58
 
46
59
  @typechecked
47
60
  def get_latest_resource_plan(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "domainiac"
3
- version = "0.1.3"
3
+ version = "0.1.4"
4
4
  description = "Package for working with Energinet data, but with specialized functions used for Enigma."
5
5
  authors = ["Team Enigma <gridop-enigma@energinet.dk>"]
6
6
  packages = [