From ddf4631c59052b464cd5efa7b24ce0b6e339d94a Mon Sep 17 00:00:00 2001 From: guille Date: Tue, 29 Oct 2024 21:52:38 +0100 Subject: [PATCH] test --- .../building_energy/idf_helper/idf_window.py | 14 +++++++++----- tests/test_exports.py | 9 +++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/hub/exports/building_energy/idf_helper/idf_window.py b/hub/exports/building_energy/idf_helper/idf_window.py index 8539f92a..4a86f97e 100644 --- a/hub/exports/building_energy/idf_helper/idf_window.py +++ b/hub/exports/building_energy/idf_helper/idf_window.py @@ -1,4 +1,5 @@ import logging +from copy import copy import hub.exports.building_energy.idf_helper as idf_cte import hub.helpers.constants as cte @@ -6,7 +7,6 @@ from hub.exports.building_energy.idf_helper.idf_base import IdfBase class IdfWindow(IdfBase): - @staticmethod def _to_window_surface(self, surface): window_ratio = surface.associated_thermal_boundaries[0].window_ratio @@ -20,14 +20,18 @@ class IdfWindow(IdfBase): distance = (max_z - min_z) * window_ratio new_max_z = middle + distance / 2 new_min_z = middle - distance / 2 + window_coordinates = [] for index, coordinate in enumerate(coordinates): + if coordinate[z] == max_z: - coordinates[index] = (coordinate[x], coordinate[y], new_max_z) + new_coordinate = (coordinate[x], coordinate[y], new_max_z) elif coordinate[z] == min_z: - coordinates[index] = (coordinate[x], coordinate[y], new_min_z) + new_coordinate = (coordinate[x], coordinate[y], new_min_z) else: - logging.warning('Z coordinate not in top or bottom during window creation') - return coordinates + new_coordinate = (coordinate[x], coordinate[y], coordinate[z]) + logging.info('error') + window_coordinates.insert(0, new_coordinate) # store in inverted order + return window_coordinates @staticmethod def add(self, building): diff --git a/tests/test_exports.py b/tests/test_exports.py index 01545e82..96f82400 100644 --- a/tests/test_exports.py +++ b/tests/test_exports.py @@ -128,31 +128,28 @@ class TestExports(TestCase): """ export to IDF """ - file = '1588_v1.geojson' - # file = 'test.geojson' + # file = '1588_v1.geojson' + file = 'test.geojson' file_path = (self._example_path / file).resolve() - """ 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 - """ """=-043 "name": "01043081", "address": "avenue de l' H\u00f4tel-de-Ville (MTL) 3751", "function": "6911", "height": 21, "year_of_construction": 1964, - """ city = GeometryFactory('geojson', path=file_path, height_field='height', year_of_construction_field='year_of_construction', function_field='function', function_to_hub=Dictionaries().montreal_function_to_hub_function).city - # """ + """ self.assertIsNotNone(city, 'city is none') #EnergyBuildingsExportsFactory('idf', city, self._output_path).export() ConstructionFactory('nrcan', city).enrich()