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