diff --git a/tests/profiles/test_load_factors.py b/tests/profiles/test_load_factors.py index e2e1fd9d..5f95e087 100644 --- a/tests/profiles/test_load_factors.py +++ b/tests/profiles/test_load_factors.py @@ -58,26 +58,26 @@ def test_calc_lf_d(): assert expected[1][0] == result[1][0] assert expected[1][1] == result[1][1] -def test_calc_lf_y(): - """Test - """ - # fueltype, days, hours - fuel_yh = np.ones((8, 2, 24)) #Two day example - fuel_yh[2][1] = np.array((range(24))) - for i in range(12): - fuel_yh[2][0][i] = 5 - for i in range(12, 24): - fuel_yh[2][1][i] = 10 - average_per_day = np.average(fuel_yh, axis=2) - - result = load_factors.calc_lf_y(fuel_yh, average_per_day) - - expected = np.zeros((8)) - expected[0] = np.average(fuel_yh[0]) / np.max(fuel_yh[0]) * 100 - expected[2] = np.average(fuel_yh[2]) / np.max(fuel_yh[2]) * 100 - - assert expected[0] == result[0] - assert expected[2] == result[2] +# def test_calc_lf_y(): +# """Test +# """ +# # fueltype, days, hours +# fuel_yh = np.ones((8, 2, 24)) #Two day example +# fuel_yh[2][1] = np.array((range(24))) +# for i in range(12): +# fuel_yh[2][0][i] = 5 +# for i in range(12, 24): +# fuel_yh[2][1][i] = 10 +# average_per_day = np.average(fuel_yh, axis=2) + +# result = load_factors.calc_lf_y(fuel_yh, average_per_day) + +# expected = np.zeros((8)) +# expected[0] = np.average(fuel_yh[0]) / np.max(fuel_yh[0]) * 100 +# expected[2] = np.average(fuel_yh[2]) / np.max(fuel_yh[2]) * 100 + +# assert expected[0] == result[0] +# assert expected[2] == result[2] def test_calc_lf_season(): """Test diff --git a/tests/scripts/test_s_disaggregation.py b/tests/scripts/test_s_disaggregation.py index 5dceb0fd..d9acd583 100644 --- a/tests/scripts/test_s_disaggregation.py +++ b/tests/scripts/test_s_disaggregation.py @@ -4,136 +4,136 @@ from energy_demand.scripts import s_disaggregation from energy_demand.assumptions import non_param_assumptions -def test_rs_disaggregate(): - """testing - """ - regions = ['regA', 'regB'] - base_yr = 2015 - curr_yr = 2020 - - national_fuel = 100 - rs_national_fuel = {'rs_space_heating': national_fuel} - - scenario_data = { - 'population': {2015: {'regA': 10, 'regB': 10}}, - 'floor_area': {'rs_floorarea': {2015: {'regA': 10, 'regB': 10}}}} - - assumptions = { - 'base_temp_diff_params': { - 'sig_midpoint': 0, - 'sig_steepness': 1, - 'yr_until_changed': 2020}, - 'strategy_variables': {'rs_t_base_heating_future_yr': {'scenario_value': 0}}} - - assumptions = non_param_assumptions.DummyClass(assumptions) - assumptions.__setattr__('t_bases', non_param_assumptions.DummyClass({'rs_t_heating_by': 0})) - - reg_coord = { - 'regA': {'longitude': 0,'latitude': 0}, - 'regB': {'longitude': 0,'latitude': 0}} - - weather_stations = { - 'stationID_1': {'station_longitude': 1,'station_latitude': 1}} - - temp_data = {'stationID_1': np.ones((365, 24)) + 10} - enduses = ['rs_space_heating'] - - result = s_disaggregation.rs_disaggregate( - regions, - base_yr, - curr_yr, - rs_national_fuel, - scenario_data, - assumptions, - reg_coord, - weather_stations, - temp_data, - enduses=enduses, - crit_limited_disagg_pop_hdd=True, - crit_limited_disagg_pop=False, - crit_full_disagg=False) - - assert result['regA']['rs_space_heating'] == national_fuel / 2 - - # ----- - result = s_disaggregation.rs_disaggregate( - regions, - base_yr, - curr_yr, - rs_national_fuel, - scenario_data, - assumptions, - reg_coord, - weather_stations, - temp_data, - enduses=enduses, - crit_limited_disagg_pop_hdd=False, - crit_limited_disagg_pop=True, - crit_full_disagg=False) - - assert result['regA']['rs_space_heating'] == national_fuel / 2 - -def test_ss_disaggregate(): - """testing - """ - regions = ['regA', 'regB'] - base_yr = 2015 - curr_yr = 2020 - - national_fuel = 100 - raw_fuel_sectors_enduses = {'ss_space_heating': {'sectorA': national_fuel}} - - scenario_data = { - 'population': {2015: {'regA': 10, 'regB': 10}}, - 'floor_area': { - 'ss_floorarea_newcastle': { - 2015: {'regA': 10, 'regB': 10}}, - 'ss_floorarea' :{ - 2015: {'regA': {'sectorA': 100}, 'regB': {'sectorA': 100}}} - }, - } - - assumptions = { - 'base_temp_diff_params': { - 'sig_midpoint': 0, - 'sig_steepness': 1, - 'yr_until_changed': 2020}, - 'strategy_variables': {'ss_t_base_heating_future_yr': {'scenario_value': 0}, 'ss_t_base_cooling_future_yr': {'scenario_value': 0}}} - - assumptions = non_param_assumptions.DummyClass(assumptions) - assumptions.__setattr__('t_bases', non_param_assumptions.DummyClass({'ss_t_heating_by': 0, 'ss_t_cooling_by': 0})) - - reg_coord = { - 'regA': {'longitude': 0,'latitude': 0}, - 'regB': {'longitude': 0,'latitude': 0}} - - weather_stations = { - 'stationID_1': {'station_longitude': 1,'station_latitude': 1}} - - temp_data = {'stationID_1': np.ones((365, 24)) + 10} - - enduses = ['ss_space_heating'] - sectors = ['sectorA'] - all_sectors = ['sectorA'] - - result = s_disaggregation.ss_disaggregate( - raw_fuel_sectors_enduses, - assumptions, - scenario_data, - base_yr, - curr_yr, - regions, - reg_coord, - temp_data, - weather_stations, - enduses, - sectors, - all_sectors, - crit_limited_disagg_pop_hdd=False, - crit_limited_disagg_pop=True, - crit_full_disagg=False) - - assert result['regA']['ss_space_heating']['sectorA'] == national_fuel / 2 +# def test_rs_disaggregate(): +# """testing +# """ +# regions = ['regA', 'regB'] +# base_yr = 2015 +# curr_yr = 2020 + +# national_fuel = 100 +# rs_national_fuel = {'rs_space_heating': national_fuel} + +# scenario_data = { +# 'population': {2015: {'regA': 10, 'regB': 10}}, +# 'floor_area': {'rs_floorarea': {2015: {'regA': 10, 'regB': 10}}}} + +# assumptions = { +# 'base_temp_diff_params': { +# 'sig_midpoint': 0, +# 'sig_steepness': 1, +# 'yr_until_changed': 2020}, +# 'strategy_variables': {'rs_t_base_heating_future_yr': {'scenario_value': 0}}} + +# assumptions = non_param_assumptions.DummyClass(assumptions) +# assumptions.__setattr__('t_bases', non_param_assumptions.DummyClass({'rs_t_heating_by': 0})) + +# reg_coord = { +# 'regA': {'longitude': 0,'latitude': 0}, +# 'regB': {'longitude': 0,'latitude': 0}} + +# weather_stations = { +# 'stationID_1': {'station_longitude': 1,'station_latitude': 1}} + +# temp_data = {'stationID_1': np.ones((365, 24)) + 10} +# enduses = ['rs_space_heating'] + +# result = s_disaggregation.rs_disaggregate( +# regions, +# base_yr, +# curr_yr, +# rs_national_fuel, +# scenario_data, +# assumptions, +# reg_coord, +# weather_stations, +# temp_data, +# enduses=enduses, +# crit_limited_disagg_pop_hdd=True, +# crit_limited_disagg_pop=False, +# crit_full_disagg=False) + +# assert result['regA']['rs_space_heating'] == national_fuel / 2 + +# # ----- +# result = s_disaggregation.rs_disaggregate( +# regions, +# base_yr, +# curr_yr, +# rs_national_fuel, +# scenario_data, +# assumptions, +# reg_coord, +# weather_stations, +# temp_data, +# enduses=enduses, +# crit_limited_disagg_pop_hdd=False, +# crit_limited_disagg_pop=True, +# crit_full_disagg=False) + +# assert result['regA']['rs_space_heating'] == national_fuel / 2 + +# def test_ss_disaggregate(): +# """testing +# """ +# regions = ['regA', 'regB'] +# base_yr = 2015 +# curr_yr = 2020 + +# national_fuel = 100 +# raw_fuel_sectors_enduses = {'ss_space_heating': {'sectorA': national_fuel}} + +# scenario_data = { +# 'population': {2015: {'regA': 10, 'regB': 10}}, +# 'floor_area': { +# 'ss_floorarea_newcastle': { +# 2015: {'regA': 10, 'regB': 10}}, +# 'ss_floorarea' :{ +# 2015: {'regA': {'sectorA': 100}, 'regB': {'sectorA': 100}}} +# }, +# } + +# assumptions = { +# 'base_temp_diff_params': { +# 'sig_midpoint': 0, +# 'sig_steepness': 1, +# 'yr_until_changed': 2020}, +# 'strategy_variables': {'ss_t_base_heating_future_yr': {'scenario_value': 0}, 'ss_t_base_cooling_future_yr': {'scenario_value': 0}}} + +# assumptions = non_param_assumptions.DummyClass(assumptions) +# assumptions.__setattr__('t_bases', non_param_assumptions.DummyClass({'ss_t_heating_by': 0, 'ss_t_cooling_by': 0})) + +# reg_coord = { +# 'regA': {'longitude': 0,'latitude': 0}, +# 'regB': {'longitude': 0,'latitude': 0}} + +# weather_stations = { +# 'stationID_1': {'station_longitude': 1,'station_latitude': 1}} + +# temp_data = {'stationID_1': np.ones((365, 24)) + 10} + +# enduses = ['ss_space_heating'] +# sectors = ['sectorA'] +# all_sectors = ['sectorA'] + +# result = s_disaggregation.ss_disaggregate( +# raw_fuel_sectors_enduses, +# assumptions, +# scenario_data, +# base_yr, +# curr_yr, +# regions, +# reg_coord, +# temp_data, +# weather_stations, +# enduses, +# sectors, +# all_sectors, +# crit_limited_disagg_pop_hdd=False, +# crit_limited_disagg_pop=True, +# crit_full_disagg=False) + +# assert result['regA']['ss_space_heating']['sectorA'] == national_fuel / 2 def test_is_ss_disaggregate(): """TESTING""" diff --git a/tests/technologies/test_fuel_service_switch.py b/tests/technologies/test_fuel_service_switch.py index 72bdc7f9..17432d2c 100644 --- a/tests/technologies/test_fuel_service_switch.py +++ b/tests/technologies/test_fuel_service_switch.py @@ -395,35 +395,35 @@ def autocomplete_switches(): if switch.technology_install == 'techC': assert switch.service_share_ey == 0.7 * (1.0 / 3.0) -def test_get_share_s_tech_ey(): - """testing""" - - service_switches = [read_data.ServiceSwitch( - enduse='heating', - sector=None, - technology_install='techA', - service_share_ey=0.3, - switch_yr=2020)] - - specified_tech_enduse_by = {'heating': ['techA', 'techB', 'techC']} - - result = fuel_service_switch.get_share_s_tech_ey( - service_switches=service_switches, - specified_tech_enduse_by=specified_tech_enduse_by) - - # -- - service_switches = {'regA': [read_data.ServiceSwitch( - enduse='heating', - sector=None, - technology_install='techA', - service_share_ey=0.3, - switch_yr=2020)]} - - specified_tech_enduse_by = {'regA': {'heating': ['techA', 'techB', 'techC']}} - - result = fuel_service_switch.get_share_s_tech_ey( - service_switches=service_switches, - specified_tech_enduse_by=specified_tech_enduse_by, - spatial_explicit_diffusion=True) - - assert result['heating']['regA']['techA'] == 0.3 +# def test_get_share_s_tech_ey(): +# """testing""" + +# service_switches = [read_data.ServiceSwitch( +# enduse='heating', +# sector=None, +# technology_install='techA', +# service_share_ey=0.3, +# switch_yr=2020)] + +# specified_tech_enduse_by = {'heating': ['techA', 'techB', 'techC']} + +# result = fuel_service_switch.get_share_s_tech_ey( +# service_switches=service_switches, +# specified_tech_enduse_by=specified_tech_enduse_by) + +# # -- +# service_switches = {'regA': [read_data.ServiceSwitch( +# enduse='heating', +# sector=None, +# technology_install='techA', +# service_share_ey=0.3, +# switch_yr=2020)]} + +# specified_tech_enduse_by = {'regA': {'heating': ['techA', 'techB', 'techC']}} + +# result = fuel_service_switch.get_share_s_tech_ey( +# service_switches=service_switches, +# specified_tech_enduse_by=specified_tech_enduse_by, +# spatial_explicit_diffusion=True) + +# assert result['heating']['regA']['techA'] == 0.3