Brussels. Step 3.b. Visualize transition scenarios¶
In [1]:
import datetime; print(datetime.datetime.now())
2018-04-09 11:47:45.683429
Notebook Abstract:
The following notebook visualize the the simple transition scenarios by plotting the total consumption over all simulation years and the per-capita consumption rate. Depending on the define scenarios the per-capita consumption rate can be maintained constant. The per-capita consumption value is computed as total consumption divided by population size.
Import libraries¶
In [2]:
from smum.microsim.util_plot import plot_data_projection
The visualization is performed with help of the module function
plot_data_projection()
.
Global variables¶
In [3]:
iterations = 1000
typ = 'resampled'
model_name = "Brussels_Electricity_Water_projected_dynamic_{}_bias".format(typ)
reweighted_survey = 'data/survey_{}_{}'.format(model_name, iterations)
Base scenario¶
In [14]:
var = ['Water', 'Electricity']
data = plot_data_projection(
reweighted_survey, var, "{}, {}".format(iterations, typ),
benchmark_year=False, start_year=2016, end_year=2025
)
Base scenario grouped by construction type¶
In [5]:
var = ['Water', 'Electricity']
groupby = 'w_ConstructionType'
data = plot_data_projection(
reweighted_survey, var, "{}, {} by {}".format(iterations, typ, groupby),
benchmark_year = False, start_year=2016, end_year=2025,
groupby = groupby
)
Base scenario grouped by construction year¶
In [6]:
var = ['Water', 'Electricity']
groupby = 'w_ConstructionYear'
data = plot_data_projection(
reweighted_survey, var, "{}, {} by {}".format(iterations, typ, groupby),
benchmark_year = False, start_year=2016, end_year=2025,
groupby = groupby
)
Scenario 1 compared to base scenario¶
In [7]:
import numpy as np
pr = [i for i in np.linspace(0, 0.3, num=10)]
scenario_name = 'scenario 1'
In [8]:
variables = ['Water', 'Electricity']
for var in variables:
var = [var]
data = plot_data_projection(
reweighted_survey, var, "{}, {}, alt. scenario 1".format(iterations, typ),
benchmark_year=False, start_year=2016, end_year=2025,
pr = pr, scenario_name = scenario_name,
aspect_ratio = 2,
)
Scenario 1 grouped by construction year¶
In [9]:
variables = ['Water', 'Electricity']
groupby = 'w_ConstructionYear'
for var in variables:
var = [var]
data = plot_data_projection(
reweighted_survey, var, "{}, {} by {}, alt. scenario 1".format(iterations, typ, groupby),
benchmark_year=False, start_year=2016, end_year=2025,
pr = pr, scenario_name = scenario_name,
groupby = groupby,
aspect_ratio = 2,
)
In [10]:
import numpy as np
pr = [i for i in np.linspace(0, 0.6, num=10)]
scenario_name = 'scenario 2'
Scenario 2 compared to base scenario¶
In [11]:
variables = ['Water', 'Electricity']
for var in variables:
var = [var]
data = plot_data_projection(
reweighted_survey, var, "{}, {}, alt. scenario 2".format(iterations, typ),
benchmark_year=False, start_year=2016, end_year=2025,
pr = pr, scenario_name = scenario_name,
aspect_ratio = 2,
)
Scenario 2 grouped by construction year¶
In [12]:
variables = ['Water', 'Electricity']
groupby = 'w_ConstructionYear'
for var in variables:
var = [var]
data = plot_data_projection(
reweighted_survey, var, "{}, {} by {}, alt. scenario 2".format(iterations, typ, groupby),
benchmark_year=False, start_year=2016, end_year=2025,
pr = pr, scenario_name = scenario_name,
groupby = groupby,
aspect_ratio = 2,
)
Scenario 2 grouped by construction year, cross tabulation¶
In [15]:
from smum.microsim.util_plot import cross_tab
In [16]:
a = 'Water'
b = 'w_ConstructionYear'
ct = cross_tab(a, b, 2025, reweighted_survey + "_{}_scenario 2_0.60.csv", split_a = True)
data saved as: data/Water_w_ConstructionYear_2025.xlsx
In [17]:
ct
Out[17]:
w_ConstructionYear | ConstructionYear_1900 | ConstructionYear_1918 | ConstructionYear_1945 | ConstructionYear_1961 | ConstructionYear_1970 | ConstructionYear_1981 | ConstructionYear_1991 | ConstructionYear_2001 | ConstructionYear_2011 | ConstructionYear_2016 | ConstructionYear_2020 | ConstructionYear_2030 | ConstructionYear_2035 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Water | |||||||||||||
Low | 756.00 | 2107.00 | 31728.00 | 24695.00 | 20596.00 | 19762.00 | 41657.00 | 36786.00 | 37786.00 | 15789.00 | 17284.00 | 27518.00 | 27313.31 |
mid-Low | 3783.00 | NaN | 23941.59 | 33933.60 | 12107.27 | 21273.51 | 27826.15 | 25649.13 | 36460.21 | 15256.25 | 11792.58 | 25899.59 | 14275.55 |
Middle | 5432.62 | 38.32 | 15585.17 | 21938.42 | 11685.87 | 25276.22 | 16113.10 | 30999.13 | 38580.44 | 26178.14 | 16685.87 | 32066.15 | 15668.16 |
mid-High | 910.64 | NaN | 17586.04 | 23999.04 | 10350.21 | 20567.05 | 33363.96 | 31628.68 | 19203.35 | 14848.76 | 12146.85 | 18881.18 | 10398.89 |
High | 1989.63 | NaN | 14134.40 | 13426.42 | 20346.68 | 22532.30 | 24775.92 | 35835.83 | 31014.19 | 13740.42 | 6450.16 | 24354.21 | 7430.19 |
In [18]:
a = 'Electricity'
b = 'w_ConstructionYear'
ct = cross_tab(a, b, 2025, reweighted_survey + "_{}_scenario 2_0.60.csv", split_a = True)
data saved as: data/Electricity_w_ConstructionYear_2025.xlsx
In [19]:
ct
Out[19]:
w_ConstructionYear | ConstructionYear_1900 | ConstructionYear_1918 | ConstructionYear_1945 | ConstructionYear_1961 | ConstructionYear_1970 | ConstructionYear_1981 | ConstructionYear_1991 | ConstructionYear_2001 | ConstructionYear_2011 | ConstructionYear_2016 | ConstructionYear_2020 | ConstructionYear_2030 | ConstructionYear_2035 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Electricity | |||||||||||||
Low | NaN | NaN | 33418.00 | 29831.00 | 16378.00 | 24107.00 | 34345.00 | 38718.00 | 44712.00 | 15356.31 | 13317.00 | 39565.00 | 22970.00 |
mid-Low | 2656.00 | 2107.00 | 16546.00 | 34296.00 | 18102.00 | 26041.00 | 25023.00 | 39102.00 | 42224.00 | 21567.00 | 20670.00 | 34543.00 | 14090.00 |
Middle | 4184.00 | NaN | 25195.41 | 21668.80 | 12685.21 | 17660.15 | 22405.50 | 27688.46 | 27039.38 | 17181.52 | 4476.64 | 20975.16 | 13303.24 |
mid-High | 2015.63 | NaN | 10714.45 | 15683.31 | 12347.43 | 25470.56 | 24511.52 | 27061.47 | 23394.93 | 13715.08 | 19022.35 | 13591.65 | 17715.70 |
High | 4016.26 | 38.32 | 17101.34 | 16513.37 | 15573.39 | 16132.37 | 37451.12 | 28328.85 | 25673.88 | 17992.67 | 6873.47 | 20044.31 | 7007.16 |