Example #1
0
def ss_disaggregate(ss_national_fuel, assumptions, scenario_data, base_yr,
                    curr_yr, regions, reg_coord, temp_data, weather_stations,
                    enduses, sectors, all_sectors, crit_limited_disagg_pop_hdd,
                    crit_limited_disagg_pop, crit_full_disagg):
    """Disaggregate fuel for service submodel (per enduse and sector)

    Outputs
    -------
    ss_fuel_disagg : dict
        region, Enduse, Sectors
    """
    logging.debug("... disaggregate service demand")
    ss_fuel_disagg = {}

    # ---------------------------------------
    # Calculate heating degree days for regions
    # ---------------------------------------
    ss_hdd_individ_region = hdd_cdd.get_hdd_country(
        base_yr, curr_yr, regions, temp_data,
        assumptions.base_temp_diff_params,
        assumptions.strategy_variables['ss_t_base_heating_future_yr']
        ['scenario_value'], assumptions.t_bases.ss_t_heating_by, reg_coord,
        weather_stations)

    ss_cdd_individ_region = hdd_cdd.get_cdd_country(
        base_yr, curr_yr, regions, temp_data,
        assumptions.base_temp_diff_params,
        assumptions.strategy_variables['ss_t_base_cooling_future_yr']
        ['scenario_value'], assumptions.t_bases.ss_t_cooling_by, reg_coord,
        weather_stations)

    # ---------------------------------------------
    # Get all regions with missing floor area data
    # ---------------------------------------------
    regions_without_floorarea = get_regions_missing_floor_area_sector(
        regions, scenario_data['floor_area']['ss_floorarea'], base_yr)
    regions_with_floorarea = list(regions)
    for reg in regions_without_floorarea:
        regions_with_floorarea.remove(reg)

    # ---------------------------------------
    # Overall disaggregation factors per enduse and sector
    # ---------------------------------------
    ss_fuel_disagg = ss_disaggr(all_regions=regions,
                                regions=regions_without_floorarea,
                                sectors=sectors,
                                enduses=enduses,
                                all_sectors=all_sectors,
                                base_yr=base_yr,
                                scenario_data=scenario_data,
                                ss_hdd_individ_region=ss_hdd_individ_region,
                                ss_cdd_individ_region=ss_cdd_individ_region,
                                ss_fuel_disagg=ss_fuel_disagg,
                                ss_national_fuel=ss_national_fuel,
                                crit_limited_disagg_pop=False,
                                crit_limited_disagg_pop_hdd=True,
                                crit_full_disagg=False)

    # Substract from national fuel already disaggregated fuel
    ss_national_fuel_remaining = copy.deepcopy(ss_national_fuel)
    for enduse in ss_national_fuel:
        for sector in ss_national_fuel[enduse]:
            for reg in ss_fuel_disagg:
                ss_national_fuel_remaining[enduse][sector] -= ss_fuel_disagg[
                    reg][enduse][sector]

    # Disaggregate with floor area
    ss_fuel_disagg = ss_disaggr(
        all_regions=regions_with_floorarea,
        regions=regions_with_floorarea,
        sectors=sectors,
        enduses=enduses,
        all_sectors=all_sectors,
        base_yr=base_yr,
        scenario_data=scenario_data,
        ss_hdd_individ_region=ss_hdd_individ_region,
        ss_cdd_individ_region=ss_cdd_individ_region,
        ss_fuel_disagg=ss_fuel_disagg,
        ss_national_fuel=ss_national_fuel_remaining,
        crit_limited_disagg_pop=crit_limited_disagg_pop,
        crit_limited_disagg_pop_hdd=crit_limited_disagg_pop_hdd,
        crit_full_disagg=crit_full_disagg)

    # -----------------
    # Check if total fuel is the
    # same before and after aggregation
    #------------------
    testing_functions.control_disaggregation(ss_fuel_disagg, ss_national_fuel,
                                             enduses, sectors)
    logging.debug("... finished disaggregation ss")
    return dict(ss_fuel_disagg)
Example #2
0
def rs_disaggregate(regions, base_yr, curr_yr, rs_national_fuel, scenario_data,
                    assumptions, reg_coord, weather_stations, temp_data,
                    enduses, crit_limited_disagg_pop_hdd,
                    crit_limited_disagg_pop, crit_full_disagg):
    """Disaggregate residential fuel demand

    Arguments
    ----------
    regions : dict
        Regions
    rs_national_fuel : dict
        Fuel per enduse for residential submodel

    Returns
    -------
    rs_fuel_disagg : dict
        Disaggregated fuel per enduse for every region (fuel[region][enduse])

    Note
    -----
    Used disaggregation factors for residential according
    to enduse (see Documentation)
    """
    logging.debug("... disagreggate residential demand")

    rs_fuel_disagg = defaultdict(dict)

    # ---------------------------------------
    # Calculate heating degree days for regions
    # ---------------------------------------
    rs_hdd_individ_region = hdd_cdd.get_hdd_country(
        base_yr, curr_yr, regions, temp_data,
        assumptions.base_temp_diff_params,
        assumptions.strategy_variables['rs_t_base_heating_future_yr']
        ['scenario_value'], assumptions.t_bases.rs_t_heating_by, reg_coord,
        weather_stations)

    # ---------------------------------------
    # Overall disaggregation factors per enduse
    # ---------------------------------------
    # Get all regions with missing floor area data
    regions_without_floorarea = get_regions_missing_floor_area(
        regions, scenario_data['floor_area']['rs_floorarea'], base_yr)
    regions_with_floorarea = list(regions)
    for reg in regions_without_floorarea:
        regions_with_floorarea.remove(reg)

    logging.info("Regions with no floor area: %s", regions_without_floorarea)

    # ====================================
    # Disaggregate for region without floor area with population
    # ====================================
    rs_fuel_disagg = rs_disaggr(all_regions=regions,
                                regions=regions_without_floorarea,
                                base_yr=base_yr,
                                rs_hdd_individ_region=rs_hdd_individ_region,
                                scenario_data=scenario_data,
                                rs_fuel_disagg=rs_fuel_disagg,
                                rs_national_fuel=rs_national_fuel,
                                crit_limited_disagg_pop=False,
                                crit_limited_disagg_pop_hdd=True,
                                crit_full_disagg=False)

    # Substract from national fuel already disaggregated fuel
    rs_national_fuel_remaining = copy.deepcopy(rs_national_fuel)
    for enduse in rs_national_fuel:
        for reg in rs_fuel_disagg:
            rs_national_fuel_remaining[enduse] = rs_national_fuel_remaining[
                enduse] - rs_fuel_disagg[reg][enduse]

    # ====================================
    # Disaggregate for region with floor area
    # ====================================
    rs_fuel_disagg = rs_disaggr(
        all_regions=regions_with_floorarea,
        regions=regions_with_floorarea,
        base_yr=base_yr,
        rs_hdd_individ_region=rs_hdd_individ_region,
        scenario_data=scenario_data,
        rs_fuel_disagg=rs_fuel_disagg,
        rs_national_fuel=rs_national_fuel_remaining,
        crit_limited_disagg_pop=crit_limited_disagg_pop,
        crit_limited_disagg_pop_hdd=crit_limited_disagg_pop_hdd,
        crit_full_disagg=crit_full_disagg)

    # -----------------
    # Check if total fuel is the same before and after aggregation
    #------------------
    testing_functions.control_disaggregation(rs_fuel_disagg, rs_national_fuel,
                                             enduses)

    return rs_fuel_disagg
Example #3
0
def is_disaggregate(base_yr, is_national_fuel, regions, enduses, sectors,
                    employment_statistics, scenario_data,
                    crit_limited_disagg_pop, crit_full_disagg):
    """Disaggregate industry related fuel for sector and enduses with
    employment statistics

    base_yr : int
        Base year
    is_national_fuel : dict
        Fuel
    regions : list
        Regions
    enduses : list
        Enduses
    sectors : list
        Sectors
    employment_statistics : dict
        Employment statistics
    scenario_data : dict
        Scenario data
    crit_limited_disagg_pop : bool
        Criteria which diassgregation method
    crit_full_disagg : bool
        Criteria which diassgregation method

    Returns
    ---------
    is_fuel_disagg : dict
        reg, enduse, sector
    """
    logging.debug("... disaggregate industry demand")

    is_fuel_disagg = {}
    if crit_limited_disagg_pop and not crit_full_disagg:

        # ---
        # Disaggregate only with population
        # ---
        tot_pop = 0
        for reg in regions:
            tot_pop += scenario_data['population'][base_yr][reg]

        for region in regions:
            is_fuel_disagg[region] = {}
            reg_pop = scenario_data['population'][base_yr][region]

            reg_disagg_f = reg_pop / tot_pop

            for enduse in enduses:
                is_fuel_disagg[region][enduse] = {}
                for sector in sectors:
                    is_fuel_disagg[region][enduse][sector] = is_national_fuel[
                        enduse][sector] * reg_disagg_f

        return is_fuel_disagg

    if crit_full_disagg:
        #logging.debug(" ... Disaggregation is: Employment statistics")

        # Calculate total population of all regions
        tot_pop = sum(scenario_data['population'][base_yr].values())

        # -----
        # Disaggregate with employment statistics
        # The BEIS sectors are matched with census data sectors {ECUK industry sectors: 'Emplyoment sectors'}
        sectormatch_ecuk_with_census = {

            # Significant improvement
            'mining': 'B',
            'food_production': 'C10-12',
            'pharmaceuticals': 'M',
            'computer': 'C26-30',
            'leather': 'C13-15',
            'wearing_appeal': 'C13-15',

            # Improvement
            'basic_metals': 'C',
            'non_metallic_mineral_products': 'C',
            'electrical_equipment': 'C26-30',
            'printing': 'C',
            'rubber_plastics': 'C19-22',
            'chemicals': 'C19-22',
            'wood': 'C16,17',
            'paper': 'C16,17',

            # Worse and better
            'fabricated_metal_products':
            'C',  # Gas better, elec worse test C23-25  previous 'C'
            'textiles': 'C13-15',  # Gas better, elec worse
            'motor_vehicles': 'G',  # Gas better, elec worse

            # Indifferent
            'machinery': None,  # 'C'
            'tobacco': None,  # 'C10-12'
            'other_transport_equipment': None,  # 'H'
            'other_manufacturing': None,  # 'C18,31,32'
            'water_collection_treatment': None,  # 'E'
            'waste_collection': None,  # 'E'
            'furniture': None,  # C18,31,32'

            # Worse
            'beverages': None  # 'C10-12'
        }

        # ----------------------------------------
        # Summarise national employment per sector
        # ----------------------------------------
        # Initialise dict
        tot_national_sector_employment = {}
        for sectors_reg in employment_statistics.values():
            for sector in sectors_reg:
                tot_national_sector_employment[sector] = 0
            continue
        for reg in regions:
            for employment_sector, employment in employment_statistics[
                    reg].items():
                tot_national_sector_employment[employment_sector] += employment

        # --------------------------------------------------
        # Disaggregate per region with employment statistics
        # --------------------------------------------------
        for region in regions:
            is_fuel_disagg[region] = {}

            # Iterate sector
            for enduse in enduses:
                is_fuel_disagg[region][enduse] = {}

                for sector in sectors:

                    # ---------------------------------
                    # Try to match  with sector, otherwise disaggregate with population
                    # ----------------------------------
                    matched_sector = sectormatch_ecuk_with_census[sector]

                    # Disaggregate with population
                    if not matched_sector:
                        reg_pop = scenario_data['population'][base_yr][region]
                        reg_disag_factor = reg_pop / tot_pop

                        is_fuel_disagg[region][enduse][
                            sector] = is_national_fuel[enduse][
                                sector] * reg_disag_factor
                    else:
                        #for enduse in enduses['is_enduses']:
                        national_sector_employment = tot_national_sector_employment[
                            matched_sector]
                        reg_sector_employment = employment_statistics[region][
                            matched_sector]

                        try:
                            reg_disag_factor = reg_sector_employment / national_sector_employment
                        except ZeroDivisionError:
                            reg_disag_factor = 0  #No employment for this sector for this region

                        # Disaggregated national fuel
                        is_fuel_disagg[region][enduse][
                            sector] = is_national_fuel[enduse][
                                sector] * reg_disag_factor

    # TESTING Check if total fuel is the same before and after aggregation
    testing_functions.control_disaggregation(is_fuel_disagg, is_national_fuel,
                                             enduses, sectors)

    logging.debug("... finished disaggregateing industry demand")
    return is_fuel_disagg
Example #4
0
def rs_disaggregate(
        regions,
        rs_national_fuel,
        scenario_data,
        pop_for_disagg,
        assumptions,
        reg_coord,
        weather_stations,
        temp_data,
        enduses,
        crit_limited_disagg_pop_hdd,
        crit_limited_disagg_pop,
        crit_full_disagg,
        crit_temp_min_max=False,
        dummy_sector=None
    ):
    """Disaggregate residential fuel demand

    Arguments
    ----------
    regions : dict
        Regions
    rs_national_fuel : dict
        Fuel per enduse for residential submodel

    Returns
    -------
    rs_fuel_disagg : dict
        Disaggregated fuel per enduse for every region (fuel[region][enduse])

    Note
    -----
    Used disaggregation factors for residential according
    to enduse (see Documentation)
    """
    logging.debug("... disagreggate residential demand")

    rs_fuel_disagg = {}
    # ---------------------------------------
    # Calculate heating degree days for regions
    # ---------------------------------------
    rs_hdd_individ_region = hdd_cdd.get_hdd_country(
        t_base_heating=assumptions.t_bases.rs_t_heating,
        regions=regions,
        temp_data=temp_data,
        reg_coord=reg_coord,
        weather_stations=weather_stations,
        crit_temp_min_max=crit_temp_min_max)

    # ---------------------------------------
    # Get all regions with  floor area data
    # ---------------------------------------
    regions_with_floorarea = list(regions)
    for reg in assumptions.rs_regions_without_floorarea:
        regions_with_floorarea.remove(reg)

    # ====================================
    # Disaggregate for region without floor
    # area by population and hdd (set crit_full_disagg as False)
    # ====================================
    rs_fuel_regions = rs_disaggr(
        all_regions=regions,
        regions=assumptions.rs_regions_without_floorarea,
        base_yr=assumptions.base_yr,
        rs_hdd_individ_region=rs_hdd_individ_region,
        scenario_data=scenario_data,
        pop_for_disagg=pop_for_disagg,
        rs_national_fuel=rs_national_fuel,
        crit_limited_disagg_pop=False, #True, #False,
        crit_limited_disagg_pop_hdd=True, #True, #Set to true
        crit_full_disagg=False,
        dummy_sector=dummy_sector)
    rs_fuel_disagg.update(rs_fuel_regions)

    # Substract fuel for regions where only population was used for disaggregation from total
    rs_national_fuel_remaining = copy.deepcopy(rs_national_fuel)
    for enduse in rs_national_fuel:
        for reg in rs_fuel_disagg:
            rs_national_fuel_remaining[enduse][dummy_sector] -= rs_fuel_disagg[reg][enduse][dummy_sector]

    # ====================================
    # Disaggregate for region with floor area
    # ====================================
    rs_fuel_disagg_full_data = rs_disaggr(
        all_regions=regions_with_floorarea,
        regions=regions_with_floorarea,
        base_yr=assumptions.base_yr,
        rs_hdd_individ_region=rs_hdd_individ_region,
        scenario_data=scenario_data,
        pop_for_disagg=pop_for_disagg,
        rs_national_fuel=rs_national_fuel_remaining,
        crit_limited_disagg_pop=crit_limited_disagg_pop,
        crit_limited_disagg_pop_hdd=crit_limited_disagg_pop_hdd,
        crit_full_disagg=crit_full_disagg,
        dummy_sector=dummy_sector)
    rs_fuel_disagg.update(rs_fuel_disagg_full_data)

    # Check if total fuel is the same before and after aggregation
    testing_functions.control_disaggregation(
        rs_fuel_disagg, rs_national_fuel, enduses, [dummy_sector])

    return rs_fuel_disagg
Example #5
0
def is_disaggregate(
        assumptions,
        temp_data,
        reg_coord,
        weather_stations,
        is_national_fuel,
        regions,
        enduses,
        sectors,
        employment_statistics,
        pop_for_disagg,
        census_disagg,
        crit_temp_min_max=False
    ):
    """Disaggregate industry related fuel for sector and enduses with
    employment statistics

    base_yr : int
        Base year
    is_national_fuel : dict
        Fuel
    regions : list
        Regions
    enduses : list
        Enduses
    sectors : list
        Sectors
    employment_statistics : dict
        Employment statistics
    crit_limited_disagg_pop : bool
        Criteria which diassgregation method
    crit_full_disagg : bool
        Criteria which diassgregation method

    Returns
    ---------
    is_fuel_disagg : dict
        reg, enduse, sector
    """
    is_hdd_individ_region = hdd_cdd.get_hdd_country(
        t_base_heating=assumptions.t_bases.is_t_heating,
        regions=regions,
        temp_data=temp_data,
        reg_coord=reg_coord,
        weather_stations=weather_stations,
        crit_temp_min_max=crit_temp_min_max)

    is_fuel_disagg = {}

    # # Calculate total population of all regions
    tot_pop = 0
    tot_pop_hdd = 0
    for region in regions:
        tot_pop_hdd += pop_for_disagg[assumptions.base_yr][region] * is_hdd_individ_region[region]
        tot_pop += pop_for_disagg[assumptions.base_yr][region]

    if not census_disagg:

        # ---
        # Disaggregate only with population
        # ---
        for region in regions:
            is_fuel_disagg[region] = {}

            reg_pop = pop_for_disagg[assumptions.base_yr][region]

            for enduse in enduses:
                is_fuel_disagg[region][enduse] = {}

                for sector in sectors:
                    if enduse == 'is_space_heating':
                        hdd_reg = is_hdd_individ_region[region]
                        reg_disagg_f = (hdd_reg * reg_pop) / tot_pop_hdd
                        is_fuel_disagg[region][enduse][sector] = is_national_fuel[enduse][sector] * reg_disagg_f
                    else:
                        reg_disagg_f = reg_pop / tot_pop
                        is_fuel_disagg[region][enduse][sector] = is_national_fuel[enduse][sector] * reg_disagg_f

        return is_fuel_disagg

    else:
        #logging.debug(" ... Disaggregation is: Employment statistics")
        # -----
        # Disaggregate with employment statistics
        # The BEIS sectors are matched with census data sectors {ECUK industry sectors: 'Emplyoment sectors'}
        sectormatch_ecuk_with_census = {

            # Significant improvement
            'mining': 'B', #'B',
            'food_production': 'C10-12',
            'pharmaceuticals': 'M',
            'computer': 'C26-30',
            'leather': 'C13-15',
            'wearing_appeal': 'C13-15',

            # Improvement
            'basic_metals': 'C',
            'non_metallic_mineral_products': 'C',
            'electrical_equipment': 'C26-30',
            'printing': 'C',
            'rubber_plastics': 'C19-22',
            'chemicals': 'C19-22',
            'wood': 'C16,17',
            'paper': 'C16,17',

            # Worse and better
            'fabricated_metal_products': 'C',   # Gas better, elec worse test C23-25  previous 'C'
            'textiles': 'C13-15',               # Gas better, elec worse
            'motor_vehicles': 'G',              # Gas better, elec worse

            # Unclear
            'machinery': None,                  # 'C'
            'tobacco': None,                    # 'C10-12'
            'other_transport_equipment': None,  # 'H'
            'other_manufacturing': None,        # 'C18,31,32'
            'water_collection_treatment': None, # 'E'
            'waste_collection': None,           # 'E'
            'furniture': None,                  # C18,31,32
            'beverages': None
        }
        # ----------------------------------------
        # Summarise national employment per sector
        # ----------------------------------------
        tot_national_sector_employment = {}
        tot_national_sector_employment_hdd = {}
        for region in regions:
            is_hdd = is_hdd_individ_region[region]

            # -------------------------------------------------------------------
            # In case MSOA are provided as input, the corresponing LAD is searched
            # -------------------------------------------------------------------
            region_remapped = replace_msoa_reg_with_lad(region)

            for employment_sector, employment in employment_statistics[region_remapped].items():
                try:
                    tot_national_sector_employment[employment_sector] += employment
                    tot_national_sector_employment_hdd[employment_sector] += employment * is_hdd
                except KeyError:
                    tot_national_sector_employment[employment_sector] = employment
                    tot_national_sector_employment_hdd[employment_sector] = employment * is_hdd

        # --------------------------------------------------
        # Disaggregate per region with employment statistics
        # --------------------------------------------------
        for region in regions:
            is_fuel_disagg[region] = {}
            reg_pop = pop_for_disagg[assumptions.base_yr][region]

            for enduse in enduses:
                is_fuel_disagg[region][enduse] = {}

                for sector in sectors:

                    # ---------------------------------
                    # Try to match  with sector, otherwise disaggregate with population
                    # ----------------------------------
                    matched_sector = sectormatch_ecuk_with_census[sector]

                    # Disaggregate with population
                    if not matched_sector:

                        if enduse == 'is_space_heating':
                            hdd_reg = is_hdd_individ_region[region]
                            reg_disagg_f = (hdd_reg * reg_pop) / tot_pop_hdd
                            is_fuel_disagg[region][enduse][sector] = is_national_fuel[enduse][sector] * reg_disagg_f
                        else:
                            reg_disagg_f = reg_pop / tot_pop
                            is_fuel_disagg[region][enduse][sector] = is_national_fuel[enduse][sector] * reg_disagg_f
                    else:
                        # -------------------------------------------------------------------
                        # In case MSOA are provided as input, the corresponing LAD is searched
                        # -------------------------------------------------------------------
                        region_remapped = replace_msoa_reg_with_lad(region)

                        reg_sector_employment = employment_statistics[region_remapped][matched_sector]

                        if enduse == 'is_space_heating':
                            national_sector_employment_hdd = tot_national_sector_employment_hdd[matched_sector]
                            hdd_reg = is_hdd_individ_region[region]
                            reg_disagg_f = (hdd_reg * reg_sector_employment) / national_sector_employment_hdd
                        else:
                            national_sector_employment = tot_national_sector_employment[matched_sector]
                            try:
                                reg_disagg_f = reg_sector_employment / national_sector_employment
                            except ZeroDivisionError:
                                reg_disagg_f = 0 #No employment for this sector for this region

                        # If nan, use population
                        if np.isnan(reg_disagg_f):
                            reg_disagg_f = reg_pop / tot_pop
                        else:
                            pass

                        # Disaggregated national fuel
                        is_fuel_disagg[region][enduse][sector] = is_national_fuel[enduse][sector] * reg_disagg_f

    testing_functions.control_disaggregation(
        is_fuel_disagg,
        is_national_fuel,
        enduses,
        sectors)

    logging.debug("... finished disaggregateing industry demand")
    return is_fuel_disagg
Example #6
0
def ss_disaggregate(
        ss_national_fuel,
        service_building_count,
        assumptions,
        scenario_data,
        pop_for_disagg,
        regions,
        reg_coord,
        temp_data,
        weather_stations,
        enduses,
        sectors,
        crit_limited_disagg_pop_hdd,
        crit_limited_disagg_pop,
        crit_full_disagg,
        crit_temp_min_max=False
    ):
    """Disaggregate fuel for service submodel (per enduse and sector)

    Outputs
    -------
    ss_fuel_disagg : dict
        region, Enduse, Sectors
    """
    logging.debug("... disaggregate service demand")
    ss_fuel_disagg = {}

    # ---------------------------------------
    # Calculate heating degree days for regions
    # ---------------------------------------
    ss_hdd_individ_region = hdd_cdd.get_hdd_country(
        t_base_heating=assumptions.t_bases.ss_t_heating,
        regions=regions,
        temp_data=temp_data,
        reg_coord=reg_coord,
        weather_stations=weather_stations,
        crit_temp_min_max=crit_temp_min_max)

    ss_cdd_individ_region = hdd_cdd.get_cdd_country(
        t_base_cooling=assumptions.t_bases.ss_t_cooling,
        regions=regions,
        temp_data=temp_data,
        reg_coord=reg_coord,
        weather_stations=weather_stations,
        crit_temp_min_max=crit_temp_min_max)

    # ---------------------------------------------
    # Get all regions with floor area data
    # ---------------------------------------------
    regions_with_floorarea = list(regions)
    for reg in assumptions.ss_regions_without_floorarea:
        regions_with_floorarea.remove(reg)

    # ---------------------------------------
    # Overall disaggregation factors per enduse and sector
    # ---------------------------------------
    ss_fuel_disagg = {}
    ss_fuel_disagg_only_pop = ss_disaggr(
        all_regions=regions,
        regions=assumptions.ss_regions_without_floorarea,
        sectors=sectors,
        enduses=enduses,
        base_yr=assumptions.base_yr,
        scenario_data=scenario_data,
        pop_for_disagg=pop_for_disagg,
        service_building_count=service_building_count,
        ss_hdd_individ_region=ss_hdd_individ_region,
        ss_cdd_individ_region=ss_cdd_individ_region,
        ss_national_fuel=ss_national_fuel,
        crit_limited_disagg_pop=False,      # Set to False
        crit_limited_disagg_pop_hdd=True,   # Set to True
        crit_full_disagg=False)
    ss_fuel_disagg.update(ss_fuel_disagg_only_pop)

    # Substract from national fuel already disaggregated fuel
    ss_national_fuel_remaining = copy.deepcopy(ss_national_fuel)
    for enduse in ss_national_fuel:
        for sector in ss_national_fuel[enduse]:
            for reg in ss_fuel_disagg:
                ss_national_fuel_remaining[enduse][sector] -= ss_fuel_disagg[reg][enduse][sector]

    # Disaggregate with floor area
    ss_fuel_disagg_full_data = ss_disaggr(
        all_regions=regions_with_floorarea,
        regions=regions_with_floorarea,
        sectors=sectors,
        enduses=enduses,
        base_yr=assumptions.base_yr,
        scenario_data=scenario_data,
        pop_for_disagg=pop_for_disagg,
        service_building_count=service_building_count,
        ss_hdd_individ_region=ss_hdd_individ_region,
        ss_cdd_individ_region=ss_cdd_individ_region,
        ss_national_fuel=ss_national_fuel_remaining,
        crit_limited_disagg_pop=crit_limited_disagg_pop,
        crit_limited_disagg_pop_hdd=crit_limited_disagg_pop_hdd,
        crit_full_disagg=crit_full_disagg)
    ss_fuel_disagg.update(ss_fuel_disagg_full_data)

    # -----------------
    # Check if total fuel is the same before and after aggregation
    #------------------
    testing_functions.control_disaggregation(
        ss_fuel_disagg, ss_national_fuel, enduses, sectors)

    return dict(ss_fuel_disagg)