From d3023c7533782ad163ba155c93b5f3f32d6f290d Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Tue, 18 Jul 2023 09:14:05 -0400 Subject: [PATCH] added new branch for catalogs --- main.py | 48 +++++------------------------------------------- 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/main.py b/main.py index 18b572e..a05cd01 100644 --- a/main.py +++ b/main.py @@ -1,52 +1,14 @@ -import glob import sys -import os -from pathlib import Path - -from hub.imports.geometry_factory import GeometryFactory -from hub.imports.construction_factory import ConstructionFactory -from hub.imports.usage_factory import UsageFactory -from hub.imports.weather_factory import WeatherFactory -from hub.exports.energy_building_exports_factory import EnergyBuildingsExportsFactory -from hub.helpers.dictionaries import Dictionaries - -sys.path.append('./') +from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory try: - file_path = (Path(__file__).parent / 'data' / 'summerschool_one_building.geojson') - out_path = (Path(__file__).parent / 'out_files') - files = glob.glob(f'{out_path}/*') + print('[process start]') + catalog = UsageCatalogFactory('').catalog - for file in files: - if file != '.gitignore': - os.remove(file) - - print('[simulation start]') - city = GeometryFactory('geojson', - path=file_path, - height_field='citygml_me', - year_of_construction_field='ANNEE_CONS', - function_field='CODE_UTILI', - function_to_hub=Dictionaries().montreal_function_to_hub_function).city - - print(f'city created from {file_path}') - ConstructionFactory('nrcan', city).enrich() - print('enrich constructions... done') - UsageFactory('nrcan', city).enrich() - print('enrich usage... done') - WeatherFactory('epw', city).enrich() - print('enrich weather... done') - - print('exporting:') - - _idf = EnergyBuildingsExportsFactory('idf', city, out_path).export() - print(' idf exported...') - _idf.run() - - print('[simulation end]') + print('[process end]') except Exception as ex: print(ex) print('error: ', ex) - print('[simulation abort]') + print('[process abort]') sys.stdout.flush()