Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pilar 2021-06-03 13:45:18 -04:00
commit 1431e86a37
2 changed files with 36 additions and 16 deletions

View File

@ -57,4 +57,20 @@ class CityGmlLod2(CityGmlBase):
@classmethod
def _multi_surface(cls, o):
raise NotImplementedError('multi surface')
surfaces = []
for b in o["boundedBy"]:
try:
surface_type = next(iter(b))
except TypeError:
continue
surface_encoding, surface_subtype = cls._surface_encoding(b[surface_type])
for member in b[surface_type][surface_encoding][surface_subtype]['surfaceMember']:
if '@srsDimension' in member['Polygon']['exterior']['LinearRing']['posList']:
gml_points = member['Polygon']['exterior']['LinearRing']['posList']["#text"]
else:
gml_points = member['Polygon']['exterior']['LinearRing']['posList']
sp = cls._solid_points(cls._remove_last_point(gml_points))
p = Polygon(sp)
surface = Surface(p, p, surface_type=GeometryHelper.gml_surface_to_libs(surface_type))
surfaces.append(surface)
return surfaces

View File

@ -13,19 +13,23 @@ class ConcordiaEnergyConsumption(ConcordiaFileReport):
def __init__(self, city, end_point, base_path):
super().__init__(city, end_point, base_path, 'concordia_energy_db.json')
for city_object in city.city_objects:
for i in range(len(self._city_object)):
if self._city_object[i] == city_object.name and self._sensors[i] in self._sensor_point:
building_measures = [self._measures["Date time"], self._measures[self._sensor_point[self._sensors[i]]]]
building_headers = ["Date time", "Energy consumption"]
building_energy_consumption = pd.concat(building_measures, keys=building_headers, axis=1)
sensor = ConcordiaEnergySensor(self._sensors[i])
sensor_exist = False
for j in range(len(city_object.sensors)):
if city_object.sensors[j].name is sensor.name:
city_object.sensors[j].add_period(building_energy_consumption)
sensor_exist = True
break
if not sensor_exist:
sensor.add_period(building_energy_consumption)
city_object.sensors.append(sensor)
self._assign_sensor_to_object(city_object)
for city_object_cluster in city.city_objects_cluster:
self._assign_sensor_to_object(city_object_cluster)
def _assign_sensor_to_object(self, obj):
for i in range(len(self._city_object)):
if self._city_object[i] == obj.name and self._sensors[i] in self._sensor_point:
building_measures = [self._measures["Date time"], self._measures[self._sensor_point[self._sensors[i]]]]
building_headers = ["Date time", "Energy consumption"]
building_energy_consumption = pd.concat(building_measures, keys=building_headers, axis=1)
sensor = ConcordiaEnergySensor(self._sensors[i])
sensor_exist = False
for j in range(len(object.sensors)):
if obj.sensors[j].name is sensor.name:
obj.sensors[j].add_period(building_energy_consumption)
sensor_exist = True
break
if not sensor_exist:
sensor.add_period(building_energy_consumption)
obj.sensors.append(sensor)