Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not resample data of sensors recording instantaneous values #491

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -25,6 +25,7 @@ v0.11.1 | September XX, 2022

Bugfixes
-----------
* Do not fail asset page if none of the sensors has any data [see `PR #492 <http://www.github.com/FlexMeasures/flexmeasures/pull/492>`_]
Flix6x marked this conversation as resolved.
Show resolved Hide resolved
* Do not fail asset page if one of the shown sensors records instantaneous values [see `PR #491 <http://www.github.com/FlexMeasures/flexmeasures/pull/491>`_]


Expand Down
12 changes: 6 additions & 6 deletions flexmeasures/data/models/charts/belief_charts.py
Expand Up @@ -72,13 +72,13 @@ def chart_for_multiple_sensors(
**override_chart_specs: dict,
):
sensors_specs = []
condition = (
sensor.event_resolution
for sensor in sensors
if sensor.event_resolution > timedelta(0)
)
minimum_non_zero_resolution_in_ms = (
min(
sensor.event_resolution
for sensor in sensors
if sensor.event_resolution > timedelta(0)
).total_seconds()
* 1000
min(condition).total_seconds() * 1000 if any(condition) else 0
)
for sensor in sensors:
unit = sensor.unit if sensor.unit else "a.u."
Expand Down
5 changes: 4 additions & 1 deletion flexmeasures/data/models/generic_assets.py
Expand Up @@ -381,11 +381,14 @@ def search_beliefs(
from flexmeasures.data.services.time_series import simplify_index

if sensors:
minimum_non_zero_resolution = min(
condition = (
bdf.event_resolution
for bdf in bdf_dict.values()
if bdf.event_resolution > timedelta(0)
Flix6x marked this conversation as resolved.
Show resolved Hide resolved
)
minimum_non_zero_resolution = (
min(condition) if any(condition) else timedelta(0)
)
df_dict = {}
for sensor, bdf in bdf_dict.items():
if bdf.event_resolution > timedelta(0):
Expand Down