2020-10-28 13:42:58 -04:00
|
|
|
"""
|
|
|
|
WeatherFactory retrieve the specific weather module for the given source format
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
2020-10-28 13:42:58 -04:00
|
|
|
"""
|
2020-10-29 07:40:40 -04:00
|
|
|
from pathlib import Path
|
2023-05-19 16:01:06 -04:00
|
|
|
|
2023-06-06 13:32:37 -04:00
|
|
|
from hub.city_model_structure.city import City
|
2023-01-25 19:13:00 -05:00
|
|
|
from hub.helpers.utils import validate_import_export_type
|
2023-05-19 16:01:06 -04:00
|
|
|
from hub.imports.weather.epw_weather_parameters import EpwWeatherParameters
|
2020-10-28 13:42:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
class WeatherFactory:
|
|
|
|
"""
|
|
|
|
WeatherFactory class
|
|
|
|
"""
|
|
|
|
|
2023-06-06 13:32:37 -04:00
|
|
|
def __init__(self, handler, city: City):
|
2020-10-28 13:42:58 -04:00
|
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
2023-05-19 16:01:06 -04:00
|
|
|
validate_import_export_type(WeatherFactory, handler)
|
2020-10-28 13:42:58 -04:00
|
|
|
self._city = city
|
|
|
|
|
2021-04-13 15:09:13 -04:00
|
|
|
def _epw(self):
|
2021-09-22 07:25:53 -04:00
|
|
|
"""
|
|
|
|
Enrich the city with energy plus weather file
|
|
|
|
"""
|
2021-04-13 15:09:13 -04:00
|
|
|
# EnergyPlus Weather
|
|
|
|
# to download files: https://energyplus.net/weather
|
|
|
|
# description of the format: https://energyplus.net/sites/default/files/pdfs_v8.3.0/AuxiliaryPrograms.pdf
|
2023-06-06 13:32:37 -04:00
|
|
|
return EpwWeatherParameters(self._city)
|
2021-01-11 17:11:50 -05:00
|
|
|
|
2021-04-07 11:46:44 -04:00
|
|
|
def enrich(self):
|
2020-10-28 13:42:58 -04:00
|
|
|
"""
|
2021-09-22 07:25:53 -04:00
|
|
|
Enrich the city given to the class using the given weather handler
|
2020-10-28 13:42:58 -04:00
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
getattr(self, self._handler, lambda: None)()
|