Skip to content

Commit

Permalink
Merge 75fbdc3 into e4c77cc
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarcia98 committed May 31, 2023
2 parents e4c77cc + 75fbdc3 commit 83a8e1c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flexmeasures/data/models/reporting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def fetch_data(
)

# store data source as local variable
for source in bdf.sources.unique():
for source in bdf.sources.unique().dropna():
self.data[f"source_{source.id}"] = source

# store BeliefsDataFrame as local variable
Expand Down
13 changes: 13 additions & 0 deletions flexmeasures/data/models/reporting/pandas_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from flask import current_app
import timely_beliefs as tb
import pandas as pd

from flexmeasures.data.models.reporting import Reporter
from flexmeasures.data.schemas.reporting.pandas_reporter import (
Expand Down Expand Up @@ -84,6 +85,18 @@ def _compute(
]
final_output = tb.BeliefsDataFrame(timed_beliefs)

# use event_starts frequency when final_output event resolution
# does not correspond with the event resolution of the output sensor
event_frequency = final_output.event_starts.inferred_freq

if event_frequency:
event_frequency = pd.to_timedelta(
pd.tseries.frequencies.to_offset(event_frequency)
).to_pytimedelta()

if final_output.event_resolution != final_output.sensor.event_resolution:
final_output.event_resolution = event_frequency

return final_output

def get_object_or_literal(self, value: Any, method: str) -> Any:
Expand Down

0 comments on commit 83a8e1c

Please sign in to comment.