Skip to content

Commit

Permalink
whitespaces and black
Browse files Browse the repository at this point in the history
  • Loading branch information
Ultramarin95 committed May 11, 2022
1 parent e103eef commit d9cf339
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/dataGeneratorScripts/generateRenewables/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ to distribute the installed unit powers over several ags keys if the power can n
Unfortunatly not all AGS Keys in the Marktstammdatenregister are valid keys, that are used by local zero. This is due to the fact that the ags keys change over time. To update
the keys we use the following algorithms: We create sets of ags keys {ags keys| ags keys linked via ags history} that are linked via a entries in the ags history and accumulate
all powers of the renewable units in this set. Afterwards we distribute the accumulated power over subsets of these sets
{{ags keys| ags keys linked via ags history & used by local zero}} by the using their respective share in population. With the assumption that
{{ags keys| ags keys linked via ags history & used by local zero}} by the using their respective share in population. With the assumption that
most ags keys do not change over the years and the {ags keys| ags keys linked via ags history} sets do not get too big, the resulting error is acceptable.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ def power_per_ags(

for cmpnt_id, total_power in cmpnt_power.items():
# Ignore AGS with zero inhabitants. This also makes sure that we only distribute power to the ags keys we use with local zero!
populated = [ags for ags in cmpnt_ags[cmpnt_id] if ags in population.keys() and population[ags] > 0]
populated = [
ags
for ags in cmpnt_ags[cmpnt_id]
if ags in population.keys() and population[ags] > 0
]
if len(populated) == 0:
if set(cmpnt_ags[cmpnt_id]).issubset(IGNORE):
power_lost += total_power
Expand Down Expand Up @@ -166,7 +170,7 @@ def read_ags_history_json(filename) -> tuple[tuple[str, str]]:
See https://www.xrepository.de/api/xrepository/urn:xoev-de:bund:destatis:bevoelkerungsstatistik:codeliste:ags.historie_2021-12-31/download/Destatis.AGS.Historie_2021-12-31.json
"""
with open(filename, "r",encoding="utf-8") as f:
with open(filename, "r", encoding="utf-8") as f:
return tuple(
(AGS, NachfolgerAGS)
for [
Expand Down Expand Up @@ -258,6 +262,6 @@ def rows():
with open("2018.csv", "w", newline="") as f:
writer = csv.writer(f)

#write header
# write header
writer.writerow(["ags", "pv", "wind", "biomass", "water"])
writer.writerows(rows())

0 comments on commit d9cf339

Please sign in to comment.