Skip to content

Commit

Permalink
Fix missing ENTSOE hydro storage (fixes electricitymaps#2800, fixes e…
Browse files Browse the repository at this point in the history
…lectricitymaps#2802)

97865b8 introduced this bug by removing all consumption data from the
ENTSOE parser, however it was not intended to remove hydro storage,
only power plant self-consumption.

This commit reverts the earlier change, and adds a check so that
only hydro storage consumption data will be included, rather than
no consumption data at all.
  • Loading branch information
willbeaufoy committed Nov 17, 2020
1 parent bf4ac1c commit 9fdfe6d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions parsers/ENTSOE.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,18 +620,22 @@ def parse_production(xml_text):
is_production = len(timeseries.find_all('inBiddingZone_Domain.mRID'.lower())) > 0
psr_type = timeseries.find_all('mktpsrtype')[0].find_all('psrtype')[0].contents[0]

if len(timeseries.find_all('inBiddingZone_Domain.mRID'.lower())) > 0:
for entry in timeseries.find_all('point'):
quantity = float(entry.find_all('quantity')[0].contents[0])
position = int(entry.find_all('position')[0].contents[0])
datetime = datetime_from_position(datetime_start, position, resolution)
try:
i = datetimes.index(datetime)
for entry in timeseries.find_all('point'):
quantity = float(entry.find_all('quantity')[0].contents[0])
position = int(entry.find_all('position')[0].contents[0])
datetime = datetime_from_position(datetime_start, position, resolution)
try:
i = datetimes.index(datetime)
if is_production:
productions[i][psr_type] += quantity
except ValueError: # Not in list
datetimes.append(datetime)
productions.append(defaultdict(lambda: 0))
productions[-1][psr_type] = quantity if is_production else -1 * quantity
elif psr_type in ENTSOE_PARAMETER_GROUPS['storage']['hydro storage']:
# Only include consumption if it's for hydro storage. In other cases
# it is power plant self-consumption which should be ignored.
productions[i][psr_type] -= quantity
except ValueError: # Not in list
datetimes.append(datetime)
productions.append(defaultdict(lambda: 0))
productions[-1][psr_type] = quantity if is_production else -1 * quantity
return productions, datetimes


Expand Down

0 comments on commit 9fdfe6d

Please sign in to comment.