city_retrofit/imports/usage/helpers/usage_helper.py
Pilar 1d4841df83 city_objects_clusters are now city_objects
test_sensors_factory.py passes
2021-06-03 15:56:59 -04:00

35 lines
915 B
Python

"""
Usage helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
class UsageHelper:
usage_to_hft = {
'residential': 'residential',
'industry': 'industry',
'office and administration': 'office and administration',
'hotel': 'hotel',
'health care': 'health care',
'retail': 'retail',
'hall': 'hall',
'restaurant': 'restaurant',
'education': 'education'
}
hft_default_value = 'residential'
@staticmethod
def hft_from_usage(usage):
"""
Get HfT usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return UsageHelper.usage_to_hft[usage]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default HfT usage "residential"\n')
return UsageHelper.hft_default_value