2020-06-09 14:07:47 -04:00
|
|
|
"""
|
2021-05-26 18:17:23 -04:00
|
|
|
ConstructionFactory (before PhysicsFactory) retrieve the specific construction module for the given region
|
2020-06-09 14:07:47 -04:00
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
2021-06-03 15:56:59 -04:00
|
|
|
from imports.construction.us_physics_parameters import UsPhysicsParameters
|
|
|
|
from imports.construction.ca_physics_parameters import CaPhysicsParameters
|
2020-06-26 21:10:56 -04:00
|
|
|
from pathlib import Path
|
2020-05-18 13:25:08 -04:00
|
|
|
|
|
|
|
|
2021-05-26 18:17:23 -04:00
|
|
|
class ConstructionFactory:
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
|
|
|
PhysicsFactor class
|
|
|
|
"""
|
2021-05-26 18:17:23 -04:00
|
|
|
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/construction')):
|
2020-06-11 15:45:11 -04:00
|
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
2020-05-18 13:25:08 -04:00
|
|
|
self._city = city
|
2020-06-04 12:47:48 -04:00
|
|
|
self._base_path = base_path
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-05-27 17:20:06 -04:00
|
|
|
def _nrel(self):
|
2021-01-07 19:46:52 -05:00
|
|
|
UsPhysicsParameters(self._city, self._base_path).enrich_buildings()
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-05-27 17:20:06 -04:00
|
|
|
def _nrcan(self):
|
2021-01-07 18:12:13 -05:00
|
|
|
CaPhysicsParameters(self._city, self._base_path).enrich_buildings()
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-05-27 17:20:06 -04:00
|
|
|
def _other_construction_library_format(self):
|
2020-10-21 09:53:07 -04:00
|
|
|
raise NotImplementedError
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-04-07 11:46:44 -04:00
|
|
|
def enrich(self):
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
2021-05-26 18:17:23 -04:00
|
|
|
Enrich the city with the construction information
|
2020-06-11 15:45:11 -04:00
|
|
|
:return: None
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
getattr(self, self._handler, lambda: None)()
|