merge
This commit is contained in:
commit
14d6c3b97f
@ -8,6 +8,7 @@ Build total energy demands per country using JRC IDEES, eurostat, and EEA data.
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
|
import os
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import country_converter as coco
|
import country_converter as coco
|
||||||
@ -16,7 +17,6 @@ import numpy as np
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from _helpers import configure_logging, mute_print, set_scenario_config
|
from _helpers import configure_logging, mute_print, set_scenario_config
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
import os
|
|
||||||
|
|
||||||
cc = coco.CountryConverter()
|
cc = coco.CountryConverter()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -757,12 +757,14 @@ def build_transport_data(countries, population, idees):
|
|||||||
|
|
||||||
return transport_data
|
return transport_data
|
||||||
|
|
||||||
|
|
||||||
def rescale(idees_countries, energy, eurostat):
|
def rescale(idees_countries, energy, eurostat):
|
||||||
'''
|
"""
|
||||||
Takes JRC IDEES data from 2015 and rescales it by the ratio of the
|
Takes JRC IDEES data from 2015 and rescales it by the ratio of the eurostat
|
||||||
eurostat data and the 2015 eurostat data.
|
data and the 2015 eurostat data.
|
||||||
|
|
||||||
missing data: ['passenger car efficiency', 'passenger cars']
|
missing data: ['passenger car efficiency', 'passenger cars']
|
||||||
'''
|
"""
|
||||||
# read in the eurostat data for 2015
|
# read in the eurostat data for 2015
|
||||||
eurostat_2015 = build_eurostat(input_eurostat, countries, 2023, 2015)[["Total all products", "Electricity"]]
|
eurostat_2015 = build_eurostat(input_eurostat, countries, 2023, 2015)[["Total all products", "Electricity"]]
|
||||||
eurostat_year = eurostat[["Total all products", "Electricity"]]
|
eurostat_year = eurostat[["Total all products", "Electricity"]]
|
||||||
@ -826,9 +828,9 @@ def rescale(idees_countries, energy, eurostat):
|
|||||||
'total international aviation'
|
'total international aviation'
|
||||||
]
|
]
|
||||||
avia_domestic = [
|
avia_domestic = [
|
||||||
'total domestic aviation passenger',
|
"total domestic aviation passenger",
|
||||||
'total domestic aviation freight',
|
"total domestic aviation freight",
|
||||||
'total domestic aviation',
|
"total domestic aviation",
|
||||||
]
|
]
|
||||||
navigation = [
|
navigation = [
|
||||||
"total domestic navigation",
|
"total domestic navigation",
|
||||||
@ -846,11 +848,12 @@ def rescale(idees_countries, energy, eurostat):
|
|||||||
energy.loc[country, avia_inter] *= avi_i[['total']].iloc[0,0]
|
energy.loc[country, avia_inter] *= avi_i[['total']].iloc[0,0]
|
||||||
energy.loc[country, avia_domestic] *= avi_d[['total']].iloc[0,0]
|
energy.loc[country, avia_domestic] *= avi_d[['total']].iloc[0,0]
|
||||||
|
|
||||||
nav = ratio.loc[(country, slice(None), 'Domestic Navigation')]
|
nav = ratio.loc[(country, slice(None), "Domestic Navigation")]
|
||||||
energy.loc[country, navigation] *= nav[['total']].iloc[0,0]
|
energy.loc[country, navigation] *= nav[["total"]].iloc[0, 0]
|
||||||
|
|
||||||
return energy
|
return energy
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if "snakemake" not in globals():
|
if "snakemake" not in globals():
|
||||||
from _helpers import mock_snakemake
|
from _helpers import mock_snakemake
|
||||||
@ -887,7 +890,9 @@ if __name__ == "__main__":
|
|||||||
energy.to_csv(snakemake.output.energy_name)
|
energy.to_csv(snakemake.output.energy_name)
|
||||||
|
|
||||||
# use rescaled idees data to calculate district heat share
|
# use rescaled idees data to calculate district heat share
|
||||||
district_heat_share = build_district_heat_share(countries, energy.loc[idees_countries])
|
district_heat_share = build_district_heat_share(
|
||||||
|
countries, energy.loc[idees_countries]
|
||||||
|
)
|
||||||
district_heat_share.to_csv(snakemake.output.district_heat_share)
|
district_heat_share.to_csv(snakemake.output.district_heat_share)
|
||||||
|
|
||||||
base_year_emissions = params["base_emissions_year"]
|
base_year_emissions = params["base_emissions_year"]
|
||||||
|
Loading…
Reference in New Issue
Block a user