Skip to content

Commit

Permalink
fixed a bug when there is no data for netpositions
Browse files Browse the repository at this point in the history
  • Loading branch information
fboerman committed Oct 7, 2024
1 parent 6248d17 commit 033dcb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion entsoe/entsoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
warnings.filterwarnings('ignore', category=XMLParsedAsHTMLWarning)

__title__ = "entsoe-py"
__version__ = "0.6.10"
__version__ = "0.6.11"
__author__ = "EnergieID.be, Frank Boerman"
__license__ = "MIT"

Expand Down Expand Up @@ -1169,6 +1169,8 @@ def query_net_position(self, country_code: Union[Area, str],
text = super(EntsoePandasClient, self).query_net_position(
country_code=area, start=start, end=end, dayahead=dayahead)
series = parse_netpositions(text, resolution=resolution)
if len(series) == 0:
raise NoMatchingDataError
series = series.tz_convert(area.tz)
series = series.truncate(before=start, after=end)
return series
Expand Down
3 changes: 2 additions & 1 deletion entsoe/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def parse_netpositions(xml_text, resolution):
# take the absolute value and correct for region
#TODO: possible change this or remove this warning after helpdesk got back to me
series_all.append(factor*series.abs())

if len(series_all) == 0:
return pd.Series()
series_all = pd.concat(series_all).sort_index()
return series_all

Expand Down

0 comments on commit 033dcb5

Please sign in to comment.