Merge pull request #1061 from PyPSA/bug-fix-rename-GR

rename Greece iso-code
This commit is contained in:
Fabian Neumann 2024-05-13 17:42:19 +02:00 committed by GitHub
commit 39f2fdd7bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 20 deletions

View File

@ -142,6 +142,7 @@ def build_eurostat(input_eurostat, countries, nprocesses=1, disable_progressbar=
"Domestic navigation": "Domestic Navigation", "Domestic navigation": "Domestic Navigation",
"International maritime bunkers": "Bunkers", "International maritime bunkers": "Bunkers",
"UK": "GB", "UK": "GB",
"EL": "GR",
} }
columns_rename = {"Total": "Total all products"} columns_rename = {"Total": "Total all products"}
df.rename(index=index_rename, columns=columns_rename, inplace=True) df.rename(index=index_rename, columns=columns_rename, inplace=True)

View File

@ -415,8 +415,8 @@ def calculate_supply_energy(n, label, supply_energy):
def calculate_nodal_supply_energy(n, label, nodal_supply_energy): def calculate_nodal_supply_energy(n, label, nodal_supply_energy):
""" """
Calculate the total energy supply/consumption of each component at the buses Calculate the total energy supply/consumption of each component at the
aggregated by carrier and node. buses aggregated by carrier and node.
""" """
bus_carriers = n.buses.carrier.unique() bus_carriers = n.buses.carrier.unique()
@ -432,22 +432,27 @@ def calculate_nodal_supply_energy(n, label, nodal_supply_energy):
continue continue
s = ( s = (
pd.concat([ pd.concat(
( [
c.pnl.p[items] (
.multiply(n.snapshot_weightings.generators, axis=0) c.pnl.p[items]
.sum() .multiply(n.snapshot_weightings.generators, axis=0)
.multiply(c.df.loc[items, "sign"]) .sum()
), .multiply(c.df.loc[items, "sign"])
c.df.loc[items][["bus", "carrier"]] ),
], axis=1) c.df.loc[items][["bus", "carrier"]],
],
axis=1,
)
.groupby(by=["bus", "carrier"]) .groupby(by=["bus", "carrier"])
.sum()[0] .sum()[0]
) )
s = pd.concat([s], keys=[c.list_name]) s = pd.concat([s], keys=[c.list_name])
s = pd.concat([s], keys=[i]) s = pd.concat([s], keys=[i])
nodal_supply_energy = nodal_supply_energy.reindex(s.index.union(nodal_supply_energy.index)) nodal_supply_energy = nodal_supply_energy.reindex(
s.index.union(nodal_supply_energy.index)
)
nodal_supply_energy.loc[s.index, label] = s nodal_supply_energy.loc[s.index, label] = s
for c in n.iterate_components(n.branch_components): for c in n.iterate_components(n.branch_components):
@ -458,14 +463,18 @@ def calculate_nodal_supply_energy(n, label, nodal_supply_energy):
continue continue
s = ( s = (
pd.concat([ pd.concat(
( [
(-1) * c.pnl["p" + end][items] (
.multiply(n.snapshot_weightings.generators, axis=0) (-1)
.sum() * c.pnl["p" + end][items]
), .multiply(n.snapshot_weightings.generators, axis=0)
c.df.loc[items][["bus0", "carrier"]] .sum()
], axis=1) ),
c.df.loc[items][["bus0", "carrier"]],
],
axis=1,
)
.groupby(by=["bus0", "carrier"]) .groupby(by=["bus0", "carrier"])
.sum()[0] .sum()[0]
) )