IDF export will not longer blindly assign the Montreal as weather file
This commit is contained in:
parent
2c7fc66423
commit
37c09df932
|
@ -7,10 +7,13 @@ Project Coder Pilar Monsalvete Alvarez de uribarri pilar.monsalvete@concordia.ca
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
from hub.exports.building_energy.energy_ade import EnergyAde
|
from hub.exports.building_energy.energy_ade import EnergyAde
|
||||||
from hub.exports.building_energy.idf import Idf
|
from hub.exports.building_energy.idf import Idf
|
||||||
from hub.exports.building_energy.insel.insel_monthly_energy_balance import InselMonthlyEnergyBalance
|
from hub.exports.building_energy.insel.insel_monthly_energy_balance import InselMonthlyEnergyBalance
|
||||||
from hub.helpers.utils import validate_import_export_type
|
from hub.helpers.utils import validate_import_export_type
|
||||||
|
from hub.imports.weather.helpers.weather import Weather as wh
|
||||||
|
|
||||||
|
|
||||||
class EnergyBuildingsExportsFactory:
|
class EnergyBuildingsExportsFactory:
|
||||||
|
@ -49,8 +52,11 @@ class EnergyBuildingsExportsFactory:
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
idf_data_path = (Path(__file__).parent / './building_energy/idf_files/').resolve()
|
idf_data_path = (Path(__file__).parent / './building_energy/idf_files/').resolve()
|
||||||
# todo: create a get epw file function based on the city
|
url = wh().epw_file(self._city.region_code)
|
||||||
weather_path = (Path(__file__).parent / '../data/weather/epw/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw').resolve()
|
weather_path = (Path(__file__).parent.parent / f'data/weather/epw/{url.rsplit("/", 1)[1]}').resolve()
|
||||||
|
if not weather_path.exists():
|
||||||
|
with open(weather_path, 'wb') as epw_file:
|
||||||
|
epw_file.write(requests.get(url, allow_redirects=True).content)
|
||||||
return Idf(self._city, self._path, (idf_data_path / 'Minimal.idf'), (idf_data_path / 'Energy+.idd'), weather_path,
|
return Idf(self._city, self._path, (idf_data_path / 'Minimal.idf'), (idf_data_path / 'Energy+.idd'), weather_path,
|
||||||
target_buildings=self._target_buildings)
|
target_buildings=self._target_buildings)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user