ebm.model.filter_tek module
- class FilterTek[source]
Bases:
objectUtility class for filtering TEK lists and parameters.
- CATEGORY_APARTMENT = 'apartment_block'
- CATEGORY_HOUSE = 'house'
- COMMERCIAL_BUILDING = 'COM'
- RESIDENTIAL_BUILDING = 'RES'
- PRE_TEK49_APARTMENT = 'PRE_TEK49_RES_1950'
- PRE_TEK49_HOUSE = 'PRE_TEK49_RES_1940'
- static get_filtered_list(building_category: BuildingCategory, building_code_list: List[str]) List[str][source]
Filters the provided TEK list based on the building category.
Parameters: - building_category (BuildingCategory): The category of the building. - building_code_list (List[str]): List of TEK strings to be filtered.
Returns: - filtered_building_code_list (List[str]): Filtered list of TEK strings.
- static get_filtered_params(building_code_list: List[str], building_code_params: Dict[str, TEKParameters]) Dict[str, TEKParameters][source]
Filters the TEK parameters to include only those relevant to the provided TEK list.
This method takes a dictionary of TEK parameters and filters it to include only the parameters for TEKs that are present in the building_code_list. This ensures that only the relevant TEK parameters are retained for use in subsequent calculations.
Parameters: - building_code_list (List[str]): A list of TEK identifiers to filter by. - building_code_params (Dict[str, TEKParameters]): A dictionary where the keys are TEK identifiers
and the values are TEKParameters objects containing the parameters for each TEK.
Returns: - filtered_building_code_params (Dict[str, TEKParameters]): A dictionary containing only the TEK parameters
for the TEKs present in the building_code_list.
- static merge_building_code(df: DataFrame, new_building_code_name: str, old_building_code_names: List[str], aggregates: Dict[str, str] = None) DataFrame[source]
Merge rows in a DataFrame based on specified ‘tek’ names and aggregate their values.
Parameters
- dfpd.DataFrame
The input DataFrame with a MultiIndex.
- new_building_code_namestr
The new ‘tek’ name to assign to the merged rows.
- old_building_code_namestyping.List[str]
A list of ‘tek’ names to be merged.
- aggregatestyping.Dict[str, str], optional
A dictionary specifying the aggregation functions for each column. If not provided, default aggregations will be used: {‘tek’: ‘max’, ‘m2’: ‘first’, ‘kwh_m2’: ‘mean’, ‘energy_requirement’: ‘sum’}.
Returns
- pd.DataFrame
The DataFrame with the specified ‘tek’ rows merged and aggregated.