Skip to content

Commit

Permalink
fixed correct process parameter for parsing of xml for query_load
Browse files Browse the repository at this point in the history
added query_load_and_forecast as a helper function
fixes #140
  • Loading branch information
fboerman committed Nov 14, 2021
1 parent a0dc3e9 commit 5fc7d12
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ type_marketagreement_type = 'A01'
# methods that return Pandas Series
client.query_day_ahead_prices(country_code, start=start,end=end)
client.query_net_position_dayahead(country_code, start=start, end=end)
client.query_load(country_code, start=start,end=end)
client.query_load_forecast(country_code, start=start,end=end)
client.query_crossborder_flows(country_code_from, country_code_to, start, end)
client.query_scheduled_exchanges(country_code_from, country_code_to, start, end, dayahead=False)
client.query_net_transfer_capacity_dayahead(country_code_from, country_code_to, start, end)
Expand All @@ -106,6 +104,9 @@ client.query_net_transfer_capacity_yearahead(country_code_from, country_code_to,
client.query_intraday_offered_capacity(country_code_from, country_code_to, start, end,implicit=True)

# methods that return Pandas DataFrames
client.query_load(country_code, start=start,end=end)
client.query_load_forecast(country_code, start=start,end=end)
client.query_load_and_forecast(country_code, start=start, end=end)
client.query_generation_forecast(country_code, start=start,end=end)
client.query_wind_and_solar_forecast(country_code, start=start,end=end, psr_type=None)
client.query_generation(country_code, start=start,end=end, psr_type=None)
Expand Down
23 changes: 22 additions & 1 deletion entsoe/entsoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def query_load(self, country_code: Union[Area, str], start: pd.Timestamp,
area = lookup_area(country_code)
text = super(EntsoePandasClient, self).query_load(
country_code=area, start=start, end=end)
series = parse_loads(text)
series = parse_loads(text, process_type='A16')
series = series.tz_convert(area.tz)
series = series.truncate(before=start, after=end)
return series
Expand Down Expand Up @@ -996,6 +996,27 @@ def query_load_forecast(
df = df.truncate(before=start, after=end)
return df

def query_load_and_forecast(
self, country_code: Union[Area, str], start: pd.Timestamp,
end: pd.Timestamp) -> pd.DataFrame:
"""
utility function to combina query realised load and forecasted day ahead load.
this mimics the html view on the page Total Load - Day Ahead / Actual
Parameters
----------
country_code : Area|str
start : pd.Timestamp
end : pd.Timestamp
Returns
-------
pd.DataFrame
"""
df_load_forecast_da = self.query_load_forecast(country_code, start=start, end=end)
df_load = self.query_load(country_code, start=start, end=end)
return df_load_forecast_da.join(df_load, sort=True, how='inner')


@year_limited
def query_generation_forecast(
Expand Down

0 comments on commit 5fc7d12

Please sign in to comment.