Add parameters and default parameters to the constructor & add calculate_emission
This commit is contained in:
parent
e6e39020b2
commit
03c0cdd853
BIN
__pycache__/lca_carbon_workflow.cpython-310.pyc
Normal file
BIN
__pycache__/lca_carbon_workflow.cpython-310.pyc
Normal file
Binary file not shown.
|
@ -7,7 +7,6 @@ Code contributors: Alireza Adli alireza.adli@concordia.ca
|
||||||
Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
|
Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import glob
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from hub.imports.geometry_factory import GeometryFactory
|
from hub.imports.geometry_factory import GeometryFactory
|
||||||
|
@ -16,21 +15,31 @@ from hub.helpers.dictionaries import Dictionaries
|
||||||
|
|
||||||
|
|
||||||
class LCACarbonWorkflow:
|
class LCACarbonWorkflow:
|
||||||
def __init__(self, city_path):
|
def __init__(
|
||||||
file_path = (Path(__file__).parent / 'input_files' / city_path)
|
self,
|
||||||
out_path = (Path(__file__).parent / 'out_files')
|
city_path,
|
||||||
|
catalogue_path,
|
||||||
|
catalogue='nrcan',
|
||||||
|
building_parameters=('height', 'year_of_construction', 'function')):
|
||||||
|
self.file_path = (Path(__file__).parent / 'input_files' / city_path)
|
||||||
|
self.catalogue_path = (Path(__file__).parent / 'input_files' / catalogue_path)
|
||||||
|
self.out_path = (Path(__file__).parent / 'out_files')
|
||||||
|
self.handler = catalogue
|
||||||
|
self.height, self.year_of_construction, self.function = \
|
||||||
|
building_parameters
|
||||||
|
|
||||||
print('[simulation start]')
|
print('[simulation start]')
|
||||||
city = GeometryFactory('geojson',
|
|
||||||
path=file_path,
|
self.city = GeometryFactory(
|
||||||
height_field='height',
|
'geojson',
|
||||||
year_of_construction_field='year_of_construction',
|
path=self.file_path,
|
||||||
function_field='function',
|
height_field=self.height,
|
||||||
|
year_of_construction_field=self.year_of_construction,
|
||||||
|
function_field=self.function,
|
||||||
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
||||||
print(f'city created from {file_path}')
|
print(f'city created from {self.file_path}')
|
||||||
ConstructionFactory('nrcan', city).enrich()
|
ConstructionFactory(self.handler, self.city).enrich()
|
||||||
print(len(city.buildings[0].surfaces))
|
|
||||||
|
|
||||||
|
def calculate_emission(self):
|
||||||
if __name__ == '__main__':
|
for building in self.city.buildings:
|
||||||
lca_calc = LCACarbonWorkflow('output_buildings_test.geojson')
|
return len(building.surfaces)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user