Merge remote-tracking branch 'origin/main'

This commit is contained in:
Guille Gutierrez 2023-08-22 10:26:29 -04:00
commit ff1bb80a6c
12 changed files with 54 additions and 25 deletions

View File

View File

@ -4,6 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
from math import inf
from typing import Union, List from typing import Union, List
from hub.city_model_structure.attributes.schedule import Schedule from hub.city_model_structure.attributes.schedule import Schedule
@ -22,16 +23,14 @@ class ThermalControl:
@staticmethod @staticmethod
def _maximum_value(schedules): def _maximum_value(schedules):
maximum = -1000 maximum = -inf
for schedule in schedules: for schedule in schedules:
for value in schedule.values: maximum = max(maximum, max(schedule.values))
if value > maximum:
maximum = value
return maximum return maximum
@staticmethod @staticmethod
def _minimum_value(schedules): def _minimum_value(schedules):
minimum = 1000 minimum = inf
for schedule in schedules: for schedule in schedules:
minimum = min(minimum, min(schedule.values)) minimum = min(minimum, min(schedule.values))
return minimum return minimum

View File

@ -101,7 +101,7 @@ class City:
Get city location Get city location
:return: Location :return: Location
""" """
return self._get_location().city return self._get_location()
@property @property
def name(self): def name(self):
@ -113,6 +113,15 @@ class City:
return self._get_location().city return self._get_location().city
return self._name return self._name
@name.setter
def name(self, value):
"""
Set city name
:param value:str
"""
if value is not None:
self._name = str(value)
@property @property
def climate_reference_city(self) -> Union[None, str]: def climate_reference_city(self) -> Union[None, str]:
""" """
@ -275,15 +284,6 @@ class City:
""" """
return self._srs_name return self._srs_name
@name.setter
def name(self, value):
"""
Set city name
:param value:str
"""
if value is not None:
self._name = str(value)
@staticmethod @staticmethod
def load(city_filename) -> City: def load(city_filename) -> City:
""" """

View File

@ -73,7 +73,9 @@ class HubUsageToComnetUsage:
cte.AUTOMOTIVE_FACILITY: 'BA Automotive Facility', cte.AUTOMOTIVE_FACILITY: 'BA Automotive Facility',
cte.PARKING_GARAGE: 'BA Parking Garage', cte.PARKING_GARAGE: 'BA Parking Garage',
cte.RELIGIOUS: 'BA Religious Building', cte.RELIGIOUS: 'BA Religious Building',
cte.NON_HEATED: 'n/a' cte.NON_HEATED: 'n/a',
cte.DATACENTER: 'n/a',
cte.FARM: 'n/a'
} }
@property @property

View File

@ -17,7 +17,9 @@ class HubUsageToEilatUsage:
self._dictionary = { self._dictionary = {
cte.RESIDENTIAL: 'Residential', cte.RESIDENTIAL: 'Residential',
cte.HOTEL: 'Hotel employees', cte.HOTEL: 'Hotel employees',
cte.DORMITORY: 'Dormitory' cte.DORMITORY: 'Dormitory',
cte.DATACENTER: 'n/a',
cte.FARM: 'n/a'
} }
@property @property

View File

@ -73,7 +73,9 @@ class HubUsageToHftUsage:
cte.AUTOMOTIVE_FACILITY: 'n/a', cte.AUTOMOTIVE_FACILITY: 'n/a',
cte.PARKING_GARAGE: 'n/a', cte.PARKING_GARAGE: 'n/a',
cte.RELIGIOUS: 'event location', cte.RELIGIOUS: 'event location',
cte.NON_HEATED: 'non-heated' cte.NON_HEATED: 'non-heated',
cte.DATACENTER: 'n/a',
cte.FARM: 'n/a'
} }
@property @property

View File

@ -73,7 +73,10 @@ class HubUsageToNrcanUsage:
cte.AUTOMOTIVE_FACILITY: 'Automotive facility', cte.AUTOMOTIVE_FACILITY: 'Automotive facility',
cte.PARKING_GARAGE: 'Storage garage', cte.PARKING_GARAGE: 'Storage garage',
cte.RELIGIOUS: 'Religious building', cte.RELIGIOUS: 'Religious building',
cte.NON_HEATED: 'n/a' cte.NON_HEATED: 'n/a',
cte.DATACENTER: 'n/a',
cte.FARM: 'n/a'
} }
@property @property

View File

@ -623,8 +623,12 @@ class MontrealFunctionToHubFunction:
'8192': cte.FARM, '8192': cte.FARM,
'2439': cte.INDUSTRY, '2439': cte.INDUSTRY,
'3891': cte.INDUSTRY, '3891': cte.INDUSTRY,
'6354': cte.WORKSHOP '6354': cte.WORKSHOP,
} '4815': cte.NON_HEATED,
'6651': cte.WORKSHOP,
'2822': cte.INDUSTRY,
'2821': cte.INDUSTRY
}
@property @property
def dictionary(self) -> dict: def dictionary(self) -> dict:

View File

@ -312,7 +312,7 @@ class GeometryHelper:
country = file_country_code country = file_country_code
city = file_city_name city = file_city_name
region_code = f'{file_country_code}.{admin1_code}.{admin2_code}' region_code = f'{file_country_code}.{admin1_code}.{admin2_code}'
return Location(country, city, region_code) return Location(country, city, region_code, latitude, longitude)
@staticmethod @staticmethod
def distance_between_points(vertex1, vertex2): def distance_between_points(vertex1, vertex2):

View File

@ -11,10 +11,12 @@ class Location:
""" """
Location Location
""" """
def __init__(self, country, city, region_code): def __init__(self, country, city, region_code, climate_reference_city_latitude, climate_reference_city_longitude):
self._country = country self._country = country
self._city = city self._city = city
self._region_code = region_code self._region_code = region_code
self._climate_reference_city_latitude = climate_reference_city_latitude
self._climate_reference_city_longitude = climate_reference_city_longitude
@property @property
def city(self): def city(self):
@ -36,3 +38,17 @@ class Location:
Get region Get region
""" """
return self._region_code return self._region_code
@property
def climate_reference_city_latitude(self):
"""
Get climate-reference-city latitude
"""
return self._climate_reference_city_latitude
@property
def climate_reference_city_longitude(self):
"""
Get climate-reference-city longitude
"""
return self._climate_reference_city_longitude

View File

@ -42,7 +42,6 @@ class ConstructionHelper:
'Varennes': '6', 'Varennes': '6',
'Laval': '6', 'Laval': '6',
'Longueuil': '6', 'Longueuil': '6',
'Saint-Leonard': '6',
'Mont-Royal': '6', 'Mont-Royal': '6',
'Deux-Montagnes': '6', 'Deux-Montagnes': '6',
'Dorval': '6', 'Dorval': '6',
@ -58,6 +57,8 @@ class ConstructionHelper:
'Pointe-Claire': '6', 'Pointe-Claire': '6',
'Boucherville': '6', 'Boucherville': '6',
'Mascouche': '6', 'Mascouche': '6',
'Saint-Leonard': '6',
'La Prairie': '6'
} }
_reference_city_to_israel_climate_zone = { _reference_city_to_israel_climate_zone = {

View File

@ -1,4 +1,4 @@
""" """
Hub version number Hub version number
""" """
__version__ = '0.1.8.4' __version__ = '0.1.8.8'