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,
|
|
||||||
height_field='height',
|
|
||||||
year_of_construction_field='year_of_construction',
|
|
||||||
function_field='function',
|
|
||||||
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
|
||||||
print(f'city created from {file_path}')
|
|
||||||
ConstructionFactory('nrcan', city).enrich()
|
|
||||||
print(len(city.buildings[0].surfaces))
|
|
||||||
|
|
||||||
|
self.city = GeometryFactory(
|
||||||
|
'geojson',
|
||||||
|
path=self.file_path,
|
||||||
|
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
|
||||||
|
print(f'city created from {self.file_path}')
|
||||||
|
ConstructionFactory(self.handler, self.city).enrich()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def calculate_emission(self):
|
||||||
lca_calc = LCACarbonWorkflow('output_buildings_test.geojson')
|
for building in self.city.buildings:
|
||||||
|
return len(building.surfaces)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user