Review changes for CityGml import factory change to use the new format for surfaces based in polygons
This commit is contained in:
parent
88e43a0770
commit
09ee39c314
|
@ -85,7 +85,7 @@ class EnergyAde:
|
|||
buildings.append(building_dic)
|
||||
|
||||
energy_ade['core:CityModel']['core:cityObjectMember'] = buildings
|
||||
print(energy_ade)
|
||||
|
||||
file_name = self._city.name + '_ade.gml'
|
||||
file_path = Path(self._path / file_name).resolve()
|
||||
with open(file_path, 'w' ) as file:
|
||||
|
@ -93,6 +93,7 @@ class EnergyAde:
|
|||
|
||||
@staticmethod
|
||||
def _measures(building, building_dic):
|
||||
#todo: this method is only for year and insel need to be generalized
|
||||
measures = []
|
||||
measure = EnergyAde._measure(building.heating, 'year', 'Energy demand heating', 'INSEL')
|
||||
if measure is not None:
|
||||
|
@ -172,6 +173,7 @@ class EnergyAde:
|
|||
'#text': f'{building.max_height}'
|
||||
}
|
||||
building_dic['bldg:Building']['bldg:storeysAboveGround'] = building.storeys_above_ground
|
||||
|
||||
if building.lod == 1:
|
||||
building_dic = self._lod1(building, building_dic, city)
|
||||
elif building.lod == 2:
|
||||
|
@ -202,7 +204,6 @@ class EnergyAde:
|
|||
surface_type = 'bldg:GroundSurface'
|
||||
else:
|
||||
surface_type = 'bldg:RoofSurface'
|
||||
|
||||
surface_dic = {
|
||||
surface_type: {
|
||||
'@gml:id': f'GML_{uuid.uuid4()}',
|
||||
|
@ -229,9 +230,9 @@ class EnergyAde:
|
|||
'@gml:id': f'PolyId{surface.name}_0',
|
||||
'gml:posList': {
|
||||
'@srsDimension': '3',
|
||||
'@count': len(surface.points) + 1,
|
||||
'@count': len(surface.solid_polygon.points) + 1,
|
||||
'#text': f'{" ".join(map(str, surface.solid_polygon.points_list))} '
|
||||
f'{" ".join(map(str, surface.points[0]))}'
|
||||
f'{" ".join(map(str, surface.solid_polygon.points[0]))}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,6 +262,7 @@ class EnergyAde:
|
|||
def _thermal_zones(self, building, city):
|
||||
thermal_zones = []
|
||||
for index, thermal_zone in enumerate(building.thermal_zones):
|
||||
print('debug me2')
|
||||
usage_zones = []
|
||||
for usage_zone in thermal_zone.usage_zones:
|
||||
usage_zones.append({'@xlink:href': f'#GML_{usage_zone.id}'})
|
||||
|
|
|
@ -17,7 +17,6 @@ class PhysicsFactory:
|
|||
self._handler = '_' + handler.lower().replace(' ', '_')
|
||||
self._city = city
|
||||
self._base_path = base_path
|
||||
self.factory()
|
||||
|
||||
def _us_new_york(self):
|
||||
UsNewYorkCityPhysicsParameters(self._city, self._base_path).enrich_buildings()
|
||||
|
@ -34,7 +33,7 @@ class PhysicsFactory:
|
|||
def _es(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def factory(self):
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the physics information
|
||||
:return: None
|
||||
|
|
|
@ -16,12 +16,11 @@ class SchedulesFactory:
|
|||
self._handler = '_' + handler.lower().replace(' ', '_')
|
||||
self._city = city
|
||||
self._base_path = base_path
|
||||
self.factory()
|
||||
|
||||
def _comnet(self):
|
||||
ComnetSchedules(self._city, self._base_path)
|
||||
|
||||
def factory(self):
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the schedules information
|
||||
:return: None
|
||||
|
|
|
@ -17,7 +17,6 @@ class UsageFactory:
|
|||
self._handler = '_' + handler.lower().replace(' ', '_')
|
||||
self._city = city
|
||||
self._base_path = base_path
|
||||
self.factory()
|
||||
|
||||
def _us_new_york(self):
|
||||
UsNewYorkCityUsageParameters(self._city, self._base_path).enrich_buildings()
|
||||
|
@ -31,7 +30,7 @@ class UsageFactory:
|
|||
def _es(self):
|
||||
raise Exception('Not implemented')
|
||||
|
||||
def factory(self):
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the usage information
|
||||
:return: None
|
||||
|
|
|
@ -18,7 +18,6 @@ class WeatherFactory:
|
|||
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)
|
||||
|
@ -30,7 +29,7 @@ class WeatherFactory:
|
|||
name = 'ISO_52016_1_BESTEST_ClimData_2016.08.24'
|
||||
XlsWeatherParameters(self._city, self._base_path, name)
|
||||
|
||||
def factory(self):
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the usage information
|
||||
:return: None
|
||||
|
|
|
@ -3,17 +3,19 @@ TestExports test and validate the city export formats
|
|||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
import pandas as pd
|
||||
from imports.geometry_factory import GeometryFactory
|
||||
from imports.physics_factory import PhysicsFactory
|
||||
from imports.schedules_factory import SchedulesFactory
|
||||
from imports.usage_factory import UsageFactory
|
||||
from exports.exports_factory import ExportsFactory
|
||||
from city_model_structure.city import City
|
||||
|
||||
|
||||
class TestExports(TestCase):
|
||||
"""
|
||||
TestGeometryFactory TestCase 1
|
||||
TestExports class contains the unittest for export functionality
|
||||
"""
|
||||
def setUp(self) -> None:
|
||||
"""
|
||||
|
@ -26,8 +28,16 @@ class TestExports(TestCase):
|
|||
|
||||
def _get_city(self):
|
||||
if self._city_gml is None:
|
||||
file_path = (self._example_path / 'one_building_in_kelowna.pickle').resolve()
|
||||
self._city_gml = City.load(file_path)
|
||||
file_path = (self._example_path / 'one_building_in_kelowna.gml').resolve()
|
||||
self._city_gml = GeometryFactory('citygml', file_path).city
|
||||
PhysicsFactory('ca', self._city_gml).enrich()
|
||||
UsageFactory('ca', self._city_gml).enrich()
|
||||
SchedulesFactory('comnet', self._city_gml).enrich()
|
||||
for building in self._city_gml.buildings:
|
||||
building.heating['month'] = pd.DataFrame({'INSEL': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]})
|
||||
building.cooling['month'] = pd.DataFrame({'INSEL': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]})
|
||||
building.heating['year'] = pd.DataFrame({'INSEL': [0.0]})
|
||||
building.cooling['year'] = pd.DataFrame({'INSEL': [0.0]})
|
||||
return self._city_gml
|
||||
|
||||
def _export(self, export_type):
|
||||
|
|
Loading…
Reference in New Issue
Block a user