Industry demand: Also record material production per industry
This commit is contained in:
parent
515416fd75
commit
37f36047ca
@ -159,7 +159,8 @@ rule build_industrial_demand_per_country:
|
|||||||
input:
|
input:
|
||||||
industry_sector_ratios="resources/industry_sector_ratios.csv"
|
industry_sector_ratios="resources/industry_sector_ratios.csv"
|
||||||
output:
|
output:
|
||||||
industrial_demand_per_country="resources/industrial_demand_per_country.csv"
|
industrial_demand_per_country="resources/industrial_demand_per_country.csv",
|
||||||
|
industrial_energy_demand_per_country="resources/industrial_energy_demand_per_country.csv"
|
||||||
threads: 1
|
threads: 1
|
||||||
resources: mem_mb=1000
|
resources: mem_mb=1000
|
||||||
script: 'scripts/build_industrial_demand_per_country.py'
|
script: 'scripts/build_industrial_demand_per_country.py'
|
||||||
@ -168,7 +169,7 @@ rule build_industrial_demand_per_country:
|
|||||||
rule build_industrial_demand:
|
rule build_industrial_demand:
|
||||||
input:
|
input:
|
||||||
clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv",
|
clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv",
|
||||||
industrial_demand_per_country="resources/industrial_demand_per_country.csv"
|
industrial_demand_per_country="resources/industrial_energy_demand_per_country.csv"
|
||||||
output:
|
output:
|
||||||
industrial_demand="resources/industrial_demand_{network}_s{simpl}_{clusters}.csv"
|
industrial_demand="resources/industrial_demand_{network}_s{simpl}_{clusters}.csv"
|
||||||
threads: 1
|
threads: 1
|
||||||
|
@ -7,7 +7,7 @@ def build_industrial_demand():
|
|||||||
pop_layout = pd.read_csv(snakemake.input.clustered_pop_layout,index_col=0)
|
pop_layout = pd.read_csv(snakemake.input.clustered_pop_layout,index_col=0)
|
||||||
pop_layout["ct"] = pop_layout.index.str[:2]
|
pop_layout["ct"] = pop_layout.index.str[:2]
|
||||||
ct_total = pop_layout.total.groupby(pop_layout["ct"]).sum()
|
ct_total = pop_layout.total.groupby(pop_layout["ct"]).sum()
|
||||||
pop_layout["ct_total"] = pop_layout["ct"].map(ct_total.get)
|
pop_layout["ct_total"] = pop_layout["ct"].map(ct_total)
|
||||||
pop_layout["fraction"] = pop_layout["total"]/pop_layout["ct_total"]
|
pop_layout["fraction"] = pop_layout["total"]/pop_layout["ct_total"]
|
||||||
|
|
||||||
industrial_demand_per_country = pd.read_csv(snakemake.input.industrial_demand_per_country,index_col=0)
|
industrial_demand_per_country = pd.read_csv(snakemake.input.industrial_demand_per_country,index_col=0)
|
||||||
|
@ -16,7 +16,7 @@ tj_to_ktoe = 0.0238845
|
|||||||
ktoe_to_twh = 0.01163
|
ktoe_to_twh = 0.01163
|
||||||
|
|
||||||
# import EU ratios df as csv
|
# import EU ratios df as csv
|
||||||
df=pd.read_csv('resources/industry_sector_ratios.csv', sep=';', index_col=0)
|
df=pd.read_csv(snakemake.input.industry_sector_ratios, sep=';', index_col=0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -36,9 +36,6 @@ sub_sheet_name_dict = { 'Iron and steel':'ISI',
|
|||||||
|
|
||||||
index = ['elec','biomass','methane','hydrogen','heat','naphtha','process emission','process emission from feedstock']
|
index = ['elec','biomass','methane','hydrogen','heat','naphtha','process emission','process emission from feedstock']
|
||||||
|
|
||||||
countries_df = pd.DataFrame(columns=index) #data frame final energy consumption per country and source
|
|
||||||
|
|
||||||
|
|
||||||
non_EU = ['NO', 'CH', 'ME', 'MK', 'RS', 'BA', 'AL']
|
non_EU = ['NO', 'CH', 'ME', 'MK', 'RS', 'BA', 'AL']
|
||||||
|
|
||||||
rename = {"GR" : "EL",
|
rename = {"GR" : "EL",
|
||||||
@ -49,7 +46,7 @@ eu28 = ['FR', 'DE', 'GB', 'IT', 'ES', 'PL', 'SE', 'NL', 'BE', 'FI', 'CZ',
|
|||||||
'HU', 'IE', 'SK', 'LT', 'HR', 'LU', 'SI'] + ['CY','MT']
|
'HU', 'IE', 'SK', 'LT', 'HR', 'LU', 'SI'] + ['CY','MT']
|
||||||
|
|
||||||
|
|
||||||
countries = non_EU + [rename.get(eu,eu) for eu in eu28[:-2]]
|
countries = non_EU + [rename.get(eu,eu) for eu in eu28]
|
||||||
|
|
||||||
|
|
||||||
sectors = ['Iron and steel','Chemicals Industry','Non-metallic mineral products',
|
sectors = ['Iron and steel','Chemicals Industry','Non-metallic mineral products',
|
||||||
@ -69,6 +66,20 @@ sect2sub = {'Iron and steel':['Electric arc','Integrated steelworks'],
|
|||||||
'Wood and wood products' :['Wood and wood products'],
|
'Wood and wood products' :['Wood and wood products'],
|
||||||
'Other Industrial Sectors':['Other Industrial Sectors']}
|
'Other Industrial Sectors':['Other Industrial Sectors']}
|
||||||
|
|
||||||
|
subsectors = [ss for s in sectors for ss in sect2sub[s]]
|
||||||
|
|
||||||
|
#final energy consumption per country and industry (TWh/a)
|
||||||
|
countries_df = pd.DataFrame(index=countries,
|
||||||
|
columns=index,
|
||||||
|
dtype=float)
|
||||||
|
|
||||||
|
#material demand per country and industry (kton/a)
|
||||||
|
countries_demand = pd.DataFrame(index=countries,
|
||||||
|
columns=subsectors,
|
||||||
|
dtype=float)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
out_dic ={'Electric arc': 'Electric arc',
|
out_dic ={'Electric arc': 'Electric arc',
|
||||||
'Integrated steelworks': 'Integrated steelworks',
|
'Integrated steelworks': 'Integrated steelworks',
|
||||||
'Basic chemicals': 'Basic chemicals (kt ethylene eq.)',
|
'Basic chemicals': 'Basic chemicals (kt ethylene eq.)',
|
||||||
@ -153,8 +164,9 @@ dic_Switzerland ={'Iron and steel': 7889.,
|
|||||||
|
|
||||||
dic_sec_position={}
|
dic_sec_position={}
|
||||||
for country in countries:
|
for country in countries:
|
||||||
countries_df.loc[country] = 0
|
countries_df.loc[country] = 0.
|
||||||
print (country)
|
countries_demand.loc[country] = 0.
|
||||||
|
print(country)
|
||||||
for sector in sectors:
|
for sector in sectors:
|
||||||
if country in non_EU:
|
if country in non_EU:
|
||||||
if country == 'CH':
|
if country == 'CH':
|
||||||
@ -181,7 +193,7 @@ for country in countries:
|
|||||||
|
|
||||||
for subsector in sect2sub[sector]:
|
for subsector in sect2sub[sector]:
|
||||||
output = ratio_country_EU28*s_out[out_dic[subsector]]
|
output = ratio_country_EU28*s_out[out_dic[subsector]]
|
||||||
|
countries_demand.loc[country,subsector] = output
|
||||||
for ind in index:
|
for ind in index:
|
||||||
countries_df.loc[country, ind] += float(output*df.loc[ind, subsector]) # kton * MWh = GWh (# kton * tCO2 = ktCO2)
|
countries_df.loc[country, ind] += float(output*df.loc[ind, subsector]) # kton * MWh = GWh (# kton * tCO2 = ktCO2)
|
||||||
|
|
||||||
@ -194,6 +206,7 @@ for country in countries:
|
|||||||
|
|
||||||
for subsector in sect2sub[sector]:
|
for subsector in sect2sub[sector]:
|
||||||
output = s_out[out_dic[subsector]]
|
output = s_out[out_dic[subsector]]
|
||||||
|
countries_demand.loc[country,subsector] = output
|
||||||
for ind in index:
|
for ind in index:
|
||||||
countries_df.loc[country, ind] += output*df.loc[ind, subsector] #kton * MWh = GWh (# kton * tCO2 = ktCO2)
|
countries_df.loc[country, ind] += output*df.loc[ind, subsector] #kton * MWh = GWh (# kton * tCO2 = ktCO2)
|
||||||
|
|
||||||
@ -234,5 +247,7 @@ rename_sectors = {'elec':'electricity',
|
|||||||
|
|
||||||
countries_df.rename(columns=rename_sectors,inplace=True)
|
countries_df.rename(columns=rename_sectors,inplace=True)
|
||||||
|
|
||||||
countries_df.to_csv('resources/industrial_demand_per_country.csv',
|
countries_df.to_csv(snakemake.output.industrial_energy_demand_per_country,
|
||||||
float_format='%.2f')
|
float_format='%.2f')
|
||||||
|
countries_demand.to_csv(snakemake.output.industrial_demand_per_country,
|
||||||
|
float_format='%.2f')
|
||||||
|
Loading…
Reference in New Issue
Block a user