openenergyid 0.1.18__py2.py3-none-any.whl → 0.1.19__py2.py3-none-any.whl
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.
Potentially problematic release.
This version of openenergyid might be problematic. Click here for more details.
- openenergyid/__init__.py +1 -1
- openenergyid/dyntar/main.py +75 -113
- {openenergyid-0.1.18.dist-info → openenergyid-0.1.19.dist-info}/METADATA +1 -1
- {openenergyid-0.1.18.dist-info → openenergyid-0.1.19.dist-info}/RECORD +6 -6
- {openenergyid-0.1.18.dist-info → openenergyid-0.1.19.dist-info}/WHEEL +0 -0
- {openenergyid-0.1.18.dist-info → openenergyid-0.1.19.dist-info}/licenses/LICENSE +0 -0
openenergyid/__init__.py
CHANGED
openenergyid/dyntar/main.py
CHANGED
|
@@ -32,15 +32,12 @@ from .const import (
|
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def weigh_by_monthly_profile(
|
|
35
|
+
def weigh_by_monthly_profile(df: pd.DataFrame, series_name, profile_name) -> pd.Series:
|
|
36
36
|
"""Weigh a time series by a monthly profile."""
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
frame["weighted"] = frame["series"].sum() * (frame["profile"] / frame["profile"].sum())
|
|
42
|
-
results.append(frame)
|
|
43
|
-
return pd.concat(results)["weighted"]
|
|
37
|
+
grouped = df.groupby(pd.Grouper(freq="MS"))
|
|
38
|
+
return grouped[series_name].transform("sum") * grouped[profile_name].transform(
|
|
39
|
+
lambda x: x / x.sum()
|
|
40
|
+
)
|
|
44
41
|
|
|
45
42
|
|
|
46
43
|
def extend_dataframe_with_smr2(df: pd.DataFrame, inplace: bool = False) -> pd.DataFrame | None:
|
|
@@ -50,12 +47,8 @@ def extend_dataframe_with_smr2(df: pd.DataFrame, inplace: bool = False) -> pd.Da
|
|
|
50
47
|
else:
|
|
51
48
|
result_df = df
|
|
52
49
|
|
|
53
|
-
result_df[ELECTRICITY_DELIVERED_SMR2] = weigh_by_monthly_profile(
|
|
54
|
-
|
|
55
|
-
)
|
|
56
|
-
result_df[ELECTRICITY_EXPORTED_SMR2] = weigh_by_monthly_profile(
|
|
57
|
-
df[ELECTRICITY_EXPORTED], df[SPP]
|
|
58
|
-
)
|
|
50
|
+
result_df[ELECTRICITY_DELIVERED_SMR2] = weigh_by_monthly_profile(df, ELECTRICITY_DELIVERED, RLP)
|
|
51
|
+
result_df[ELECTRICITY_EXPORTED_SMR2] = weigh_by_monthly_profile(df, ELECTRICITY_EXPORTED, SPP)
|
|
59
52
|
|
|
60
53
|
result_df.rename(
|
|
61
54
|
columns={
|
|
@@ -81,14 +74,14 @@ def extend_dataframe_with_costs(df: pd.DataFrame, inplace: bool = False) -> pd.D
|
|
|
81
74
|
df[ELECTRICITY_DELIVERED_SMR2] * df[PRICE_ELECTRICITY_DELIVERED]
|
|
82
75
|
)
|
|
83
76
|
result_df[COST_ELECTRICITY_EXPORTED_SMR2] = (
|
|
84
|
-
df[ELECTRICITY_EXPORTED_SMR2] * df[PRICE_ELECTRICITY_EXPORTED]
|
|
77
|
+
df[ELECTRICITY_EXPORTED_SMR2] * df[PRICE_ELECTRICITY_EXPORTED] * -1
|
|
85
78
|
)
|
|
86
79
|
|
|
87
80
|
result_df[COST_ELECTRICITY_DELIVERED_SMR3] = (
|
|
88
81
|
df[ELECTRICITY_DELIVERED_SMR3] * df[PRICE_ELECTRICITY_DELIVERED]
|
|
89
82
|
)
|
|
90
83
|
result_df[COST_ELECTRICITY_EXPORTED_SMR3] = (
|
|
91
|
-
df[ELECTRICITY_EXPORTED_SMR3] * df[PRICE_ELECTRICITY_EXPORTED]
|
|
84
|
+
df[ELECTRICITY_EXPORTED_SMR3] * df[PRICE_ELECTRICITY_EXPORTED] * -1
|
|
92
85
|
)
|
|
93
86
|
|
|
94
87
|
if not inplace:
|
|
@@ -161,6 +154,45 @@ def extend_dataframe_with_heatmap(df: pd.DataFrame, inplace: bool = False) -> pd
|
|
|
161
154
|
return None
|
|
162
155
|
|
|
163
156
|
|
|
157
|
+
def map_delivery_description(
|
|
158
|
+
price_delivered, price_rlp, electricity_delivered_smr3, electricity_delivered_smr2
|
|
159
|
+
):
|
|
160
|
+
"""Map the delivery description."""
|
|
161
|
+
if price_delivered > price_rlp and electricity_delivered_smr3 > electricity_delivered_smr2:
|
|
162
|
+
return 1
|
|
163
|
+
if price_delivered > price_rlp and electricity_delivered_smr3 < electricity_delivered_smr2:
|
|
164
|
+
return 2
|
|
165
|
+
if price_delivered < price_rlp and electricity_delivered_smr3 > electricity_delivered_smr2:
|
|
166
|
+
return 3
|
|
167
|
+
if price_delivered < price_rlp and electricity_delivered_smr3 < electricity_delivered_smr2:
|
|
168
|
+
return 4
|
|
169
|
+
return 0
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def map_export_description(
|
|
173
|
+
price_exported, price_spp, electricity_exported_smr3, electricity_exported_smr2
|
|
174
|
+
):
|
|
175
|
+
"""Map the export description."""
|
|
176
|
+
if price_exported > price_spp and electricity_exported_smr3 > electricity_exported_smr2:
|
|
177
|
+
return 5
|
|
178
|
+
if price_exported > price_spp and electricity_exported_smr3 < electricity_exported_smr2:
|
|
179
|
+
return 6
|
|
180
|
+
if price_exported < price_spp and electricity_exported_smr3 > electricity_exported_smr2:
|
|
181
|
+
return 7
|
|
182
|
+
if price_exported < price_spp and electricity_exported_smr3 < electricity_exported_smr2:
|
|
183
|
+
return 8
|
|
184
|
+
return 0
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def map_total_description(
|
|
188
|
+
abs_heatmap_delivered, abs_heatmap_exported, delivered_description, exported_description
|
|
189
|
+
):
|
|
190
|
+
"""Map the total description."""
|
|
191
|
+
if abs_heatmap_delivered > abs_heatmap_exported:
|
|
192
|
+
return delivered_description
|
|
193
|
+
return exported_description
|
|
194
|
+
|
|
195
|
+
|
|
164
196
|
def extend_dataframe_with_heatmap_description(
|
|
165
197
|
df: pd.DataFrame, inplace: bool = False
|
|
166
198
|
) -> pd.DataFrame | None:
|
|
@@ -168,104 +200,34 @@ def extend_dataframe_with_heatmap_description(
|
|
|
168
200
|
if not inplace:
|
|
169
201
|
df = df.copy()
|
|
170
202
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
else x[HEATMAP_DELIVERED_DESCRIPTION],
|
|
199
|
-
axis=1,
|
|
200
|
-
)
|
|
201
|
-
# When the energy delta is negative, and the price delta is negative, we put a description of 4 (low consumption, low price)
|
|
202
|
-
df[HEATMAP_DELIVERED_DESCRIPTION] = df.apply(
|
|
203
|
-
lambda x: 4
|
|
204
|
-
if x[PRICE_ELECTRICITY_DELIVERED] < x[RLP_WEIGHTED_PRICE_DELIVERED]
|
|
205
|
-
and x[ELECTRICITY_DELIVERED_SMR3] < x[ELECTRICITY_DELIVERED_SMR2]
|
|
206
|
-
else x[HEATMAP_DELIVERED_DESCRIPTION],
|
|
207
|
-
axis=1,
|
|
208
|
-
)
|
|
209
|
-
# All other cases are put as 0
|
|
210
|
-
df[HEATMAP_DELIVERED_DESCRIPTION] = df[HEATMAP_DELIVERED_DESCRIPTION].replace(np.nan, 0)
|
|
211
|
-
|
|
212
|
-
# Exported
|
|
213
|
-
|
|
214
|
-
# Where Heatmap is 0, we put a desription of 0 (No impact)
|
|
215
|
-
df[HEATMAP_EXPORTED_DESCRIPTION] = df[HEATMAP_EXPORTED].apply(
|
|
216
|
-
lambda x: 0 if x == 0 else float("NaN")
|
|
217
|
-
)
|
|
218
|
-
# When the energy delta is positive, and the price delta is positive, we put a description of 5 (high injection, high price)
|
|
219
|
-
df[HEATMAP_EXPORTED_DESCRIPTION] = df.apply(
|
|
220
|
-
lambda x: 5
|
|
221
|
-
if x[PRICE_ELECTRICITY_EXPORTED] > x[SPP_WEIGHTED_PRICE_EXPORTED]
|
|
222
|
-
and x[ELECTRICITY_EXPORTED_SMR3] > x[ELECTRICITY_EXPORTED_SMR2]
|
|
223
|
-
else x[HEATMAP_EXPORTED_DESCRIPTION],
|
|
224
|
-
axis=1,
|
|
225
|
-
)
|
|
226
|
-
# When the energy delta is negative, and the price delta is positive, we put a description of 6 (low injection, high price)
|
|
227
|
-
df[HEATMAP_EXPORTED_DESCRIPTION] = df.apply(
|
|
228
|
-
lambda x: 6
|
|
229
|
-
if x[PRICE_ELECTRICITY_EXPORTED] > x[SPP_WEIGHTED_PRICE_EXPORTED]
|
|
230
|
-
and x[ELECTRICITY_EXPORTED_SMR3] < x[ELECTRICITY_EXPORTED_SMR2]
|
|
231
|
-
else x[HEATMAP_EXPORTED_DESCRIPTION],
|
|
232
|
-
axis=1,
|
|
233
|
-
)
|
|
234
|
-
# When the energy delta is positive, and the price delta is negative, we put a description of 7 (high injection, low price)
|
|
235
|
-
df[HEATMAP_EXPORTED_DESCRIPTION] = df.apply(
|
|
236
|
-
lambda x: 7
|
|
237
|
-
if x[PRICE_ELECTRICITY_EXPORTED] < x[SPP_WEIGHTED_PRICE_EXPORTED]
|
|
238
|
-
and x[ELECTRICITY_EXPORTED_SMR3] > x[ELECTRICITY_EXPORTED_SMR2]
|
|
239
|
-
else x[HEATMAP_EXPORTED_DESCRIPTION],
|
|
240
|
-
axis=1,
|
|
241
|
-
)
|
|
242
|
-
# When the energy delta is negative, and the price delta is negative, we put a description of 8 (low injection, low price)
|
|
243
|
-
df[HEATMAP_EXPORTED_DESCRIPTION] = df.apply(
|
|
244
|
-
lambda x: 8
|
|
245
|
-
if x[PRICE_ELECTRICITY_EXPORTED] < x[SPP_WEIGHTED_PRICE_EXPORTED]
|
|
246
|
-
and x[ELECTRICITY_EXPORTED_SMR3] < x[ELECTRICITY_EXPORTED_SMR2]
|
|
247
|
-
else x[HEATMAP_EXPORTED_DESCRIPTION],
|
|
248
|
-
axis=1,
|
|
249
|
-
)
|
|
250
|
-
# All other cases are put as 0
|
|
251
|
-
df[HEATMAP_EXPORTED_DESCRIPTION] = df[HEATMAP_EXPORTED_DESCRIPTION].replace(np.nan, 0)
|
|
252
|
-
|
|
253
|
-
# Total
|
|
254
|
-
|
|
255
|
-
# We see which of the individual heatmaps has the highest absolute value
|
|
256
|
-
# We put the description of the highest absolute value
|
|
257
|
-
df[HEATMAP_TOTAL_DESCRIPTION] = df.apply(
|
|
258
|
-
lambda x: x[HEATMAP_DELIVERED_DESCRIPTION]
|
|
259
|
-
if abs(x[HEATMAP_DELIVERED]) > abs(x[HEATMAP_EXPORTED])
|
|
260
|
-
else x[HEATMAP_EXPORTED_DESCRIPTION],
|
|
261
|
-
axis=1,
|
|
262
|
-
)
|
|
263
|
-
# Where Heatmap is 0, we put a desription of 0 (No impact)
|
|
264
|
-
df[HEATMAP_TOTAL_DESCRIPTION] = df.apply(
|
|
265
|
-
lambda x: 0 if x[HEATMAP_TOTAL] == 0 else x[HEATMAP_TOTAL_DESCRIPTION], axis=1
|
|
203
|
+
df[HEATMAP_DELIVERED_DESCRIPTION] = list(
|
|
204
|
+
map(
|
|
205
|
+
map_delivery_description,
|
|
206
|
+
df[PRICE_ELECTRICITY_DELIVERED],
|
|
207
|
+
df[RLP_WEIGHTED_PRICE_DELIVERED],
|
|
208
|
+
df[ELECTRICITY_DELIVERED_SMR3],
|
|
209
|
+
df[ELECTRICITY_DELIVERED_SMR2],
|
|
210
|
+
)
|
|
211
|
+
)
|
|
212
|
+
df[HEATMAP_EXPORTED_DESCRIPTION] = list(
|
|
213
|
+
map(
|
|
214
|
+
map_export_description,
|
|
215
|
+
df[PRICE_ELECTRICITY_EXPORTED],
|
|
216
|
+
df[SPP_WEIGHTED_PRICE_EXPORTED],
|
|
217
|
+
df[ELECTRICITY_EXPORTED_SMR3],
|
|
218
|
+
df[ELECTRICITY_EXPORTED_SMR2],
|
|
219
|
+
)
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
df[HEATMAP_TOTAL_DESCRIPTION] = list(
|
|
223
|
+
map(
|
|
224
|
+
map_total_description,
|
|
225
|
+
df[HEATMAP_DELIVERED].abs(),
|
|
226
|
+
df[HEATMAP_EXPORTED].abs(),
|
|
227
|
+
df[HEATMAP_DELIVERED_DESCRIPTION],
|
|
228
|
+
df[HEATMAP_EXPORTED_DESCRIPTION],
|
|
229
|
+
)
|
|
266
230
|
)
|
|
267
|
-
# All other cases are put as 0
|
|
268
|
-
df[HEATMAP_TOTAL_DESCRIPTION] = df[HEATMAP_TOTAL_DESCRIPTION].replace(np.nan, 0)
|
|
269
231
|
|
|
270
232
|
if not inplace:
|
|
271
233
|
return df
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
openenergyid/__init__.py,sha256=
|
|
1
|
+
openenergyid/__init__.py,sha256=Rw7W-OZewpvJwVPQ0xjjsiXdeT-QpbmEmBER7arAMYo,193
|
|
2
2
|
openenergyid/const.py,sha256=D-xUnUyVuLmphClkePgxpFP6z0RDhw_6m7rX0BHBgrw,823
|
|
3
3
|
openenergyid/enums.py,sha256=jdw4CB1gkisx0re_SesrTEyh_T-UxYp6uieE7iYlHdA,357
|
|
4
4
|
openenergyid/models.py,sha256=CO6VdthCOQ9hNXqVSan_4IOBpiQvOix-ea3U6TR7Vgc,4343
|
|
@@ -7,7 +7,7 @@ openenergyid/capacity/main.py,sha256=G6_EtXs1k_W-fxS33pFrCNKajuH81skdI32zp5RX9bI
|
|
|
7
7
|
openenergyid/capacity/models.py,sha256=qi0IFyF_QOVleSzN8g0U2Fzqcc9ZDfNKt8oteFLY6Q0,832
|
|
8
8
|
openenergyid/dyntar/__init__.py,sha256=iQXQXrEQOiVNeeF6LRmUf3oOhKlGjMNF7o4T04IWTGA,371
|
|
9
9
|
openenergyid/dyntar/const.py,sha256=17qL0-S0SImsqrDEDrGS2GLyJYcJRw6GmmcTiML7tR0,956
|
|
10
|
-
openenergyid/dyntar/main.py,sha256=
|
|
10
|
+
openenergyid/dyntar/main.py,sha256=yRPamC5dHwpiDj07RM2iVKk3gZk8a81zKSjOsjewACo,8247
|
|
11
11
|
openenergyid/dyntar/models.py,sha256=FZq7HI1F-3nVeHwPkuB38-8u32JzdvsZaCzrhirFD2g,2094
|
|
12
12
|
openenergyid/energysharing/__init__.py,sha256=A4JfrUYf-hBCzhUm0qL1GGlNMvpO8OwXJo80dJxFIvw,274
|
|
13
13
|
openenergyid/energysharing/const.py,sha256=X2zEPtTlsmZ66w6RmLS_h8NmdzObAEi5N6-0yrLN5V4,219
|
|
@@ -19,7 +19,7 @@ openenergyid/mvlr/helpers.py,sha256=Uzbfrj3IpH26wA206KOl0hNucKE-n9guJNC_EROBVKA,
|
|
|
19
19
|
openenergyid/mvlr/main.py,sha256=cn7jZ98cHn2eh-0zG9q8Pad0Ft_FuI-u3a-eeHeF8jA,1304
|
|
20
20
|
openenergyid/mvlr/models.py,sha256=XvkViOLlYqi0ffgF3AD4Jvk3yL05gsoKdKgBAsGJ7L4,8581
|
|
21
21
|
openenergyid/mvlr/mvlr.py,sha256=F7WvWnZQtqUmK1vsguemsn9n8pDDk3tQ1weOlv-bo0c,18626
|
|
22
|
-
openenergyid-0.1.
|
|
23
|
-
openenergyid-0.1.
|
|
24
|
-
openenergyid-0.1.
|
|
25
|
-
openenergyid-0.1.
|
|
22
|
+
openenergyid-0.1.19.dist-info/METADATA,sha256=q8cD0GQr7JDOoStIRDI8r5z-9gvgt4dkuh98vBDWJBw,2477
|
|
23
|
+
openenergyid-0.1.19.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
|
|
24
|
+
openenergyid-0.1.19.dist-info/licenses/LICENSE,sha256=NgRdcNHwyXVCXZ8sJwoTp0DCowThJ9LWWl4xhbV1IUY,1074
|
|
25
|
+
openenergyid-0.1.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|