Add comments

This commit is contained in:
Alireza Adli 2024-10-13 12:13:14 -04:00
parent 79c27244e6
commit 3a1f418577

View File

@ -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: <class 'int'>
:return: <class 'str'>
"""
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: <class 'str'>
:param component_type: <class 'str'>
:return: <class 'dict'>
"""
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: <class 'str'>
:return: <class 'float'>
"""
return self.materials[f'{material_name}']
def search_transparent_surfaces(