Add roof area to the persistence

This commit is contained in:
Guille Gutierrez 2023-05-29 11:13:49 -04:00
parent 04bf3bbef3
commit 061952eb17
2 changed files with 3 additions and 1 deletions

View File

@ -6,7 +6,7 @@ Project Coder Peter Yefi peteryefi@gmail.com
"""
import logging
from hub.persistence import Repository
from hub.persistence.repository import Repository
from hub.persistence.models import Application
from hub.persistence.models import City
from hub.persistence.models import CityObject

View File

@ -32,6 +32,7 @@ class CityObject(Models):
total_heating_area = Column(Float, nullable=False)
wall_area = Column(Float, nullable=False)
windows_area = Column(Float, nullable=False)
roof_area = Column(Float, nullable=False)
system_name = Column(String, nullable=False)
created = Column(DateTime, default=datetime.datetime.utcnow)
updated = Column(DateTime, default=datetime.datetime.utcnow)
@ -46,6 +47,7 @@ class CityObject(Models):
self.usage = building.usages_percentage
self.volume = building.volume
self.area = building.floor_area
self.roof_area = sum(roof.solid_polygon.area for roof in building.roofs)
storeys = building.storeys_above_ground
if storeys is None:
storeys = building.max_height / building.average_storey_height