Make selection of biomass classes (solid, biogas) more explicit

List classes in config.yaml, rather than integer selection in
build_biomass_potentials.py.

Also output potentials for all years and scenarios for analysis.
This commit is contained in:
Tom Brown 2020-09-21 18:35:45 +02:00
parent 83aa24cf17
commit 791a58fc6b
4 changed files with 22 additions and 14 deletions

View File

@ -141,6 +141,7 @@ rule build_biomass_potentials:
input:
jrc_potentials="data/biomass/JRC Biomass Potentials.xlsx"
output:
biomass_potentials_all='resources/biomass_potentials_all.csv',
biomass_potentials='resources/biomass_potentials.csv'
threads: 1
resources: mem_mb=1000

View File

@ -48,6 +48,10 @@ electricity:
biomass:
year: 2030
scenario: "Med"
classes:
solid biomass: ['Primary agricultural residues', 'Forestry energy residue', 'Secondary forestry residues', 'Secondary Forestry residues sawdust', 'Forestry residues from landscape care biomass', 'Municipal waste']
not included: ['Bioethanol sugar beet biomass', 'Rapeseeds for biodiesel', 'sunflower and soya for Biodiesel', 'Starchy crops biomass', 'Grassy crops biomass', 'Willow biomass', 'Poplar biomass potential', 'Roundwood fuelwood', 'Roundwood Chips & Pellets']
biogas: ['Manure biomass potential', 'Sludge biomass']
# only relevant for foresight = myopic or perfect
existing_capacities:

View File

@ -48,6 +48,10 @@ electricity:
biomass:
year: 2030
scenario: "Med"
classes:
solid biomass: ['Primary agricultural residues', 'Forestry energy residue', 'Secondary forestry residues', 'Secondary Forestry residues sawdust', 'Forestry residues from landscape care biomass', 'Municipal waste']
not included: ['Bioethanol sugar beet biomass', 'Rapeseeds for biodiesel', 'sunflower and soya for Biodiesel', 'Starchy crops biomass', 'Grassy crops biomass', 'Willow biomass', 'Poplar biomass potential', 'Roundwood fuelwood', 'Roundwood Chips & Pellets']
biogas: ['Manure biomass potential', 'Sludge biomass']
# only relevant for foresight = myopic or perfect
existing_capacities:

View File

@ -19,29 +19,28 @@ def build_biomass_potentials():
for i in range(36):
df_dict[df.iloc[i*16,1]] = df.iloc[1+i*16:(i+1)*16].astype(float)
df_new = pd.concat(df_dict)
#convert from PJ to MWh
df_new = pd.concat(df_dict).rename({"UK" : "GB", "BH" : "BA"})/3.6*1e6
df_new.index.name = "MWh/a"
df_new.to_csv(snakemake.output.biomass_potentials_all)
# solid biomass includes: Primary agricultural residues (MINBIOAGRW1),
# Forestry energy residue (MINBIOFRSF1),
# Forestry energy residue (MINBIOFRSF1),
# Secondary forestry residues (MINBIOWOOW1),
# Secondary Forestry residues sawdust (MINBIOWOO1a)',
# Forestry residues from landscape care biomass (MINBIOFRSF1a),
# Forestry residues from landscape care biomass (MINBIOFRSF1a),
# Municipal waste (MINBIOMUN1)',
# biogas includes : Manure biomass potential (MINBIOGAS1),
# Sludge biomass (MINBIOSLU1)
us_type = pd.Series(index=df_new.columns)
us_type.iloc[0:7] = "not included"
us_type.iloc[7:8] = "biogas"
us_type.iloc[8:9] = "solid biomass"
us_type.iloc[9:11] = "not included"
us_type.iloc[11:16] = "solid biomass"
us_type.iloc[16:17] = "biogas"
us_type = pd.Series("", df_new.columns)
#convert from PJ to MWh
biomass_potentials = df_new.loc[idx[:,snakemake.config['biomass']['year'],snakemake.config['biomass']['scenario']],:].groupby(us_type,axis=1).sum().groupby(level=0).sum().rename({"UK" : "GB", "BH" : "BA"})/3.6*1e6
for k,v in snakemake.config['biomass']['classes'].items():
us_type.loc[v] = k
biomass_potentials = df_new.swaplevel(0,2).loc[snakemake.config['biomass']['scenario'],snakemake.config['biomass']['year']].groupby(us_type,axis=1).sum()
biomass_potentials.index.name = "MWh/a"
biomass_potentials.to_csv(snakemake.output.biomass_potentials)