Skip to content

Commit 840434b

Browse files
authored
Merge pull request #74 from cyiallou/feat/include-latest-day
feat(plotter-data-preparer): include latest available data up to current timestamp
2 parents e3e688b + d38a743 commit 840434b

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
## New Features
1212
* Notification service: Introduced `NotificationSendError` for structured retry failure handling and updated the logging in `send_test_email()` utility function.
13+
* Rolling and profile plots now include production data up to the latest available timestamp, even if the current day is incomplete. This provides more real-time views of today's production without waiting for the day to finish.
1314

1415
## Bug Fixes
1516

src/frequenz/lib/notebooks/solar/maintenance/plotter_data_preparer.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,7 @@ def _prepare_data_time_frame(
236236
start = current.replace(hour=0, minute=0, second=0) - pd.Timedelta(
237237
days=time
238238
)
239-
stop = current.replace(
240-
hour=23, minute=59, second=59, microsecond=1
241-
) - pd.Timedelta(days=1)
242-
df_to_plot = df.loc[start:stop, :].resample("D").sum()
239+
df_to_plot = df.loc[start:current, :].resample("D").sum()
243240
df_to_plot[self.config.x_axis_label] = [
244241
item.strftime(self._date_format) for item in df_to_plot.index
245242
]
@@ -250,8 +247,7 @@ def _prepare_data_time_frame(
250247
for item in pd.to_datetime(df_to_plot.index)
251248
]
252249
start = current - pd.Timedelta(hours=time) + pd.Timedelta(microseconds=1)
253-
stop = current
254-
df_to_plot = df_to_plot.loc[start:stop, :]
250+
df_to_plot = df_to_plot.loc[start:current, :]
255251
else:
256252
raise ValueError("Invalid time frame.")
257253
return df_to_plot
@@ -301,10 +297,7 @@ def _prepare_data(self, df: pd.DataFrame) -> dict[str, pd.DataFrame]:
301297
current = df.index[-1]
302298
past_n_days = df.loc[
303299
current.replace(hour=0, minute=0, second=0)
304-
- pd.Timedelta(days=self.config.duration) : current.replace(
305-
hour=23, minute=59, second=59, microsecond=1
306-
)
307-
- pd.Timedelta(days=1)
300+
- pd.Timedelta(days=self.config.duration) : current
308301
]
309302

310303
supported_groupings = {

0 commit comments

Comments
 (0)