Skip to content

Commit

Permalink
before implementgin spatial mapping of lads
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Eggimann committed Mar 5, 2018
1 parent 492b669 commit acc0651
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 28 deletions.
10 changes: 5 additions & 5 deletions energy_demand/enduse_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def __init__(
# ------------------------------------
# Reduction of service because of improvement in air leakeage
# ------------------------------------
tot_s_y_cy, s_tech_y_cy = apply_air_leakage(
tot_s_y_cy = apply_air_leakage(
enduse,
assumptions['strategy_variables'],
assumptions['enduse_overall_change'],
Expand All @@ -298,14 +298,14 @@ def __init__(
base_yr,
curr_yr)

'''s_tech_y_cy = apply_air_leakage(
s_tech_y_cy = apply_air_leakage(
enduse,
assumptions['strategy_variables'],
assumptions['enduse_overall_change'],
s_tech_y_cy,
'service_tech',
base_yr,
curr_yr)'''
curr_yr)

# --------------------------------
# Switches
Expand Down Expand Up @@ -1391,7 +1391,7 @@ def apply_air_leakage(
f_improvement = air_leakage_cy / air_leakage_by

# Apply to technologies each stored in dictionary or array
#if crit_dict == 'service_tech':
if crit_dict == 'service_tech':
service_reduced = {}
for tech, service_tech in service.items():
service_reduced[tech] = service_tech * f_improvement
Expand All @@ -1400,7 +1400,7 @@ def apply_air_leakage(

return service_reduced
except KeyError:
return service,
return service

def apply_scenario_drivers(
submodel,
Expand Down
22 changes: 0 additions & 22 deletions energy_demand/read_write/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,6 @@ def read_national_real_gas_data(path_to_csv):

return national_fuel_data

def map_LAD_2011_2015(lad_data):
"""Map key of LADs of the census data from the year
2011 with the LAD keys from the year 2015
"""
key_dict = {

# LAD 2011 #LAD 2015
'': '',
}
mapped_LADs = {}
for lad_id, data in lad_data.items():

# Lads with different lad id
try:
mapped_lad_id = key_dict[lad_id]
except KeyError:
mapped_lad_id = lad_id

mapped_LADs[mapped_lad_id] = data

return mapped_LADs

def virtual_building_datasets(regions, all_sectors, local_paths, base_yr=2015):
"""Load necessary data for virtual building stock
in case the link to the building stock model in
Expand Down
39 changes: 38 additions & 1 deletion energy_demand/validation/lad_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,27 @@
from energy_demand.profiles import load_profile
from energy_demand.plotting import plotting_styles

def map_LAD_2011_2015(lad_data):
"""Map key of LADs of the census data from the year
2011 with the LAD keys from the year 2015
"""
key_dict = {

# LAD 2011 #LAD 2015
'': '',
}
mapped_LADs = {}
for lad_id, data in lad_data.items():

# Lads with different lad id
try:
mapped_lad_id = key_dict[lad_id]
except KeyError:
mapped_lad_id = lad_id

mapped_LADs[mapped_lad_id] = data

return mapped_LADs
def temporal_validation(
local_paths,
elec_ed_fueltype_national_yh,
Expand Down Expand Up @@ -115,7 +136,16 @@ def tempo_spatial_validation(
):
"""Validate national hourly demand for yearls fuel
for all LADs. Test how the national disaggregation
works
works.
Info
-----
Because the floor area is only availabe for LADs from 2001,
the LADs are converted to 2015 LADs.
* missing S12000013 (Na h-Eileanan Siar) and S12000027 (Shetland Islands)
* E41000324 (City of London, Westminster) splits to E09000001 (City of London) and E09000033 (Westminster)
* E41000052 (Cornwall, Isles of Scilly) splits to E06000052 (Cornwall) and E06000053 (Isles of Scilly) (edited)
"""
logging.info("... spatial validation")

Expand Down Expand Up @@ -152,6 +182,13 @@ def tempo_spatial_validation(
subnational_gas = data_loader.read_national_real_gas_data(
paths['path_val_subnational_gas'])


# Remap demands between 2011 and 2015 LADs
#subnational_elec = map_LAD_2011_2015(subnational_elec)
#asubnational_gas = map_LAD_2011_2015(subnational_gas)¨
#subnational_gas = map_LAD_2011_2015(subnational_gas)
#subnational_gas = map_LAD_2011_2015(subnational_gas)

logging.info("Validation of electricity")
spatial_validation(
reg_coord,
Expand Down

0 comments on commit acc0651

Please sign in to comment.