move calculation of district heating share to build_energy_totals
This commit is contained in:
parent
e27ec46878
commit
8322350fee
@ -160,6 +160,7 @@ rule build_energy_totals:
|
||||
co2="data/eea/UNFCCC_v23.csv",
|
||||
swiss="data/switzerland-sfoe/switzerland-new_format.csv",
|
||||
idees="data/jrc-idees-2015",
|
||||
district_heat_share='data/district_heat_share.csv',
|
||||
eurostat=input_eurostat
|
||||
output:
|
||||
energy_name='resources/energy_totals.csv',
|
||||
@ -339,7 +340,6 @@ rule prepare_sector_network:
|
||||
energy_totals_name='resources/energy_totals.csv',
|
||||
co2_totals_name='resources/co2_totals.csv',
|
||||
transport_name='resources/transport_data.csv',
|
||||
dh_share = "data/district_heat_share.csv",
|
||||
traffic_data_KFZ="data/emobility/KFZ__count",
|
||||
traffic_data_Pkw="data/emobility/Pkw__count",
|
||||
biomass_potentials='resources/biomass_potentials.csv',
|
||||
|
@ -212,6 +212,12 @@ def idees_per_country(ct, year):
|
||||
assert df.index[47] == "Electricity"
|
||||
ct_totals["electricity residential"] = df[47]
|
||||
|
||||
assert df.index[46] == "Derived heat"
|
||||
ct_totals["Derived heat residential"] = df[46]
|
||||
|
||||
assert df.index[50] == 'Thermal uses'
|
||||
ct_totals["Thermal uses residential"] = df[50]
|
||||
|
||||
# services
|
||||
|
||||
df = pd.read_excel(fn_services, "SER_hh_fec", index_col=0)[year]
|
||||
@ -239,6 +245,12 @@ def idees_per_country(ct, year):
|
||||
assert df.index[50] == "Electricity"
|
||||
ct_totals["electricity services"] = df[50]
|
||||
|
||||
assert df.index[49] == "Derived heat"
|
||||
ct_totals["Derived heat services"] = df[49]
|
||||
|
||||
assert df.index[53] == 'Thermal uses'
|
||||
ct_totals["Thermal uses services"] = df[53]
|
||||
|
||||
# transport
|
||||
|
||||
df = pd.read_excel(fn_transport, "TrRoad_ene", index_col=0)[year]
|
||||
@ -342,6 +354,7 @@ def build_idees(countries, year):
|
||||
with mp.Pool(processes=nprocesses) as pool:
|
||||
totals_list = list(tqdm(pool.imap(func, countries), **tqdm_kwargs))
|
||||
|
||||
|
||||
totals = pd.concat(totals_list, axis=1)
|
||||
|
||||
# convert ktoe to TWh
|
||||
@ -351,6 +364,13 @@ def build_idees(countries, year):
|
||||
# convert TWh/100km to kWh/km
|
||||
totals.loc["passenger car efficiency"] *= 10
|
||||
|
||||
# district heating share
|
||||
district_heat = totals.loc[["Derived heat residential",
|
||||
"Derived heat services"]].sum()
|
||||
total_heat = totals.loc[["Thermal uses residential",
|
||||
"Thermal uses services"]].sum()
|
||||
totals.loc["district heat share"] = district_heat.div(total_heat)
|
||||
|
||||
return totals.T
|
||||
|
||||
|
||||
@ -493,7 +513,7 @@ def build_energy_totals(countries, eurostat, swiss, idees):
|
||||
|
||||
for purpose in ["passenger", "freight"]:
|
||||
attrs = [f"total domestic aviation {purpose}", f"total international aviation {purpose}"]
|
||||
df.loc[missing, f"total aviation {purpose}"] = df.loc[missing, attrs].sum(axis=1)
|
||||
df.loc[missing, f"total aviation {purpose}"] = df.loc[missing, attrs].sum(axis=1)
|
||||
|
||||
if "BA" in df.index:
|
||||
# fill missing data for BA (services and road energy data)
|
||||
@ -502,6 +522,14 @@ def build_energy_totals(countries, eurostat, swiss, idees):
|
||||
ratio = df.at["BA", "total residential"] / df.at["RS", "total residential"]
|
||||
df.loc['BA', missing] = ratio * df.loc["RS", missing]
|
||||
|
||||
# Missing district heating share
|
||||
dh_share = pd.read_csv(snakemake.input.district_heat_share,
|
||||
index_col=0, usecols=[0, 1])
|
||||
# make conservative assumption and take minimum from both data sets
|
||||
df["district heat share"] = (pd.concat([df["district heat share"],
|
||||
dh_share.reindex(index=df.index)/100],
|
||||
axis=1).min(axis=1))
|
||||
|
||||
return df
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user