forked from s_ranjbar/city_retrofit
Code quality check
This commit is contained in:
parent
ff642a2c0c
commit
d6e6d06d39
|
@ -84,7 +84,7 @@ class Building(CityObject):
|
|||
elif surface.type == cte.INTERIOR_SLAB:
|
||||
self._interior_slabs.append(surface)
|
||||
else:
|
||||
logging.error(f'Building {self.name} [{self.aliases}] has an unexpected surface type {surface.type}.\n')
|
||||
logging.error(f'Building %s [%s] has an unexpected surface type %s.', self.name, self.aliases, surface.type)
|
||||
|
||||
@property
|
||||
def shell(self) -> Polyhedron:
|
||||
|
|
|
@ -520,10 +520,10 @@ class ThermalZone:
|
|||
|
||||
if _schedules_defined:
|
||||
_schedules = []
|
||||
for day, _ in enumerate(_days):
|
||||
for day_index, day in enumerate(_days):
|
||||
_schedule = copy.deepcopy(_base_schedule)
|
||||
_schedule.day_types = [_days[day]]
|
||||
_schedule.values = values[:day]
|
||||
_schedule.day_types = [day]
|
||||
_schedule.values = values[:day_index]
|
||||
_schedules.append(_schedule)
|
||||
|
||||
_internal_gain.average_internal_gain = _average_internal_gain
|
||||
|
|
|
@ -295,7 +295,7 @@ class GeometryHelper:
|
|||
distance = math.inf
|
||||
country = 'Unknown'
|
||||
city = 'Unknown'
|
||||
region = 'Unknown'
|
||||
region_code = 'Unknown'
|
||||
with open(_data_path, 'r', encoding='utf-8') as file:
|
||||
for _, line in enumerate(file):
|
||||
fields = line.split('\t')
|
||||
|
|
|
@ -35,16 +35,16 @@ class NrcanPhysicsParameters:
|
|||
nrcan_catalog = ConstructionCatalogFactory('nrcan').catalog
|
||||
for building in city.buildings:
|
||||
if building.function not in Dictionaries().hub_function_to_nrcan_construction_function.keys():
|
||||
logging.error(f'Building {building.name} has an unknown building function {building.function}\n')
|
||||
logging.error(f'Building %s has an unknown building function %s', building.name, building.function )
|
||||
continue
|
||||
function = Dictionaries().hub_function_to_nrcan_construction_function[building.function]
|
||||
try:
|
||||
archetype = self._search_archetype(nrcan_catalog, function, building.year_of_construction, self._climate_zone)
|
||||
|
||||
except KeyError:
|
||||
logging.error(f'Building {building.name} has unknown construction archetype for building function: {function} '
|
||||
f'[{building.function}], building year of construction: {building.year_of_construction} '
|
||||
f'and climate zone {self._climate_zone}\n')
|
||||
logging.error(f'Building %s has unknown construction archetype for building function: %s '
|
||||
f'[%s], building year of construction: %s and climate zone %s', building.name, function,
|
||||
building.function, building.year_of_construction, self._climate_zone)
|
||||
continue
|
||||
|
||||
# if building has no thermal zones defined from geometry, and the building will be divided in storeys,
|
||||
|
@ -100,7 +100,7 @@ class NrcanPhysicsParameters:
|
|||
thermal_boundary.construction_name = construction_archetype.name
|
||||
try:
|
||||
thermal_boundary.window_ratio = 0
|
||||
if thermal_boundary.type == cte.WALL or thermal_boundary.type == cte.ROOF:
|
||||
if thermal_boundary.type in ( cte.WALL, cte.ROOF):
|
||||
if construction_archetype.window is not None:
|
||||
if -math.sqrt(2) / 2 < math.sin(thermal_boundary.parent_surface.azimuth) < math.sqrt(2) / 2:
|
||||
if 0 < math.cos(thermal_boundary.parent_surface.azimuth):
|
||||
|
|
|
@ -32,11 +32,8 @@ class NrelPhysicsParameters:
|
|||
city = self._city
|
||||
nrel_catalog = ConstructionCatalogFactory('nrel').catalog
|
||||
for building in city.buildings:
|
||||
if building.function not in Dictionaries().hub_function_to_nrel_construction_function.keys():
|
||||
logging.error(f'Building {building.name} has unknown function [{building.function}]')
|
||||
continue
|
||||
if building.function not in Dictionaries().hub_function_to_nrel_construction_function.keys():
|
||||
logging.error(f'Building {building.name} has unknown function {building.function}\n')
|
||||
if building.function not in Dictionaries().hub_function_to_nrel_construction_function:
|
||||
logging.error(f'Building %s has unknown function %s', building.name, building.function)
|
||||
continue
|
||||
function = Dictionaries().hub_function_to_nrel_construction_function[building.function]
|
||||
try:
|
||||
|
|
|
@ -129,4 +129,3 @@ class Weather:
|
|||
logging.warning('Specific weather data unknown for %s using Montreal data instead', region_code)
|
||||
return self._epw_file['CA.10.06']
|
||||
return self._epw_file[region_code]
|
||||
|
||||
|
|
|
@ -211,4 +211,3 @@ class DBControl:
|
|||
:param application_uuid: the id of the application to get
|
||||
"""
|
||||
self._application.delete(application_uuid)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user