centralized all dictionaries in helpers.dictionaries.py and reviewed all those from hub to something

This commit is contained in:
Pilar 2022-12-16 07:21:33 -05:00
parent c0e60f27c7
commit 2ffbf06ac5
21 changed files with 682 additions and 727 deletions

View File

@ -5,39 +5,13 @@ class ConstructionHelper:
"""
Construction helper class
"""
nrel_to_function = {
'residential': cte.RESIDENTIAL,
'midrise apartment': cte.MID_RISE_APARTMENT,
'high-rise apartment': cte.HIGH_RISE_APARTMENT,
'small office': cte.SMALL_OFFICE,
'medium office': cte.MEDIUM_OFFICE,
'large office': cte.LARGE_OFFICE,
'primary school': cte.PRIMARY_SCHOOL,
'secondary school': cte.SECONDARY_SCHOOL,
'stand-alone retail': cte.STAND_ALONE_RETAIL,
'hospital': cte.HOSPITAL,
'outpatient healthcare': cte.OUT_PATIENT_HEALTH_CARE,
'strip mall': cte.STRIP_MALL,
'supermarket': cte.SUPERMARKET,
'warehouse': cte.WAREHOUSE,
'quick service restaurant': cte.QUICK_SERVICE_RESTAURANT,
'full service restaurant': cte.FULL_SERVICE_RESTAURANT,
'small hotel': cte.SMALL_HOTEL,
'large hotel': cte.LARGE_HOTEL,
'industry': cte.INDUSTRY
}
nrcan_to_function = {
'residential': cte.RESIDENTIAL,
}
reference_standard_to_construction_period = {
_reference_standard_to_construction_period = {
'non_standard_dompark': '1900 - 2004',
'ASHRAE 90.1_2004': '2004 - 2009',
'ASHRAE 189.1_2009': '2009 - PRESENT'
}
nrel_surfaces_types_to_hub_types = {
_nrel_surfaces_types_to_hub_types = {
'exterior wall': cte.WALL,
'interior wall': cte.INTERIOR_WALL,
'ground wall': cte.GROUND_WALL,
@ -46,7 +20,8 @@ class ConstructionHelper:
'interior slab': cte.INTERIOR_SLAB,
'roof': cte.ROOF
}
nrcan_surfaces_types_to_hub_types = {
_nrcan_surfaces_types_to_hub_types = {
'Wall_Outdoors': cte.WALL,
'RoofCeiling_Outdoors': cte.ROOF,
'Floor_Outdoors': cte.ATTIC_FLOOR,
@ -57,3 +32,15 @@ class ConstructionHelper:
'RoofCeiling_Ground': cte.GROUND_WALL,
'Floor_Ground': cte.GROUND
}
@property
def reference_standard_to_construction_period(self):
return self._reference_standard_to_construction_period
@property
def nrel_surfaces_types_to_hub_types(self):
return self._nrel_surfaces_types_to_hub_types
@property
def nrcan_surfaces_types_to_hub_types(self):
return self._nrcan_surfaces_types_to_hub_types

View File

@ -109,7 +109,7 @@ class NrelCatalog(Catalog):
archetypes = self._archetypes['archetypes']['archetype']
for archetype in archetypes:
archetype_id = archetype['@id']
function = ConstructionHelper().nrel_to_function[archetype['@building_type']]
function = archetype['@building_type']
name = f"{function} {archetype['@climate_zone']} {archetype['@reference_standard']}"
climate_zone = archetype['@climate_zone']
construction_period = \

View File

@ -59,31 +59,6 @@ class UsageHelper:
}
_usage_to_hft = {
cte.RESIDENTIAL: 'residential',
cte.SINGLE_FAMILY_HOUSE: 'Single family house',
cte.MULTI_FAMILY_HOUSE: 'Multi-family house',
cte.EDUCATION: 'education',
cte.SCHOOL_WITHOUT_SHOWER: 'school without shower',
cte.SCHOOL_WITH_SHOWER: 'school with shower',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'retail shop / refrigerated food',
cte.HOTEL: 'hotel',
cte.HOTEL_MEDIUM_CLASS: 'hotel (Medium-class)',
cte.DORMITORY: 'dormitory',
cte.INDUSTRY: 'industry',
cte.RESTAURANT: 'restaurant',
cte.HEALTH_CARE: 'health care',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'Home for the aged or orphanage',
cte.OFFICE_AND_ADMINISTRATION: 'office and administration',
cte.EVENT_LOCATION: 'event location',
cte.HALL: 'hall',
cte.SPORTS_LOCATION: 'sport location',
cte.LABOR: 'Labor',
cte.GREEN_HOUSE: 'green house',
cte.NON_HEATED: 'non-heated'
}
_comnet_days = [cte.MONDAY,
cte.TUESDAY,
cte.WEDNESDAY,
@ -93,31 +68,6 @@ class UsageHelper:
cte.SUNDAY,
cte.HOLIDAY]
_usage_to_comnet = {
cte.RESIDENTIAL: 'BA Multifamily',
cte.SINGLE_FAMILY_HOUSE: 'BA Multifamily',
cte.MULTI_FAMILY_HOUSE: 'BA Multifamily',
cte.EDUCATION: 'BA School/University',
cte.SCHOOL_WITHOUT_SHOWER: 'BA School/University',
cte.SCHOOL_WITH_SHOWER: 'BA School/University',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'BA Retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'BA Retail',
cte.HOTEL: 'BA Hotel',
cte.HOTEL_MEDIUM_CLASS: 'BA Hotel',
cte.DORMITORY: 'BA Dormitory',
cte.INDUSTRY: 'BA Manufacturing Facility',
cte.RESTAURANT: 'BA Dining: Family',
cte.HEALTH_CARE: 'BA Hospital',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'BA Multifamily',
cte.OFFICE_AND_ADMINISTRATION: 'BA Office',
cte.EVENT_LOCATION: 'BA Convention Center',
cte.HALL: 'BA Convention Center',
cte.SPORTS_LOCATION: 'BA Sports Arena',
cte.LABOR: 'BA Gymnasium',
cte.GREEN_HOUSE: cte.GREEN_HOUSE,
cte.NON_HEATED: cte.NON_HEATED
}
_comnet_data_type_to_hub_data_type = {
'Fraction': cte.FRACTION,
'OnOff': cte.ON_OFF,
@ -167,18 +117,6 @@ class UsageHelper:
def comnet_days(self):
return self._comnet_days
@staticmethod
def comnet_from_hub_usage(usage):
"""
Get Comnet usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return UsageHelper._usage_to_comnet[usage]
except KeyError:
sys.stderr.write('Error: keyword not found to translate from hub_usage to comnet usage.\n')
@staticmethod
def schedules_key(usage):
"""
@ -191,15 +129,3 @@ class UsageHelper:
except KeyError:
sys.stderr.write('Error: Comnet keyword not found. An update of the Comnet files might have been '
'done changing the keywords.\n')
@staticmethod
def hft_from_hub_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 to translate from hub_usage to hft usage.\n')

View File

@ -43,7 +43,6 @@ class City:
self._buildings = None
self._subway_entrances = None
self._srs_name = srs_name
self._geometry = GeometryHelper()
# todo: right now extracted at city level, in the future should be extracted also at building level if exist
self._location = None
self._country_code = None

View File

@ -66,45 +66,64 @@ DOOR = 'Door'
SKYLIGHT = 'Skylight'
# functions and usages
RESIDENTIAL = 'residential'
SINGLE_FAMILY_HOUSE = 'single family house'
MULTI_FAMILY_HOUSE = 'multifamily house'
ROW_HOSE = 'row house'
ROW_HOUSE = 'row house'
MID_RISE_APARTMENT = 'mid rise apartment'
HIGH_RISE_APARTMENT = 'high rise apartment'
OFFICE_AND_ADMINISTRATION = 'office and administration'
SMALL_OFFICE = 'small office'
MEDIUM_OFFICE = 'medium office'
LARGE_OFFICE = 'large office'
COURTHOUSE = 'courthouse'
FIRE_STATION = 'fire station'
PENITENTIARY = 'penitentiary'
POLICE_STATION = 'police station'
POST_OFFICE = 'post office'
LIBRARY = 'library'
EDUCATION = 'education'
PRIMARY_SCHOOL = 'primary school'
PRIMARY_SCHOOL_WITH_SHOWER = 'school with shower'
SECONDARY_SCHOOL = 'secondary school'
UNIVERSITY = 'university'
LABORATORY_AND_RESEARCH_CENTER = 'laboratory and research centers'
STAND_ALONE_RETAIL = 'stand alone retail'
HOSPITAL = 'hospital'
OUT_PATIENT_HEALTH_CARE = 'out-patient health care'
STRIP_MALL = 'strip mall'
SUPERMARKET = 'supermarket'
WAREHOUSE = 'warehouse'
QUICK_SERVICE_RESTAURANT = 'quick service restaurant'
FULL_SERVICE_RESTAURANT = 'full service restaurant'
SMALL_HOTEL = 'small hotel'
LARGE_HOTEL = 'large hotel'
RESIDENTIAL = 'residential'
EDUCATION = 'education'
SCHOOL_WITHOUT_SHOWER = 'school without shower'
SCHOOL_WITH_SHOWER = 'school with shower'
RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD = 'retail shop without refrigerated food'
RETAIL_SHOP_WITH_REFRIGERATED_FOOD = 'retail shop with refrigerated food'
HOTEL = 'hotel'
HOTEL_MEDIUM_CLASS = 'hotel medium class'
DORMITORY = 'dormitory'
INDUSTRY = 'industry'
RESTAURANT = 'restaurant'
HEALTH_CARE = 'health care'
RETIREMENT_HOME_OR_ORPHANAGE = 'retirement home or orphanage'
OFFICE_AND_ADMINISTRATION = 'office and administration'
COMMERCIAL = 'commercial'
STRIP_MALL = 'strip mall'
SUPERMARKET = 'supermarket'
RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD = 'retail shop without refrigerated food'
RETAIL_SHOP_WITH_REFRIGERATED_FOOD = 'retail shop with refrigerated food'
RESTAURANT = 'restaurant'
QUICK_SERVICE_RESTAURANT = 'quick service restaurant'
FULL_SERVICE_RESTAURANT = 'full service restaurant'
HOTEL = 'hotel'
HOTEL_MEDIUM_CLASS = 'hotel medium class'
SMALL_HOTEL = 'small hotel'
LARGE_HOTEL = 'large hotel'
DORMITORY = 'dormitory'
EVENT_LOCATION = 'event location'
CONVENTION_CENTER = 'convention center'
HALL = 'hall'
SPORTS_LOCATION = 'sports location'
LABOR = 'labor'
GREEN_HOUSE = 'green house'
INDUSTRY = 'industry'
WORKSHOP = 'workshop'
WAREHOUSE = 'warehouse'
WAREHOUSE_REFRIGERATED = 'warehouse refrigerated'
SPORTS_LOCATION = 'sports location'
SPORTS_ARENA = 'sports arena'
GYMNASIUM = 'gymnasium'
MOTION_PICTURE_THEATRE = 'motion picture theatre'
MUSEUM = 'museum'
PERFORMING_ARTS_THEATRE = 'performing arts theatre'
TRANSPORTATION = 'transportation'
AUTOMOTIVE_FACILITY = 'automotive facility'
PARKING_GARAGE = 'parking garage'
RELIGIOUS = 'religious'
NON_HEATED = 'non-heated'
LIGHTING = 'Lights'

595
helpers/dictionaries.py Normal file
View File

@ -0,0 +1,595 @@
"""
Dictionaries module saves all transformations of functions and usages to access the catalogs
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import helpers.constants as cte
class Dictionaries:
"""
Dictionaries class
"""
_usage_to_hft_usage = {
cte.RESIDENTIAL: 'residential',
cte.SINGLE_FAMILY_HOUSE: 'single family house',
cte.MULTI_FAMILY_HOUSE: 'multifamily house',
cte.ROW_HOUSE: 'single family house',
cte.MID_RISE_APARTMENT: 'multifamily house',
cte.HIGH_RISE_APARTMENT: 'multifamily house',
cte.OFFICE_AND_ADMINISTRATION: 'office and administration',
cte.SMALL_OFFICE: 'office and administration',
cte.MEDIUM_OFFICE: 'office and administration',
cte.LARGE_OFFICE: 'office and administration',
cte.COURTHOUSE: 'office and administration',
cte.FIRE_STATION: 'office and administration',
cte.PENITENTIARY: 'school with shower',
cte.POLICE_STATION: 'office and administration',
cte.POST_OFFICE: 'office and administration',
cte.LIBRARY: 'office and administration',
cte.EDUCATION: 'education',
cte.PRIMARY_SCHOOL: 'school without shower',
cte.PRIMARY_SCHOOL_WITH_SHOWER: 'school with shower',
cte.SECONDARY_SCHOOL: 'education',
cte.UNIVERSITY: 'education',
cte.LABORATORY_AND_RESEARCH_CENTER: 'laboratory and research centers',
cte.STAND_ALONE_RETAIL: 'retail',
cte.HOSPITAL: 'health care',
cte.OUT_PATIENT_HEALTH_CARE: 'health care',
cte.HEALTH_CARE: 'health care',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'Home for the aged or orphanage',
cte.COMMERCIAL: 'retail',
cte.STRIP_MALL: 'retail',
cte.SUPERMARKET: 'retail shop / refrigerated food',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'retail shop / refrigerated food',
cte.RESTAURANT: 'restaurant',
cte.QUICK_SERVICE_RESTAURANT: 'restaurant',
cte.FULL_SERVICE_RESTAURANT: 'restaurant',
cte.HOTEL: 'hotel',
cte.HOTEL_MEDIUM_CLASS: 'hotel (Medium-class)',
cte.SMALL_HOTEL: 'hotel',
cte.LARGE_HOTEL: 'hotel',
cte.DORMITORY: 'dormitory',
cte.EVENT_LOCATION: 'event location',
cte.CONVENTION_CENTER: 'event location',
cte.HALL: 'hall',
cte.GREEN_HOUSE: 'green house',
cte.INDUSTRY: 'industry',
cte.WORKSHOP: 'industry',
cte.WAREHOUSE: 'industry',
cte.WAREHOUSE_REFRIGERATED: 'industry',
cte.SPORTS_LOCATION: 'sport location',
cte.SPORTS_ARENA: 'sport location',
cte.GYMNASIUM: 'sport location',
cte.MOTION_PICTURE_THEATRE: 'event location',
cte.MUSEUM: 'event location',
cte.PERFORMING_ARTS_THEATRE: 'event location',
cte.TRANSPORTATION: 'n/a',
cte.AUTOMOTIVE_FACILITY: 'n/a',
cte.PARKING_GARAGE: 'n/a',
cte.RELIGIOUS: 'event location',
cte.NON_HEATED: 'non-heated'
}
_usage_to_comnet_usage = {
cte.RESIDENTIAL: 'BA Multifamily',
cte.SINGLE_FAMILY_HOUSE: 'BA Multifamily',
cte.MULTI_FAMILY_HOUSE: 'BA Multifamily',
cte.ROW_HOUSE: 'BA Multifamily',
cte.MID_RISE_APARTMENT: 'BA Multifamily',
cte.HIGH_RISE_APARTMENT: 'BA Multifamily',
cte.OFFICE_AND_ADMINISTRATION: 'BA Office',
cte.SMALL_OFFICE: 'BA Office',
cte.MEDIUM_OFFICE: 'BA Office',
cte.LARGE_OFFICE: 'BA Office',
cte.COURTHOUSE: 'BA Courthouse',
cte.FIRE_STATION: 'BA Fire Station',
cte.PENITENTIARY: 'BA Penitentiary',
cte.POLICE_STATION: 'BA Police Station',
cte.POST_OFFICE: 'BA Post Office',
cte.LIBRARY: 'BA Library',
cte.EDUCATION: 'BA School/University',
cte.PRIMARY_SCHOOL: 'BA School/University',
cte.PRIMARY_SCHOOL_WITH_SHOWER: 'BA School/University',
cte.SECONDARY_SCHOOL: 'BA School/University',
cte.UNIVERSITY: 'BA School/University',
cte.LABORATORY_AND_RESEARCH_CENTER: 'BA School/University',
cte.STAND_ALONE_RETAIL: 'BA Retail',
cte.HOSPITAL: 'BA Hospital',
cte.OUT_PATIENT_HEALTH_CARE: 'BA Healthcare Clinic',
cte.HEALTH_CARE: 'BA Healthcare Clinic',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'BA Healthcare Clinic',
cte.COMMERCIAL: 'BA Retail',
cte.STRIP_MALL: 'BA Retail',
cte.SUPERMARKET: 'BA Retail',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'BA Retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'BA Retail',
cte.RESTAURANT: 'BA Dining: Bar Lounge/Leisure',
cte.QUICK_SERVICE_RESTAURANT: 'BA Dining: Cafeteria/Fast Food',
cte.FULL_SERVICE_RESTAURANT: 'BA Dining: Bar Lounge/Leisure',
cte.HOTEL: 'BA Hotel',
cte.HOTEL_MEDIUM_CLASS: 'BA Motel',
cte.SMALL_HOTEL: 'BA Motel',
cte.LARGE_HOTEL: 'BA Hotel',
cte.DORMITORY: 'BA Dormitory',
cte.EVENT_LOCATION: 'BA Convention Center',
cte.CONVENTION_CENTER: 'BA Convention Center',
cte.HALL: 'BA Town Hall',
cte.GREEN_HOUSE: 'n/a',
cte.INDUSTRY: 'BA Manufacturing Facility',
cte.WORKSHOP: 'BA Workshop',
cte.WAREHOUSE: 'BA Warehouse',
cte.WAREHOUSE_REFRIGERATED: 'BA Warehouse',
cte.SPORTS_LOCATION: 'BA Exercise Center',
cte.SPORTS_ARENA: 'BA Sports Arena',
cte.GYMNASIUM: 'BA Gymnasium',
cte.MOTION_PICTURE_THEATRE: 'BA Motion Picture Theater',
cte.MUSEUM: 'BA Museum',
cte.PERFORMING_ARTS_THEATRE: 'BA Performing Arts Theater',
cte.TRANSPORTATION: 'BA Transportation',
cte.AUTOMOTIVE_FACILITY: 'BA Automotive Facility',
cte.PARKING_GARAGE: 'BA Parking Garage',
cte.RELIGIOUS: 'BA Religious Building',
cte.NON_HEATED: 'n/a'
}
_usage_to_nrcan_usage = {
cte.RESIDENTIAL: 'Multi-unit residential building',
cte.SINGLE_FAMILY_HOUSE: 'Multi-unit residential building',
cte.MULTI_FAMILY_HOUSE: 'Multi-unit residential building',
cte.ROW_HOUSE: 'Multi-unit residential building',
cte.MID_RISE_APARTMENT: 'Multi-unit residential building',
cte.HIGH_RISE_APARTMENT: 'Multi-unit residential building',
cte.OFFICE_AND_ADMINISTRATION: 'Office',
cte.SMALL_OFFICE: 'Office',
cte.MEDIUM_OFFICE: 'Office',
cte.LARGE_OFFICE: 'Office',
cte.COURTHOUSE: 'Courthouse',
cte.FIRE_STATION: 'Fire station',
cte.PENITENTIARY: 'Penitentiary',
cte.POLICE_STATION: 'Police station',
cte.POST_OFFICE: 'Post office',
cte.LIBRARY: 'Library',
cte.EDUCATION: 'School/university',
cte.PRIMARY_SCHOOL: 'School/university',
cte.PRIMARY_SCHOOL_WITH_SHOWER: 'School/university',
cte.SECONDARY_SCHOOL: 'School/university',
cte.UNIVERSITY: 'School/university',
cte.LABORATORY_AND_RESEARCH_CENTER: 'School/university',
cte.STAND_ALONE_RETAIL: 'Retail',
cte.HOSPITAL: 'Hospital',
cte.OUT_PATIENT_HEALTH_CARE: 'Health-care clinic',
cte.HEALTH_CARE: 'Health-care clinic',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'Health-care clinic',
cte.COMMERCIAL: 'Retail',
cte.STRIP_MALL: 'Retail',
cte.SUPERMARKET: 'Retail',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'Retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'Retail',
cte.RESTAURANT: 'Dining - bar/lounge',
cte.QUICK_SERVICE_RESTAURANT: 'Dining - cafeteria',
cte.FULL_SERVICE_RESTAURANT: 'Dining - bar/lounge',
cte.HOTEL: 'Hotel',
cte.HOTEL_MEDIUM_CLASS: 'Motel',
cte.SMALL_HOTEL: 'Motel',
cte.LARGE_HOTEL: 'Hotel',
cte.DORMITORY: 'Dormitory',
cte.EVENT_LOCATION: 'Convention centre',
cte.CONVENTION_CENTER: 'Convention centre',
cte.HALL: 'Town hall',
cte.GREEN_HOUSE: 'n/a',
cte.INDUSTRY: 'Manufacturing facility',
cte.WORKSHOP: 'Workshop',
cte.WAREHOUSE: 'Warehouse',
cte.WAREHOUSE_REFRIGERATED: 'Warehouse - refrigerated',
cte.SPORTS_LOCATION: 'Exercise centre',
cte.SPORTS_ARENA: 'Sports arena',
cte.GYMNASIUM: 'Gymnasium',
cte.MOTION_PICTURE_THEATRE: 'Motion picture theatre',
cte.MUSEUM: 'Museum',
cte.PERFORMING_ARTS_THEATRE: 'Performing arts theatre',
cte.TRANSPORTATION: 'Transportation',
cte.AUTOMOTIVE_FACILITY: 'Automotive facility',
cte.PARKING_GARAGE: 'Parking garage',
cte.RELIGIOUS: 'Religious',
cte.NON_HEATED: 'n/a'
}
_function_to_nrcan_construction_function = {
cte.RESIDENTIAL: 'MidriseApartment',
cte.SINGLE_FAMILY_HOUSE: 'MidriseApartment',
cte.MULTI_FAMILY_HOUSE: 'HighriseApartment',
cte.ROW_HOUSE: 'MidriseApartment',
cte.MID_RISE_APARTMENT: 'MidriseApartment',
cte.HIGH_RISE_APARTMENT: 'HighriseApartment',
cte.OFFICE_AND_ADMINISTRATION: 'MediumOffice',
cte.SMALL_OFFICE: 'SmallOffice',
cte.MEDIUM_OFFICE: 'MediumOffice',
cte.LARGE_OFFICE: 'LargeOffice',
cte.COURTHOUSE: 'MediumOffice',
cte.FIRE_STATION: 'n/a',
cte.PENITENTIARY: 'LargeHotel',
cte.POLICE_STATION: 'n/a',
cte.POST_OFFICE: 'MediumOffice',
cte.LIBRARY: 'MediumOffice',
cte.EDUCATION: 'SecondarySchool',
cte.PRIMARY_SCHOOL: 'PrimarySchool',
cte.PRIMARY_SCHOOL_WITH_SHOWER: 'PrimarySchool',
cte.SECONDARY_SCHOOL: 'SecondarySchool',
cte.UNIVERSITY: 'SecondarySchool',
cte.LABORATORY_AND_RESEARCH_CENTER: 'SecondarySchool',
cte.STAND_ALONE_RETAIL: 'RetailStandalone',
cte.HOSPITAL: 'Hospital',
cte.OUT_PATIENT_HEALTH_CARE: 'Outpatient',
cte.HEALTH_CARE: 'Outpatient',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'SmallHotel',
cte.COMMERCIAL: 'RetailStripmall',
cte.STRIP_MALL: 'RetailStripmall',
cte.SUPERMARKET: 'RetailStripmall',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'RetailStandalone',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'RetailStandalone',
cte.RESTAURANT: 'FullServiceRestaurant',
cte.QUICK_SERVICE_RESTAURANT: 'QuickServiceRestaurant',
cte.FULL_SERVICE_RESTAURANT: 'FullServiceRestaurant',
cte.HOTEL: 'SmallHotel',
cte.HOTEL_MEDIUM_CLASS: 'SmallHotel',
cte.SMALL_HOTEL: 'SmallHotel',
cte.LARGE_HOTEL: 'LargeHotel',
cte.DORMITORY: 'SmallHotel',
cte.EVENT_LOCATION: 'n/a',
cte.CONVENTION_CENTER: 'n/a',
cte.HALL: 'n/a',
cte.GREEN_HOUSE: 'n/a',
cte.INDUSTRY: 'n/a',
cte.WORKSHOP: 'n/a',
cte.WAREHOUSE: 'Warehouse',
cte.WAREHOUSE_REFRIGERATED: 'Warehouse',
cte.SPORTS_LOCATION: 'n/a',
cte.SPORTS_ARENA: 'n/a',
cte.GYMNASIUM: 'n/a',
cte.MOTION_PICTURE_THEATRE: 'n/a',
cte.MUSEUM: 'n/a',
cte.PERFORMING_ARTS_THEATRE: 'n/a',
cte.TRANSPORTATION: 'n/a',
cte.AUTOMOTIVE_FACILITY: 'n/a',
cte.PARKING_GARAGE: 'n/a',
cte.RELIGIOUS: 'n/a',
cte.NON_HEATED: 'n/a'
}
_function_to_nrel_construction_function = {
cte.RESIDENTIAL: 'residential',
cte.SINGLE_FAMILY_HOUSE: 'residential',
cte.MULTI_FAMILY_HOUSE: 'midrise apartment',
cte.ROW_HOUSE: 'midrise apartment',
cte.MID_RISE_APARTMENT: 'midrise apartment',
cte.HIGH_RISE_APARTMENT: 'high-rise apartment',
cte.OFFICE_AND_ADMINISTRATION: 'medium office',
cte.SMALL_OFFICE: 'small office',
cte.MEDIUM_OFFICE: 'medium office',
cte.LARGE_OFFICE: 'large office',
cte.COURTHOUSE: 'medium office',
cte.FIRE_STATION: 'n/a',
cte.PENITENTIARY: 'large hotel',
cte.POLICE_STATION: 'n/a',
cte.POST_OFFICE: 'medium office',
cte.LIBRARY: 'medium office',
cte.EDUCATION: 'secondary school',
cte.PRIMARY_SCHOOL: 'primary school',
cte.PRIMARY_SCHOOL_WITH_SHOWER: 'primary school',
cte.SECONDARY_SCHOOL: 'secondary school',
cte.UNIVERSITY: 'secondary school',
cte.LABORATORY_AND_RESEARCH_CENTER: 'secondary school',
cte.STAND_ALONE_RETAIL: 'stand-alone retail',
cte.HOSPITAL: 'hospital',
cte.OUT_PATIENT_HEALTH_CARE: 'outpatient healthcare',
cte.HEALTH_CARE: 'outpatient healthcare',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'small hotel',
cte.COMMERCIAL: 'strip mall',
cte.STRIP_MALL: 'strip mall',
cte.SUPERMARKET: 'supermarket',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'stand-alone retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'stand-alone retail',
cte.RESTAURANT: 'full service restaurant',
cte.QUICK_SERVICE_RESTAURANT: 'quick service restaurant',
cte.FULL_SERVICE_RESTAURANT: 'full service restaurant',
cte.HOTEL: 'small hotel',
cte.HOTEL_MEDIUM_CLASS: 'small hotel',
cte.SMALL_HOTEL: 'small hotel',
cte.LARGE_HOTEL: 'large hotel',
cte.DORMITORY: 'small hotel',
cte.EVENT_LOCATION: 'n/a',
cte.CONVENTION_CENTER: 'n/a',
cte.HALL: 'n/a',
cte.GREEN_HOUSE: 'n/a',
cte.INDUSTRY: 'n/a',
cte.WORKSHOP: 'n/a',
cte.WAREHOUSE: 'warehouse',
cte.WAREHOUSE_REFRIGERATED: 'warehouse',
cte.SPORTS_LOCATION: 'n/a',
cte.SPORTS_ARENA: 'n/a',
cte.GYMNASIUM: 'n/a',
cte.MOTION_PICTURE_THEATRE: 'n/a',
cte.MUSEUM: 'n/a',
cte.PERFORMING_ARTS_THEATRE: 'n/a',
cte.TRANSPORTATION: 'n/a',
cte.AUTOMOTIVE_FACILITY: 'n/a',
cte.PARKING_GARAGE: 'n/a',
cte.RELIGIOUS: 'n/a',
cte.NON_HEATED: 'n/a'
}
_pluto_function_to_hub_function = {
'A0': cte.SINGLE_FAMILY_HOUSE,
'A1': cte.SINGLE_FAMILY_HOUSE,
'A2': cte.SINGLE_FAMILY_HOUSE,
'A3': cte.SINGLE_FAMILY_HOUSE,
'A4': cte.SINGLE_FAMILY_HOUSE,
'A5': cte.SINGLE_FAMILY_HOUSE,
'A6': cte.SINGLE_FAMILY_HOUSE,
'A7': cte.SINGLE_FAMILY_HOUSE,
'A8': cte.SINGLE_FAMILY_HOUSE,
'A9': cte.SINGLE_FAMILY_HOUSE,
'B1': cte.MULTI_FAMILY_HOUSE,
'B2': cte.MULTI_FAMILY_HOUSE,
'B3': cte.MULTI_FAMILY_HOUSE,
'B9': cte.MULTI_FAMILY_HOUSE,
'C0': cte.RESIDENTIAL,
'C1': cte.RESIDENTIAL,
'C2': cte.RESIDENTIAL,
'C3': cte.RESIDENTIAL,
'C4': cte.RESIDENTIAL,
'C5': cte.RESIDENTIAL,
'C6': cte.RESIDENTIAL,
'C7': cte.RESIDENTIAL,
'C8': cte.RESIDENTIAL,
'C9': cte.RESIDENTIAL,
'D0': cte.RESIDENTIAL,
'D1': cte.RESIDENTIAL,
'D2': cte.RESIDENTIAL,
'D3': cte.RESIDENTIAL,
'D4': cte.RESIDENTIAL,
'D5': cte.RESIDENTIAL,
'D6': cte.RESIDENTIAL,
'D7': cte.RESIDENTIAL,
'D8': cte.RESIDENTIAL,
'D9': cte.RESIDENTIAL,
'E1': cte.WAREHOUSE,
'E3': cte.WAREHOUSE,
'E4': cte.WAREHOUSE,
'E5': cte.WAREHOUSE,
'E7': cte.WAREHOUSE,
'E9': cte.WAREHOUSE,
'F1': cte.WAREHOUSE,
'F2': cte.WAREHOUSE,
'F4': cte.WAREHOUSE,
'F5': cte.WAREHOUSE,
'F8': cte.WAREHOUSE,
'F9': cte.WAREHOUSE,
'G0': cte.SMALL_OFFICE,
'G1': cte.SMALL_OFFICE,
'G2': cte.SMALL_OFFICE,
'G3': cte.SMALL_OFFICE,
'G4': cte.SMALL_OFFICE,
'G5': cte.SMALL_OFFICE,
'G6': cte.SMALL_OFFICE,
'G7': cte.SMALL_OFFICE,
'G8': cte.SMALL_OFFICE,
'G9': cte.SMALL_OFFICE,
'H1': cte.HOTEL,
'H2': cte.HOTEL,
'H3': cte.HOTEL,
'H4': cte.HOTEL,
'H5': cte.HOTEL,
'H6': cte.HOTEL,
'H7': cte.HOTEL,
'H8': cte.HOTEL,
'H9': cte.HOTEL,
'HB': cte.HOTEL,
'HH': cte.HOTEL,
'HR': cte.HOTEL,
'HS': cte.HOTEL,
'I1': cte.HOSPITAL,
'I2': cte.OUT_PATIENT_HEALTH_CARE,
'I3': cte.OUT_PATIENT_HEALTH_CARE,
'I4': cte.RESIDENTIAL,
'I5': cte.OUT_PATIENT_HEALTH_CARE,
'I6': cte.OUT_PATIENT_HEALTH_CARE,
'I7': cte.OUT_PATIENT_HEALTH_CARE,
'I9': cte.OUT_PATIENT_HEALTH_CARE,
'J1': cte.LARGE_OFFICE,
'J2': cte.LARGE_OFFICE,
'J3': cte.LARGE_OFFICE,
'J4': cte.LARGE_OFFICE,
'J5': cte.LARGE_OFFICE,
'J6': cte.LARGE_OFFICE,
'J7': cte.LARGE_OFFICE,
'J8': cte.LARGE_OFFICE,
'J9': cte.LARGE_OFFICE,
'K1': cte.STRIP_MALL,
'K2': cte.STRIP_MALL,
'K3': cte.STRIP_MALL,
'K4': cte.RESIDENTIAL,
'K5': cte.RESTAURANT,
'K6': cte.SUPERMARKET,
'K7': cte.SUPERMARKET,
'K8': cte.SUPERMARKET,
'K9': cte.SUPERMARKET,
'L1': cte.RESIDENTIAL,
'L2': cte.RESIDENTIAL,
'L3': cte.RESIDENTIAL,
'L8': cte.RESIDENTIAL,
'L9': cte.RESIDENTIAL,
'M1': cte.LARGE_OFFICE,
'M2': cte.LARGE_OFFICE,
'M3': cte.LARGE_OFFICE,
'M4': cte.LARGE_OFFICE,
'M9': cte.LARGE_OFFICE,
'N1': cte.RESIDENTIAL,
'N2': cte.RESIDENTIAL,
'N3': cte.RESIDENTIAL,
'N4': cte.RESIDENTIAL,
'N9': cte.RESIDENTIAL,
'O1': cte.SMALL_OFFICE,
'O2': cte.SMALL_OFFICE,
'O3': cte.SMALL_OFFICE,
'O4': cte.SMALL_OFFICE,
'O5': cte.SMALL_OFFICE,
'O6': cte.SMALL_OFFICE,
'O7': cte.SMALL_OFFICE,
'O8': cte.SMALL_OFFICE,
'O9': cte.SMALL_OFFICE,
'P1': cte.LARGE_OFFICE,
'P2': cte.HOTEL,
'P3': cte.SMALL_OFFICE,
'P4': cte.SMALL_OFFICE,
'P5': cte.SMALL_OFFICE,
'P6': cte.SMALL_OFFICE,
'P7': cte.LARGE_OFFICE,
'P8': cte.LARGE_OFFICE,
'P9': cte.SMALL_OFFICE,
'Q0': cte.SMALL_OFFICE,
'Q1': cte.SMALL_OFFICE,
'Q2': cte.SMALL_OFFICE,
'Q3': cte.SMALL_OFFICE,
'Q4': cte.SMALL_OFFICE,
'Q5': cte.SMALL_OFFICE,
'Q6': cte.SMALL_OFFICE,
'Q7': cte.SMALL_OFFICE,
'Q8': cte.SMALL_OFFICE,
'Q9': cte.SMALL_OFFICE,
'R0': cte.RESIDENTIAL,
'R1': cte.RESIDENTIAL,
'R2': cte.RESIDENTIAL,
'R3': cte.RESIDENTIAL,
'R4': cte.RESIDENTIAL,
'R5': cte.RESIDENTIAL,
'R6': cte.RESIDENTIAL,
'R7': cte.RESIDENTIAL,
'R8': cte.RESIDENTIAL,
'R9': cte.RESIDENTIAL,
'RA': cte.RESIDENTIAL,
'RB': cte.RESIDENTIAL,
'RC': cte.RESIDENTIAL,
'RD': cte.RESIDENTIAL,
'RG': cte.RESIDENTIAL,
'RH': cte.RESIDENTIAL,
'RI': cte.RESIDENTIAL,
'RK': cte.RESIDENTIAL,
'RM': cte.RESIDENTIAL,
'RR': cte.RESIDENTIAL,
'RS': cte.RESIDENTIAL,
'RW': cte.RESIDENTIAL,
'RX': cte.RESIDENTIAL,
'RZ': cte.RESIDENTIAL,
'S0': cte.RESIDENTIAL,
'S1': cte.RESIDENTIAL,
'S2': cte.RESIDENTIAL,
'S3': cte.RESIDENTIAL,
'S4': cte.RESIDENTIAL,
'S5': cte.RESIDENTIAL,
'S9': cte.RESIDENTIAL,
'U0': cte.WAREHOUSE,
'U1': cte.WAREHOUSE,
'U2': cte.WAREHOUSE,
'U3': cte.WAREHOUSE,
'U4': cte.WAREHOUSE,
'U5': cte.WAREHOUSE,
'U6': cte.WAREHOUSE,
'U7': cte.WAREHOUSE,
'U8': cte.WAREHOUSE,
'U9': cte.WAREHOUSE,
'W1': cte.PRIMARY_SCHOOL,
'W2': cte.PRIMARY_SCHOOL,
'W3': cte.SECONDARY_SCHOOL,
'W4': cte.EDUCATION,
'W5': cte.SECONDARY_SCHOOL,
'W6': cte.SECONDARY_SCHOOL,
'W7': cte.SECONDARY_SCHOOL,
'W8': cte.PRIMARY_SCHOOL,
'W9': cte.SECONDARY_SCHOOL,
'Y1': cte.LARGE_OFFICE,
'Y2': cte.LARGE_OFFICE,
'Y3': cte.LARGE_OFFICE,
'Y4': cte.LARGE_OFFICE,
'Y5': cte.LARGE_OFFICE,
'Y6': cte.LARGE_OFFICE,
'Y7': cte.LARGE_OFFICE,
'Y8': cte.LARGE_OFFICE,
'Y9': cte.LARGE_OFFICE,
'Z1': cte.LARGE_OFFICE
}
_hft_function_to_hub_function = {
'residential': cte.RESIDENTIAL,
'single family house': cte.SINGLE_FAMILY_HOUSE,
'multifamily house': cte.MULTI_FAMILY_HOUSE,
'hotel': cte.HOTEL,
'hospital': cte.HOSPITAL,
'outpatient': cte.OUT_PATIENT_HEALTH_CARE,
'commercial': cte.SUPERMARKET,
'strip mall': cte.STRIP_MALL,
'warehouse': cte.WAREHOUSE,
'primary school': cte.PRIMARY_SCHOOL,
'secondary school': cte.EDUCATION,
'office': cte.MEDIUM_OFFICE,
'large office': cte.LARGE_OFFICE
}
@property
def hub_usage_to_hft_usage(self):
"""
Get HfT usage from the given internal usage
:return: dict
"""
return self._usage_to_hft_usage
@property
def hub_usage_to_comnet_usage(self):
"""
Get Comnet usage from the given internal usage
:return: dict
"""
return self._usage_to_comnet_usage
@property
def hub_usage_to_nrcan_usage(self):
"""
Get Nrcan usage from the given internal usage
:return: dict
"""
return self._usage_to_nrcan_usage
@property
def hub_function_to_nrcan_construction_function(self):
"""
Get Nrcan construction function from the given internal function
:return: dict
"""
return self._function_to_nrcan_construction_function
@property
def hub_function_to_nrel_construction_function(self):
"""
Get Nrel construction function from the given internal function
:return: dict
"""
return self._function_to_nrel_construction_function
@property
def pluto_function_to_hub_function(self):
"""
Set internal function from pluto standard
:return: dict
"""
return self._pluto_function_to_hub_function
@property
def hft_function_to_hub_function(self):
"""
Set internal function from functions used in hft files
:return: dict
"""
return self._hft_function_to_hub_function

View File

@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
from helpers import constants as cte
@ -13,31 +13,6 @@ class ConstructionHelper:
Construction helper
"""
# NREL
_function_to_nrel = {
cte.RESIDENTIAL: 'residential',
cte.SINGLE_FAMILY_HOUSE: 'residential',
cte.MULTI_FAMILY_HOUSE: 'residential',
cte.ROW_HOSE: 'residential',
cte.MID_RISE_APARTMENT: 'midrise apartment',
cte.HIGH_RISE_APARTMENT: 'high-rise apartment',
cte.SMALL_OFFICE: 'small office',
cte.MEDIUM_OFFICE: 'medium office',
cte.LARGE_OFFICE: 'large office',
cte.EDUCATION: 'primary school',
cte.PRIMARY_SCHOOL: 'primary school',
cte.SECONDARY_SCHOOL: 'secondary school',
cte.STAND_ALONE_RETAIL: 'stand-alone retail',
cte.HOSPITAL: 'hospital',
cte.OUT_PATIENT_HEALTH_CARE: 'outpatient healthcare',
cte.STRIP_MALL: 'strip mall',
cte.SUPERMARKET: 'supermarket',
cte.WAREHOUSE: 'warehouse',
cte.QUICK_SERVICE_RESTAURANT: 'quick service restaurant',
cte.FULL_SERVICE_RESTAURANT: 'full service restaurant',
cte.SMALL_HOTEL: 'small hotel',
cte.LARGE_HOTEL: 'large hotel'
}
_nrel_standards = {
'ASHRAE Std189': 1,
'ASHRAE 90.1_2004': 2
@ -72,18 +47,6 @@ class ConstructionHelper:
cte.ROOF: 'roof'
}
@staticmethod
def nrel_from_libs_function(function):
"""
Get NREL function from the given internal function key
:param function: str
:return: str
"""
try:
return ConstructionHelper._function_to_nrel[function]
except KeyError:
sys.stderr.write('Error: keyword not found.\n')
@staticmethod
def yoc_to_nrel_standard(year_of_construction):
"""
@ -118,4 +81,4 @@ class ConstructionHelper:
:return: str
"""
reference_city = ConstructionHelper.city_to_reference_city(city)
return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city]
return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city]

View File

@ -9,6 +9,7 @@ import sys
from catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
from city_model_structure.building_demand.layer import Layer
from city_model_structure.building_demand.material import Material
from helpers.dictionaries import Dictionaries
from imports.construction.helpers.construction_helper import ConstructionHelper
from imports.construction.helpers.storeys_generation import StoreysGeneration
@ -31,7 +32,7 @@ class NrcanPhysicsParameters:
canel_catalog = ConstructionCatalogFactory('nrcan').catalog
for building in city.buildings:
try:
function = ConstructionHelper().nrel_from_libs_function(building.function)
function = Dictionaries().hub_function_to_nrcan_construction_function[building.function]
archetype = self._search_archetype(canel_catalog, function, building.year_of_construction,
self._climate_zone)
except KeyError:

View File

@ -10,6 +10,7 @@ import sys
from catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
from city_model_structure.building_demand.layer import Layer
from city_model_structure.building_demand.material import Material
from helpers.dictionaries import Dictionaries
from imports.construction.helpers.construction_helper import ConstructionHelper
from imports.construction.helpers.storeys_generation import StoreysGeneration
@ -22,6 +23,7 @@ class NrelPhysicsParameters:
self._city = city
self._path = base_path
self._divide_in_storeys = divide_in_storeys
print(city.name)
self._climate_zone = ConstructionHelper.city_to_nrel_climate_zone(city.name)
def enrich_buildings(self):
@ -32,7 +34,7 @@ class NrelPhysicsParameters:
nrel_catalog = ConstructionCatalogFactory('nrel').catalog
for building in city.buildings:
try:
function = ConstructionHelper().nrel_from_libs_function(building.function)
function = Dictionaries().hub_function_to_nrel_construction_function[building.function]
archetype = self._search_archetype(nrel_catalog, function, building.year_of_construction,
self._climate_zone)
except KeyError:

View File

@ -4,15 +4,12 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
import math
import sys
import numpy as np
import xmltodict
from city_model_structure.city import City
from city_model_structure.building import Building
from city_model_structure.parts_consisting_building import PartsConsistingBuilding
from helpers.geometry_helper import GeometryHelper
from imports.geometry.citygml_classes.citygml_lod2 import CityGmlLod2
from imports.geometry.citygml_classes.citygml_lod1 import CityGmlLod1
@ -56,7 +53,6 @@ class CityGml:
}, force_list=force_list)
self._city_objects = None
self._geometry = GeometryHelper()
if 'boundedBy' in self._gml['CityModel']:
for bound in self._gml['CityModel']['boundedBy']:
envelope = bound['Envelope']

View File

@ -6,8 +6,6 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from abc import ABC
import numpy as np
from imports.geometry.helpers.geometry_helper import GeometryHelper
class CityGmlBase(ABC):

View File

@ -5,7 +5,6 @@ Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import helpers.constants as cte
import numpy as np
@ -13,280 +12,6 @@ class GeometryHelper:
"""
Geometry helper
"""
# function
_pluto_to_function = {
'A0': cte.SINGLE_FAMILY_HOUSE,
'A1': cte.SINGLE_FAMILY_HOUSE,
'A2': cte.SINGLE_FAMILY_HOUSE,
'A3': cte.SINGLE_FAMILY_HOUSE,
'A4': cte.SINGLE_FAMILY_HOUSE,
'A5': cte.SINGLE_FAMILY_HOUSE,
'A6': cte.SINGLE_FAMILY_HOUSE,
'A7': cte.SINGLE_FAMILY_HOUSE,
'A8': cte.SINGLE_FAMILY_HOUSE,
'A9': cte.SINGLE_FAMILY_HOUSE,
'B1': cte.MULTI_FAMILY_HOUSE,
'B2': cte.MULTI_FAMILY_HOUSE,
'B3': cte.MULTI_FAMILY_HOUSE,
'B9': cte.MULTI_FAMILY_HOUSE,
'C0': cte.RESIDENTIAL,
'C1': cte.RESIDENTIAL,
'C2': cte.RESIDENTIAL,
'C3': cte.RESIDENTIAL,
'C4': cte.RESIDENTIAL,
'C5': cte.RESIDENTIAL,
'C6': cte.RESIDENTIAL,
'C7': cte.RESIDENTIAL,
'C8': cte.RESIDENTIAL,
'C9': cte.RESIDENTIAL,
'D0': cte.RESIDENTIAL,
'D1': cte.RESIDENTIAL,
'D2': cte.RESIDENTIAL,
'D3': cte.RESIDENTIAL,
'D4': cte.RESIDENTIAL,
'D5': cte.RESIDENTIAL,
'D6': cte.RESIDENTIAL,
'D7': cte.RESIDENTIAL,
'D8': cte.RESIDENTIAL,
'D9': cte.RESIDENTIAL,
'E1': cte.WAREHOUSE,
'E3': cte.WAREHOUSE,
'E4': cte.WAREHOUSE,
'E5': cte.WAREHOUSE,
'E7': cte.WAREHOUSE,
'E9': cte.WAREHOUSE,
'F1': cte.WAREHOUSE,
'F2': cte.WAREHOUSE,
'F4': cte.WAREHOUSE,
'F5': cte.WAREHOUSE,
'F8': cte.WAREHOUSE,
'F9': cte.WAREHOUSE,
'G0': cte.SMALL_OFFICE,
'G1': cte.SMALL_OFFICE,
'G2': cte.SMALL_OFFICE,
'G3': cte.SMALL_OFFICE,
'G4': cte.SMALL_OFFICE,
'G5': cte.SMALL_OFFICE,
'G6': cte.SMALL_OFFICE,
'G7': cte.SMALL_OFFICE,
'G8': cte.SMALL_OFFICE,
'G9': cte.SMALL_OFFICE,
'H1': cte.HOTEL,
'H2': cte.HOTEL,
'H3': cte.HOTEL,
'H4': cte.HOTEL,
'H5': cte.HOTEL,
'H6': cte.HOTEL,
'H7': cte.HOTEL,
'H8': cte.HOTEL,
'H9': cte.HOTEL,
'HB': cte.HOTEL,
'HH': cte.HOTEL,
'HR': cte.HOTEL,
'HS': cte.HOTEL,
'I1': cte.HOSPITAL,
'I2': cte.OUT_PATIENT_HEALTH_CARE,
'I3': cte.OUT_PATIENT_HEALTH_CARE,
'I4': cte.RESIDENTIAL,
'I5': cte.OUT_PATIENT_HEALTH_CARE,
'I6': cte.OUT_PATIENT_HEALTH_CARE,
'I7': cte.OUT_PATIENT_HEALTH_CARE,
'I9': cte.OUT_PATIENT_HEALTH_CARE,
'J1': cte.LARGE_OFFICE,
'J2': cte.LARGE_OFFICE,
'J3': cte.LARGE_OFFICE,
'J4': cte.LARGE_OFFICE,
'J5': cte.LARGE_OFFICE,
'J6': cte.LARGE_OFFICE,
'J7': cte.LARGE_OFFICE,
'J8': cte.LARGE_OFFICE,
'J9': cte.LARGE_OFFICE,
'K1': cte.STRIP_MALL,
'K2': cte.STRIP_MALL,
'K3': cte.STRIP_MALL,
'K4': cte.RESIDENTIAL,
'K5': cte.RESTAURANT,
'K6': cte.SUPERMARKET,
'K7': cte.SUPERMARKET,
'K8': cte.SUPERMARKET,
'K9': cte.SUPERMARKET,
'L1': cte.RESIDENTIAL,
'L2': cte.RESIDENTIAL,
'L3': cte.RESIDENTIAL,
'L8': cte.RESIDENTIAL,
'L9': cte.RESIDENTIAL,
'M1': cte.LARGE_OFFICE,
'M2': cte.LARGE_OFFICE,
'M3': cte.LARGE_OFFICE,
'M4': cte.LARGE_OFFICE,
'M9': cte.LARGE_OFFICE,
'N1': cte.RESIDENTIAL,
'N2': cte.RESIDENTIAL,
'N3': cte.RESIDENTIAL,
'N4': cte.RESIDENTIAL,
'N9': cte.RESIDENTIAL,
'O1': cte.SMALL_OFFICE,
'O2': cte.SMALL_OFFICE,
'O3': cte.SMALL_OFFICE,
'O4': cte.SMALL_OFFICE,
'O5': cte.SMALL_OFFICE,
'O6': cte.SMALL_OFFICE,
'O7': cte.SMALL_OFFICE,
'O8': cte.SMALL_OFFICE,
'O9': cte.SMALL_OFFICE,
'P1': cte.LARGE_OFFICE,
'P2': cte.HOTEL,
'P3': cte.SMALL_OFFICE,
'P4': cte.SMALL_OFFICE,
'P5': cte.SMALL_OFFICE,
'P6': cte.SMALL_OFFICE,
'P7': cte.LARGE_OFFICE,
'P8': cte.LARGE_OFFICE,
'P9': cte.SMALL_OFFICE,
'Q0': cte.SMALL_OFFICE,
'Q1': cte.SMALL_OFFICE,
'Q2': cte.SMALL_OFFICE,
'Q3': cte.SMALL_OFFICE,
'Q4': cte.SMALL_OFFICE,
'Q5': cte.SMALL_OFFICE,
'Q6': cte.SMALL_OFFICE,
'Q7': cte.SMALL_OFFICE,
'Q8': cte.SMALL_OFFICE,
'Q9': cte.SMALL_OFFICE,
'R0': cte.RESIDENTIAL,
'R1': cte.RESIDENTIAL,
'R2': cte.RESIDENTIAL,
'R3': cte.RESIDENTIAL,
'R4': cte.RESIDENTIAL,
'R5': cte.RESIDENTIAL,
'R6': cte.RESIDENTIAL,
'R7': cte.RESIDENTIAL,
'R8': cte.RESIDENTIAL,
'R9': cte.RESIDENTIAL,
'RA': cte.RESIDENTIAL,
'RB': cte.RESIDENTIAL,
'RC': cte.RESIDENTIAL,
'RD': cte.RESIDENTIAL,
'RG': cte.RESIDENTIAL,
'RH': cte.RESIDENTIAL,
'RI': cte.RESIDENTIAL,
'RK': cte.RESIDENTIAL,
'RM': cte.RESIDENTIAL,
'RR': cte.RESIDENTIAL,
'RS': cte.RESIDENTIAL,
'RW': cte.RESIDENTIAL,
'RX': cte.RESIDENTIAL,
'RZ': cte.RESIDENTIAL,
'S0': cte.RESIDENTIAL,
'S1': cte.RESIDENTIAL,
'S2': cte.RESIDENTIAL,
'S3': cte.RESIDENTIAL,
'S4': cte.RESIDENTIAL,
'S5': cte.RESIDENTIAL,
'S9': cte.RESIDENTIAL,
'U0': cte.WAREHOUSE,
'U1': cte.WAREHOUSE,
'U2': cte.WAREHOUSE,
'U3': cte.WAREHOUSE,
'U4': cte.WAREHOUSE,
'U5': cte.WAREHOUSE,
'U6': cte.WAREHOUSE,
'U7': cte.WAREHOUSE,
'U8': cte.WAREHOUSE,
'U9': cte.WAREHOUSE,
'W1': cte.PRIMARY_SCHOOL,
'W2': cte.PRIMARY_SCHOOL,
'W3': cte.SECONDARY_SCHOOL,
'W4': cte.EDUCATION,
'W5': cte.SECONDARY_SCHOOL,
'W6': cte.SECONDARY_SCHOOL,
'W7': cte.SECONDARY_SCHOOL,
'W8': cte.PRIMARY_SCHOOL,
'W9': cte.SECONDARY_SCHOOL,
'Y1': cte.LARGE_OFFICE,
'Y2': cte.LARGE_OFFICE,
'Y3': cte.LARGE_OFFICE,
'Y4': cte.LARGE_OFFICE,
'Y5': cte.LARGE_OFFICE,
'Y6': cte.LARGE_OFFICE,
'Y7': cte.LARGE_OFFICE,
'Y8': cte.LARGE_OFFICE,
'Y9': cte.LARGE_OFFICE,
'Z1': cte.LARGE_OFFICE
}
_hft_to_function = {
'residential': cte.RESIDENTIAL,
'single family house': cte.SINGLE_FAMILY_HOUSE,
'multifamily house': cte.MULTI_FAMILY_HOUSE,
'hotel': cte.HOTEL,
'hospital': cte.HOSPITAL,
'outpatient': cte.OUT_PATIENT_HEALTH_CARE,
'commercial': cte.SUPERMARKET,
'strip mall': cte.STRIP_MALL,
'warehouse': cte.WAREHOUSE,
'primary school': cte.PRIMARY_SCHOOL,
'secondary school': cte.EDUCATION,
'office': cte.MEDIUM_OFFICE,
'large office': cte.LARGE_OFFICE
}
# function
_alkis_to_function = {
}
# usage
_function_to_usage = {
cte.RESIDENTIAL: cte.RESIDENTIAL,
cte.SINGLE_FAMILY_HOUSE: cte.SINGLE_FAMILY_HOUSE,
cte.MULTI_FAMILY_HOUSE: cte.MULTI_FAMILY_HOUSE,
cte.ROW_HOSE: cte.RESIDENTIAL,
cte.MID_RISE_APARTMENT: cte.RESIDENTIAL,
cte.HIGH_RISE_APARTMENT: cte.RESIDENTIAL,
cte.SMALL_OFFICE: cte.OFFICE_AND_ADMINISTRATION,
cte.MEDIUM_OFFICE: cte.OFFICE_AND_ADMINISTRATION,
cte.LARGE_OFFICE: cte.OFFICE_AND_ADMINISTRATION,
cte.PRIMARY_SCHOOL: cte.EDUCATION,
cte.SECONDARY_SCHOOL: cte.EDUCATION,
cte.STAND_ALONE_RETAIL: cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
cte.HOSPITAL: cte.HEALTH_CARE,
cte.OUT_PATIENT_HEALTH_CARE: cte.HEALTH_CARE,
cte.STRIP_MALL: cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
cte.SUPERMARKET: cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
cte.WAREHOUSE: cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
cte.QUICK_SERVICE_RESTAURANT: cte.RESTAURANT,
cte.FULL_SERVICE_RESTAURANT: cte.RESTAURANT,
cte.SMALL_HOTEL: cte.HOTEL,
cte.LARGE_HOTEL: cte.HOTEL,
cte.INDUSTRY:cte.INDUSTRY
}
@staticmethod
def libs_function_from_hft(building_hft_function):
"""
Get internal function from the given HfT function
:param building_hft_function: str
:return: str
"""
return GeometryHelper._hft_to_function[building_hft_function]
@staticmethod
def libs_function_from_pluto(building_pluto_function):
"""
Get internal function from the given pluto function
:param building_pluto_function: str
:return: str
"""
return GeometryHelper._pluto_to_function[building_pluto_function]
@staticmethod
def libs_usage_from_libs_function(building_function):
"""
Get the internal usage for the given internal building function
:param building_function: str
:return: str
"""
return GeometryHelper._function_to_usage[building_function]
@staticmethod
def to_points_matrix(points):
"""

View File

@ -9,7 +9,7 @@ import sys
import numpy
import helpers.constants as cte
from imports.usage.helpers.usage_helper import UsageHelper
from helpers.dictionaries import Dictionaries
from city_model_structure.building_demand.usage import Usage
from city_model_structure.building_demand.lighting import Lighting
from city_model_structure.building_demand.occupancy import Occupancy
@ -36,7 +36,7 @@ class ComnetUsageParameters:
city = self._city
comnet_catalog = UsageCatalogFactory('comnet').catalog
for building in city.buildings:
usage_name = UsageHelper.comnet_from_hub_usage(building.function)
usage_name = Dictionaries().hub_usage_to_comnet_usage[building.function]
try:
archetype_usage = self._search_archetypes(comnet_catalog, usage_name)
except KeyError:

View File

@ -1,87 +0,0 @@
"""
Schedules helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
import helpers.constants as cte
class SchedulesHelper:
"""
Schedules helper
"""
_usage_to_comnet = {
cte.RESIDENTIAL: 'C-12 Residential',
cte.INDUSTRY: 'C-10 Warehouse',
cte.OFFICE_AND_ADMINISTRATION: 'C-5 Office',
cte.HOTEL: 'C-3 Hotel',
cte.HEALTH_CARE: 'C-2 Health',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'C-8 Retail',
cte.HALL: 'C-8 Retail',
cte.RESTAURANT: 'C-7 Restaurant',
cte.EDUCATION: 'C-9 School'
}
_comnet_to_data_type = {
'Fraction': cte.FRACTION,
'OnOff': cte.ON_OFF,
'Temperature': cte.ANY_NUMBER
}
# usage
_function_to_usage = {
'full service restaurant': cte.RESTAURANT,
'high-rise apartment': cte.RESIDENTIAL,
'hospital': cte.HEALTH_CARE,
'large hotel': cte.HOTEL,
'large office': cte.OFFICE_AND_ADMINISTRATION,
'medium office': cte.OFFICE_AND_ADMINISTRATION,
'midrise apartment': cte.RESIDENTIAL,
'outpatient healthcare': cte.HEALTH_CARE,
'primary school': cte.EDUCATION,
'quick service restaurant': cte.RESTAURANT,
'secondary school': cte.EDUCATION,
'small hotel': cte.HOTEL,
'small office': cte.OFFICE_AND_ADMINISTRATION,
'stand-alone-retail': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'strip mall': cte.HALL,
'supermarket': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
'warehouse': cte.INDUSTRY,
'residential': cte.RESIDENTIAL
}
@staticmethod
def comnet_from_usage(usage):
"""
Get Comnet usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return SchedulesHelper._usage_to_comnet[usage]
except KeyError:
sys.stderr.write('Error: keyword not found.\n')
@staticmethod
def data_type_from_comnet(comnet_data_type):
"""
Get data_type from the Comnet data type definitions
:param comnet_data_type: str
:return: str
"""
try:
return SchedulesHelper._comnet_to_data_type[comnet_data_type]
except KeyError:
raise ValueError(f"Error: comnet data type keyword not found.")
@staticmethod
def usage_from_function(building_function):
"""
Get the internal usage for the given internal building function
:param building_function: str
:return: str
"""
return SchedulesHelper._function_to_usage[building_function]

View File

@ -1,169 +0,0 @@
"""
Usage helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
import helpers.constants as cte
class UsageHelper:
"""
Usage helper class
"""
_usage_to_hft = {
cte.RESIDENTIAL: 'residential',
cte.SINGLE_FAMILY_HOUSE: 'Single family house',
cte.MULTI_FAMILY_HOUSE: 'Multi-family house',
cte.EDUCATION: 'education',
cte.SCHOOL_WITHOUT_SHOWER: 'school without shower',
cte.SCHOOL_WITH_SHOWER: 'school with shower',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'retail shop / refrigerated food',
cte.HOTEL: 'hotel',
cte.HOTEL_MEDIUM_CLASS: 'hotel (Medium-class)',
cte.DORMITORY: 'dormitory',
cte.INDUSTRY: 'industry',
cte.RESTAURANT: 'restaurant',
cte.HEALTH_CARE: 'health care',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'Home for the aged or orphanage',
cte.OFFICE_AND_ADMINISTRATION: 'office and administration',
cte.EVENT_LOCATION: 'event location',
cte.HALL: 'hall',
cte.SPORTS_LOCATION: 'sport location',
cte.LABOR: 'Labor',
cte.GREEN_HOUSE: 'green house',
cte.NON_HEATED: 'non-heated'}
@staticmethod
def hft_from_libs_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 to translate from libs_usage to hft usage.\n')
_usage_to_comnet = {
cte.RESIDENTIAL: 'BA Multifamily',
cte.SINGLE_FAMILY_HOUSE: 'BA Multifamily',
cte.MULTI_FAMILY_HOUSE: 'BA Multifamily',
cte.EDUCATION: 'BA School/University',
cte.SCHOOL_WITHOUT_SHOWER: 'BA School/University',
cte.SCHOOL_WITH_SHOWER: 'BA School/University',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'BA Retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'BA Retail',
cte.HOTEL: 'BA Hotel',
cte.HOTEL_MEDIUM_CLASS: 'BA Hotel',
cte.DORMITORY: 'BA Dormitory',
cte.INDUSTRY: 'BA Manufacturing Facility',
cte.RESTAURANT: 'BA Dining: Family',
cte.HEALTH_CARE: 'BA Hospital',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'BA Multifamily',
cte.OFFICE_AND_ADMINISTRATION: 'BA Office',
cte.EVENT_LOCATION: 'BA Convention Center',
cte.HALL: 'BA Convention Center',
cte.SPORTS_LOCATION: 'BA Sports Arena',
cte.LABOR: 'BA Gymnasium',
cte.GREEN_HOUSE: cte.GREEN_HOUSE,
cte.NON_HEATED: cte.NON_HEATED
}
_comnet_schedules_key_to_comnet_schedules = {
'C-1 Assembly': 'C-1 Assembly',
'C-2 Public': 'C-2 Health',
'C-3 Hotel Motel': 'C-3 Hotel',
'C-4 Manufacturing': 'C-4 Manufacturing',
'C-5 Office': 'C-5 Office',
'C-6 Parking Garage': 'C-6 Parking',
'C-7 Restaurant': 'C-7 Restaurant',
'C-8 Retail': 'C-8 Retail',
'C-9 Schools': 'C-9 School',
'C-10 Warehouse': 'C-10 Warehouse',
'C-11 Laboratory': 'C-11 Lab',
'C-12 Residential': 'C-12 Residential',
'C-13 Data Center': 'C-13 Data',
'C-14 Gymnasium': 'C-14 Gymnasium'}
_comnet_schedules_key_to_usage = {
'C-1 Assembly': 'C-1 Assembly',
'C-2 Public': 'C-2 Health',
'C-3 Hotel Motel': 'C-3 Hotel',
'C-4 Manufacturing': 'C-4 Manufacturing',
'C-5 Office': 'C-5 Office',
'C-6 Parking Garage': 'C-6 Parking',
'C-7 Restaurant': 'C-7 Restaurant',
'C-8 Retail': 'C-8 Retail',
'C-9 Schools': 'C-9 School',
'C-10 Warehouse': 'C-10 Warehouse',
'C-11 Laboratory': 'C-11 Lab',
'C-12 Residential': 'C-12 Residential',
'C-13 Data Center': 'C-13 Data',
'C-14 Gymnasium': 'C-14 Gymnasium'}
@staticmethod
def comnet_from_hub_usage(usage):
"""
Get Comnet usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return UsageHelper._usage_to_comnet[usage]
except KeyError:
sys.stderr.write('Error: keyword not found to translate from hub_usage to comnet usage.\n')
@staticmethod
def schedules_key(usage):
"""
Get Comnet schedules key from the list found in the Comnet usage file
:param usage: str
:return: str
"""
try:
return UsageHelper._comnet_schedules_key_to_comnet_schedules[usage]
except KeyError:
sys.stderr.write('Error: Comnet keyword not found. An update of the Comnet files might have been '
'done changing the keywords.\n')
_usage_to_nrcan = {
cte.RESIDENTIAL: 'Multi-unit residential building',
cte.SINGLE_FAMILY_HOUSE: 'Multi-unit residential building',
cte.MULTI_FAMILY_HOUSE: 'Multi-unit residential building',
cte.EDUCATION: 'School/university',
cte.SCHOOL_WITHOUT_SHOWER: 'School/university',
cte.SCHOOL_WITH_SHOWER: 'School/university',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'Retail',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'Retail',
cte.HOTEL: 'Hotel',
cte.HOTEL_MEDIUM_CLASS: 'Hotel',
cte.DORMITORY: 'Dormitory',
cte.INDUSTRY: 'Manufacturing Facility',
cte.RESTAURANT: 'Dining - family',
cte.HEALTH_CARE: 'Hospital',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'Multi-unit residential building',
cte.OFFICE_AND_ADMINISTRATION: 'Office',
cte.EVENT_LOCATION: 'Convention centre',
cte.HALL: 'Convention centre',
cte.SPORTS_LOCATION: 'Gymnasium',
cte.LABOR: 'Gymnasium',
cte.GREEN_HOUSE: cte.GREEN_HOUSE,
cte.NON_HEATED: cte.NON_HEATED
}
@staticmethod
def nrcan_from_hub_usage(usage):
"""
Get Nrcan usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return UsageHelper._usage_to_nrcan[usage]
except KeyError:
sys.stderr.write('Error: keyword not found to translate from hub_usage to nrcan usage.\n')

View File

@ -8,7 +8,7 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
import sys
import helpers.constants as cte
from imports.usage.helpers.usage_helper import UsageHelper
from helpers.dictionaries import Dictionaries
from city_model_structure.building_demand.usage import Usage
from city_model_structure.building_demand.lighting import Lighting
from city_model_structure.building_demand.occupancy import Occupancy
@ -35,7 +35,7 @@ class NrcanUsageParameters:
comnet_catalog = UsageCatalogFactory('comnet').catalog
for building in city.buildings:
usage_name = UsageHelper.nrcan_from_hub_usage(building.function)
usage_name = Dictionaries().hub_usage_to_nrcan_usage[building.function]
try:
archetype_usage = self._search_archetypes(nrcan_catalog, usage_name)
except KeyError:
@ -43,7 +43,7 @@ class NrcanUsageParameters:
f' {building.function}')
return
usage_name = UsageHelper.comnet_from_hub_usage(building.function)
usage_name = Dictionaries().hub_usage_to_comnet_usage[building.function]
try:
comnet_archetype_usage = self._search_archetypes(comnet_catalog, usage_name)
except KeyError:

View File

@ -9,7 +9,7 @@ from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.construction_factory import ConstructionFactory
from imports.geometry.helpers.geometry_helper import GeometryHelper
from helpers.dictionaries import Dictionaries
class TestConstructionFactory(TestCase):
@ -34,9 +34,9 @@ class TestConstructionFactory(TestCase):
@staticmethod
def _internal_function(function_format, original_function):
if function_format == 'hft':
new_function = GeometryHelper.libs_function_from_hft(original_function)
new_function = Dictionaries().hft_function_to_hub_function[original_function]
elif function_format == 'pluto':
new_function = GeometryHelper.libs_function_from_pluto(original_function)
new_function = Dictionaries().pluto_function_to_hub_function[original_function]
else:
raise Exception('Function key not recognized. Implemented only "hft" and "pluto"')
return new_function
@ -51,7 +51,7 @@ class TestConstructionFactory(TestCase):
city = self._get_citygml(file)
for building in city.buildings:
building.function = self._internal_function(function_format, building.function)
self.assertEqual(building.function, 'residential', 'format hft')
self.assertEqual('residential', building.function, 'format hft')
# case 2: Pluto
file = 'pluto_building.gml'
@ -59,7 +59,7 @@ class TestConstructionFactory(TestCase):
city = self._get_citygml(file)
for building in city.buildings:
building.function = self._internal_function(function_format, building.function)
self.assertEqual(building.function, 'secondary school', 'format pluto')
self.assertEqual('education', building.function, 'format pluto')
# case 3: Alkis
file = 'one_building_in_kelowna_alkis.gml'
@ -180,7 +180,7 @@ class TestConstructionFactory(TestCase):
city = self._get_citygml(file)
for building in city.buildings:
building.year_of_construction = 2005
building.function = GeometryHelper.libs_function_from_pluto(building.function)
building.function = self._internal_function('pluto', building.function)
ConstructionFactory('nrel', city).enrich()
self._check_buildings(city)

View File

@ -7,7 +7,7 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
from pathlib import Path
from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.geometry.helpers.geometry_helper import GeometryHelper
from helpers.dictionaries import Dictionaries
from imports.usage_factory import UsageFactory
from imports.construction_factory import ConstructionFactory
@ -71,10 +71,10 @@ class TestGeometryFactory(TestCase):
def _prepare_case_usage_first(city, input_key, construction_key, usage_key):
if input_key == 'pluto':
for building in city.buildings:
building.function = GeometryHelper.libs_function_from_pluto(building.function)
building.function = Dictionaries().pluto_function_to_hub_function[building.function]
elif input_key == 'hft':
for building in city.buildings:
building.function = GeometryHelper.libs_function_from_hft(building.function)
building.function = Dictionaries().hft_function_to_hub_function[building.function]
UsageFactory(usage_key, city).enrich()
ConstructionFactory(construction_key, city).enrich()
@ -82,16 +82,16 @@ class TestGeometryFactory(TestCase):
def _prepare_case_construction_first(city, input_key, construction_key, usage_key):
if input_key == 'pluto':
for building in city.buildings:
building.function = GeometryHelper.libs_function_from_pluto(building.function)
building.function = Dictionaries().pluto_function_to_hub_function[building.function]
elif input_key == 'hft':
for building in city.buildings:
building.function = GeometryHelper.libs_function_from_hft(building.function)
building.function = Dictionaries().hft_function_to_hub_function[building.function]
print(construction_key, usage_key)
ConstructionFactory(construction_key, city).enrich()
UsageFactory(usage_key, city).enrich()
def _test_hft(self, file):
_construction_keys = ['nrcan', 'nrel']
_construction_keys = ['nrel']
_usage_keys = ['comnet', 'nrcan']
for construction_key in _construction_keys:
for usage_key in _usage_keys:

View File

@ -10,7 +10,7 @@ from pathlib import Path
from unittest import TestCase
import pandas as pd
from imports.geometry_factory import GeometryFactory
from imports.geometry.helpers.geometry_helper import GeometryHelper
from helpers.dictionaries import Dictionaries
from imports.construction_factory import ConstructionFactory
from imports.usage_factory import UsageFactory
from exports.exports_factory import ExportsFactory
@ -48,7 +48,7 @@ class TestExports(TestCase):
file_path = (self._example_path / 'one_building_in_kelowna.gml').resolve()
self._complete_city = self._get_citygml(file_path)
for building in self._complete_city.buildings:
building.function = GeometryHelper().libs_function_from_hft(building.function)
building.function = Dictionaries().hft_function_to_hub_function[building.function]
building.year_of_construction = 2006
ConstructionFactory('nrel', self._complete_city).enrich()
UsageFactory('ca', self._complete_city).enrich()

View File

@ -20,4 +20,4 @@ class TestConstructionCatalog(TestCase):
catalog = UsageCatalogFactory('nrcan').catalog
self.assertIsNotNone(catalog, 'catalog is none')
content = catalog.entries()
self.assertEqual(274, len(content.usages), 'Wrong number of usages')
self.assertEqual(34, len(content.usages), 'Wrong number of usages')

View File

@ -9,7 +9,7 @@ from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.usage_factory import UsageFactory
from imports.geometry.helpers.geometry_helper import GeometryHelper
from helpers.dictionaries import Dictionaries
class TestUsageFactory(TestCase):
@ -85,7 +85,7 @@ class TestUsageFactory(TestCase):
file = 'pluto_building.gml'
city = self._get_citygml(file)
for building in city.buildings:
building.function = GeometryHelper.libs_function_from_pluto(building.function)
building.function = Dictionaries().pluto_function_to_hub_function[building.function]
UsageFactory('comnet', city).enrich()
self._check_buildings(city)