e9dd9c2221
added example iso 52016-1:2017 added new weather format defined in iso 52016-1:2017 (xls)
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""
|
|
WeatherFactory retrieve the specific weather module for the given source format
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
|
"""
|
|
from pathlib import Path
|
|
from factories.weather_feeders.dat_weather_parameters import DatWeatherParameters
|
|
from factories.weather_feeders.xls_weather_parameters import XlsWeatherParameters
|
|
|
|
|
|
class WeatherFactory:
|
|
"""
|
|
WeatherFactory class
|
|
"""
|
|
|
|
def __init__(self, handler, city, city_name, base_path=Path(Path(__file__).parent.parent / 'data/weather')):
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
|
self._city = city
|
|
self._base_path = base_path
|
|
self._city_name = city_name
|
|
self.factory()
|
|
|
|
def _dat(self):
|
|
DatWeatherParameters(self._city, self._base_path, self._city_name)
|
|
|
|
def _tmy(self):
|
|
raise Exception('Not implemented')
|
|
|
|
def _xls(self):
|
|
name = 'ISO_52016_1_BESTEST_ClimData_2016.08.24'
|
|
XlsWeatherParameters(self._city, self._base_path, name)
|
|
|
|
def factory(self):
|
|
"""
|
|
Enrich the city with the usage information
|
|
:return: None
|
|
"""
|
|
getattr(self, self._handler, lambda: None)()
|