FlexMeasures / flexmeasures

The intelligent & developer-friendly EMS to support real-time energy flexibility apps, rapidly and scalable.
https://flexmeasures.io
Apache License 2.0
148 stars 37 forks source link

Ensure the plotted time span matches the user request, not available sensor data #1173

Open BelhsanHmida opened 2 months ago

BelhsanHmida commented 2 months ago

Description:

Currently, the x-axis time span for the plotted data is based on the available data in the sensor. However, the expected behavior should follow the user’s specified time span. For example, if a user requests a time span of 2022-01-01 -> 2025-01-01, the x-axis should reflect that, even if the available sensor data is different.

Example

For this example Senors 1 only has data from 2024-09-10 -> 2024-09-11 when we call show beliefs from 2024-01-01 -> 2025-01-01 we get only 2024-09-10 -> 2024-09-11 on x axis.

Command:

flexmeasures show beliefs --sensor 1 --start 2024-01-01T00:00:00+01:00 --duration P1Y

Output

Beliefs for Sensor 'day-ahead prices' (ID 1).
Data spans 1 years, 0:00:00 and starts at 2024-01-01 00:00:00+01:00.
┌────────────────────────────────────────────────────────────┐
│    ▗▚                             ▞▄                       │ 
│    ▐ ▚                            ▌ ▌                      │ 
│    ▌ ▐                           ▐  ▌                      │ 
│   ▗▘ ▐                           ▞  ▌                      │ 15EUR/kWh
│   ▞  ▐                  ▗        ▌  ▚                  ▖   │ 
│   ▌   ▌                ▗▀▖      ▐   ▐                 ▞▚   │ 
│  ▐    ▌               ▗▘ ▐      ▞   ▐                ▞  ▌  │ 
│  ▞    ▌              ▐▘   ▌    ▗▘   ▝▖              ▞   ▐  │ 
│ ▛     ▐              ▐    ▚   ▐▘     ▌              ▌    ▌ │ 
│▞      ▝▖     ▖       ▌    ▝▖ ▗▘      ▚     ▗       ▗▘    ▚ │ 10EUR/kWh
│        ▐▄▚▄ ▞▚       ▌     ▌ ▌        ▚▞▄▖▗▀▖      ▐     ▝▖│ 
│           ▝▜ ▝▖     ▐      ▐▗▘           ▝▛ ▚      ▞      ▌│ 
│               ▚     ▞      ▝▟               ▝▖     ▌      ▐│ 
│               ▐     ▌       ▘                ▌    ▐       ▝│ 
│                ▌   ▐                         ▐    ▌        │ 
│                ▚   ▌                          ▌  ▗▘        │ 5EUR/kWh
│                 ▚▄▞                           ▝▄▄▘         │ 
└────────────────────────────────────────────────────────────┘
2024-09-10                   2024-09-11
          ██ day-ahead prices (NL transmission zone)

The x-axis should reflect the time span from 2024-01-01 -> 2025-01-01, even if the available sensor data only spans part of that time range.

Flix6x commented 2 months ago

Just wanted to document an idea: to try a df.reindex(pd.date_range(start, start + duration, resolution, inclusive="left")