From 3a1f418577b6266867a0d5d18ef9da8a5494dd84 Mon Sep 17 00:00:00 2001 From: Alireza Adli Date: Sun, 13 Oct 2024 12:13:14 -0400 Subject: [PATCH] Add comments --- .../access_nrcan_catalogue.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/hub/city_model_structure/life_cycle_assessment/access_nrcan_catalogue.py b/hub/city_model_structure/life_cycle_assessment/access_nrcan_catalogue.py index f22cc11e..358440e1 100644 --- a/hub/city_model_structure/life_cycle_assessment/access_nrcan_catalogue.py +++ b/hub/city_model_structure/life_cycle_assessment/access_nrcan_catalogue.py @@ -23,6 +23,21 @@ class AccessNrcanCatalog: constructions='nrcan_constructions_cap_3.json', materials='nrcan_materials_dictionaries.json', transparent_surfaces='nrcan_transparent_surfaces_dictionaries.json'): + """ + AccessNrcanCatalog eases accessing the below json files. + - It converts year of construction to the period of construction. + - It searches a specific material or transparent surface. + - The class finds the opaque surface code based on three parameters. + :param path: path to the below files + :param archetypes: a json file (a list of dictionaries) with building + archetypes' data + :param constructions: a json file (a list of dictionaries) with + building data based on NRCan + :param materials: a json file (a dictornaty of + dictionares to speed up the search) with construction material info. + :param transparent_surfaces: a json file (a dictionary of + dictionaries) with windows and skylights data. + """ self._path = Path(path) self.archetypes = archetypes self.constructions = constructions @@ -73,6 +88,11 @@ class AccessNrcanCatalog: @staticmethod def year_to_period_of_construction(year_of_construction): + """ + Converts year of construction to the period of construction. + :param year_of_construction: + :return: + """ period_of_construction = None if 1000 <= year_of_construction <= 1900: period_of_construction = '1000_1900' @@ -107,6 +127,13 @@ class AccessNrcanCatalog: return period_of_construction def layers(self, opaque_surface_code, component_type): + """ + Returns the corresponding layers of a specific opaque surface + and the component type. + :param opaque_surface_code: + :param component_type: + :return: + """ for opaque_surface in self.constructions['opaque_surfaces']: opaque_surface_key = list(opaque_surface)[0] if opaque_surface_key != opaque_surface_code: @@ -115,6 +142,11 @@ class AccessNrcanCatalog: return opaque_surface[opaque_surface_key]['layers'] def search_materials(self, material_name): + """ + Brings up the material's embodied carbon based on material's name + :param material_name: + :return: + """ return self.materials[f'{material_name}'] def search_transparent_surfaces(