From de16e0167768c755ab7f59d92525549109e04be0 Mon Sep 17 00:00:00 2001 From: Guille Date: Wed, 10 Jun 2020 13:08:51 -0400 Subject: [PATCH] Add code comment to the classes --- city_model_structure/plying_with_geometry.py | 22 - city_model_structure/polyhedron.py | 30 +- city_model_structure/thermal_zone.py | 92 +++- city_model_structure/window.py | 83 ---- config/configuration.ini | 4 +- helpers/configuration.py | 2 +- .../helpers/us_pluto_to_function.py | 449 ++++++++--------- .../helpers/us_function_to_usage.py | 48 +- .../helpers/us_pluto_to_usage.py | 455 +++++++++--------- 9 files changed, 603 insertions(+), 582 deletions(-) delete mode 100644 city_model_structure/plying_with_geometry.py delete mode 100644 city_model_structure/window.py diff --git a/city_model_structure/plying_with_geometry.py b/city_model_structure/plying_with_geometry.py deleted file mode 100644 index b3d34d0e..00000000 --- a/city_model_structure/plying_with_geometry.py +++ /dev/null @@ -1,22 +0,0 @@ -import trimesh -from helpers.geometry import Geometry as Geo -import stl -import numpy as np - - -# example triangle -vertices = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1]] -#faces = [[0, 1, 2], [1, 3, 2], [1, 5, 3], [5, 7, 3], [0, 4, 1], [4, 5, 1], [4, 6, 5], [5, 6, 7], [0, 2, 4], [2, 6, 4], -# [3, 7, 6], [2, 3, 6]] - -# example rectangle -faces = [[0, 1, 3, 2], [1, 5, 7, 3], [0, 4, 5, 1], [4, 6, 7, 5], [0, 2, 6, 4], [3, 7, 6, 2]] -mesh = trimesh.Trimesh(vertices=vertices, faces=faces) - -normal_plane = [0, 0, 1] -point_plane = [0, 0, 2] - -mesh_result = Geo.divide_mesh_by_plane(mesh, normal_plane, point_plane) - -for mesh in mesh_result: - print(len(mesh.vertices), len(mesh.faces)) diff --git a/city_model_structure/polyhedron.py b/city_model_structure/polyhedron.py index 075d3a53..358411f1 100644 --- a/city_model_structure/polyhedron.py +++ b/city_model_structure/polyhedron.py @@ -9,8 +9,11 @@ from helpers.geometry import Geometry class Polyhedron: + """ + Polyhedron class + """ def __init__(self, surfaces): - self._surfaces = [s for s in surfaces] + self._surfaces = list(surfaces) self._polygons = [s.polygon for s in surfaces] self._polyhedron = None self._volume = None @@ -27,7 +30,11 @@ class Polyhedron: return -1 @property - def vertices(self): + def vertices(self) -> np.ndarray: + """ + Polyhedron vertices + :return: np.ndarray(int) + """ if self._vertices is None: vertices, self._vertices = [], [] [vertices.extend(s.points) for s in self._surfaces] @@ -44,7 +51,11 @@ class Polyhedron: return self._vertices @property - def faces(self): + def faces(self) -> np.ndarray: + """ + Polyhedron faces + :return: np.ndarray([int]) + """ if self._faces is None: self._faces = [] for s in self._surfaces: @@ -67,13 +78,26 @@ class Polyhedron: @property def volume(self): + """ + Polyhedron volume in cubic meters + :return: float + """ if self._volume is None: self._volume, cog, inertia = self._polyhedron_mesh.get_mass_properties() return self._volume @property def max_z(self): + """ + Polyhedron maximal z value + :return: float + """ return self._polyhedron_mesh.z.max() def save(self, full_path): + """ + Export the polyhedron to stl given file + :param full_path: str + :return: None + """ self._polyhedron_mesh.save(full_path) diff --git a/city_model_structure/thermal_zone.py b/city_model_structure/thermal_zone.py index d7caee08..b8229063 100644 --- a/city_model_structure/thermal_zone.py +++ b/city_model_structure/thermal_zone.py @@ -3,13 +3,18 @@ ThermalZone module SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ -from __future__ import annotations -from typing import List +from typing import List, TypeVar from city_model_structure.usage_zone import UsageZone +from city_model_structure.surface import Surface from helpers.configuration import Configuration +ThermalBoundary = TypeVar('ThermalBoundary') + class ThermalZone: + """ + ThermalZone class + """ def __init__(self, surfaces): self._surfaces = surfaces self._floor_area = None @@ -25,14 +30,26 @@ class ThermalZone: @property def heated(self): + """ + Get thermal zone heated flag + :return: Boolean + """ return self._heated @property def cooled(self): + """ + Get thermal zone cooled flag + :return: Boolean + """ return self._cooled @property def floor_area(self): + """ + Get thermal zone floor area in m2 + :return: float + """ if self._floor_area is None: self._floor_area = 0 for s in self._surfaces: @@ -41,61 +58,128 @@ class ThermalZone: return self._floor_area @property - def bounded(self) -> List['ThermalBoundary']: + def bounded(self) -> List[ThermalBoundary]: + """ + Get thermal boundaries bounding with the thermal zone + :return: [ThermalBoundary] + """ return self._bounded @bounded.setter def bounded(self, value): + """ + Set thermal boundaries bounding with the thermal zone + :param value: [ThermalBoundary] + :return: None + """ self._bounded = value @property - def surfaces(self): + def surfaces(self) -> List[Surface]: + """ + Get thermal zone surfaces + :return: [Surface] + """ return self._surfaces @property def additional_thermal_bridge_u_value(self): + """ + Get thermal zone additional thermal bridge u value + :return: float + """ return self._additional_thermal_bridge_u_value @additional_thermal_bridge_u_value.setter def additional_thermal_bridge_u_value(self, value): + """ + Set thermal zone additional thermal bridge u value + :param value: float + :return: None + """ self._additional_thermal_bridge_u_value = value @property def effective_thermal_capacity(self): + """ + Get thermal zone effective thermal capacity + :return: float + """ return self._effective_thermal_capacity @effective_thermal_capacity.setter def effective_thermal_capacity(self, value): + """ + Set thermal zone effective thermal capacity + :param value: float + :return: None + """ self._effective_thermal_capacity = value @property def indirectly_heated_area_ratio(self): + """ + Get thermal zone indirectly heated area ratio + :return: float + """ return self._indirectly_heated_area_ratio @indirectly_heated_area_ratio.setter def indirectly_heated_area_ratio(self, value): + """ + Set thermal zone indirectly heated area ratio + :param value: float + :return: None + """ self._indirectly_heated_area_ratio = value @property def infiltration_rate_system_on(self): + """ + Get thermal zone infiltration rate system on in air changes per hour + :return: float + """ return self._infiltration_rate_system_on @infiltration_rate_system_on.setter def infiltration_rate_system_on(self, value): + """ + Set thermal zone infiltration rate system on in air changes per hour + :param value: float + :return: None + """ self._infiltration_rate_system_on = value @property def infiltration_rate_system_off(self): + """ + Get thermal zone infiltration rate system off in air changes per hour + :return: float + """ return self._infiltration_rate_system_off @infiltration_rate_system_off.setter def infiltration_rate_system_off(self, value): + """ + Set thermal zone infiltration rate system on in air changes per hour + :param value: float + :return: None + """ self._infiltration_rate_system_off = value @property def usage_zones(self) -> List[UsageZone]: + """ + Get thermal zone usage zones + :return: [UsageZone] + """ return self._usage_zones @usage_zones.setter def usage_zones(self, values): + """ + Set thermal zone usage zones + :param values: [UsageZone] + :return: None + """ self._usage_zones = values diff --git a/city_model_structure/window.py b/city_model_structure/window.py deleted file mode 100644 index f14f0540..00000000 --- a/city_model_structure/window.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -Window module -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca -""" - - -class Window: - """ - Window class - """ - def __init__(self): - self._conductivity = None - self._solar_transmittance_at_normal_incidence = None - self._front_side_solar_reflectance_at_normal_incidence = None - self._back_side_solar_reflectance_at_normal_incidence = None - self._frame_ratio = None - self._thickness_m = None - self._shgc = None - - @property - def conductivity(self): - """ - Get window conductivity in W/mK - :return: float - """ - return self._conductivity - - @conductivity.setter - def conductivity(self, value): - self._conductivity = value - - @property - def solar_transmittance_at_normal_incidence(self): - return self._solar_transmittance_at_normal_incidence - - @solar_transmittance_at_normal_incidence.setter - def solar_transmittance_at_normal_incidence(self, value): - self._solar_transmittance_at_normal_incidence = value - - @property - def front_side_solar_reflectance_at_normal_incidence(self): - return self._front_side_solar_reflectance_at_normal_incidence - - @front_side_solar_reflectance_at_normal_incidence.setter - def front_side_solar_reflectance_at_normal_incidence(self, value): - self._front_side_solar_reflectance_at_normal_incidence = value - - @property - def back_side_solar_reflectance_at_normal_incidence(self): - return self._back_side_solar_reflectance_at_normal_incidence - - @back_side_solar_reflectance_at_normal_incidence.setter - def back_side_solar_reflectance_at_normal_incidence(self, value): - self._back_side_solar_reflectance_at_normal_incidence = value - - @property - def frame_ratio(self): - return self._frame_ratio - - @frame_ratio.setter - def frame_ratio(self, value): - self._frame_ratio = value - - @frame_ratio.setter - def frame_ratio(self, value): - self._frame_ratio = value - - @property - def thickness_m(self): - return self._thickness_m - - @thickness_m.setter - def thickness_m(self, value): - self._thickness_m = value - - @property - def shgc(self): - return self._shgc - - @shgc.setter - def shgc(self, value): - self._shgc = value diff --git a/config/configuration.ini b/config/configuration.ini index 454627d7..9322833d 100644 --- a/config/configuration.ini +++ b/config/configuration.ini @@ -7,8 +7,8 @@ h_e = 25 # W/m2K frame_ratio = 0 [thermal_zones] -heated = True -cooled = True +heated = true +cooled = true additional_thermal_bridge_u_value = 0 indirectly_heated_area_ratio = 0 infiltration_rate_system_on = 0 diff --git a/helpers/configuration.py b/helpers/configuration.py index c1bfbbbf..a140ef84 100644 --- a/helpers/configuration.py +++ b/helpers/configuration.py @@ -10,7 +10,7 @@ from pathlib import Path class Configuration: def __init__(self): base_path = Path().resolve().parent - config_file = Path(base_path / 'config/configuration.ini').resolve() + config_file = Path(base_path / 'libs/config/configuration.ini').resolve() self._config = configparser.ConfigParser() self._config.read(config_file) diff --git a/physics/physics_feeders/helpers/us_pluto_to_function.py b/physics/physics_feeders/helpers/us_pluto_to_function.py index 65b3fab8..f16298e7 100644 --- a/physics/physics_feeders/helpers/us_pluto_to_function.py +++ b/physics/physics_feeders/helpers/us_pluto_to_function.py @@ -7,228 +7,233 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc class UsPlutoToFunction: building_function = { - 'A0': 'single family house', - 'A1': 'single family house', - 'A2': 'single family house', - 'A3': 'single family house', - 'A4': 'single family house', - 'A5': 'single family house', - 'A6': 'single family house', - 'A7': 'single family house', - 'A8': 'single family house', - 'A9': 'single family house', - 'B1': 'multifamily house', - 'B2': 'multifamily house', - 'B3': 'multifamily house', - 'B9': 'multifamily house', - 'C0': 'residential', - 'C1': 'residential', - 'C2': 'residential', - 'C3': 'residential', - 'C4': 'residential', - 'C5': 'residential', - 'C6': 'residential', - 'C7': 'residential', - 'C8': 'residential', - 'C9': 'residential', - 'D0': 'residential', - 'D1': 'residential', - 'D2': 'residential', - 'D3': 'residential', - 'D4': 'residential', - 'D5': 'residential', - 'D6': 'residential', - 'D7': 'residential', - 'D8': 'residential', - 'D9': 'residential', - 'E1': 'warehouse', - 'E3': 'warehouse', - 'E4': 'warehouse', - 'E5': 'warehouse', - 'E7': 'warehouse', - 'E9': 'warehouse', - 'F1': 'warehouse', - 'F2': 'warehouse', - 'F4': 'warehouse', - 'F5': 'warehouse', - 'F8': 'warehouse', - 'F9': 'warehouse', - 'G0': 'office', - 'G1': 'office', - 'G2': 'office', - 'G3': 'office', - 'G4': 'office', - 'G5': 'office', - 'G6': 'office', - 'G7': 'office', - 'G8': 'office', - 'G9': 'office', - 'H1': 'hotel', - 'H2': 'hotel', - 'H3': 'hotel', - 'H4': 'hotel', - 'H5': 'hotel', - 'H6': 'hotel', - 'H7': 'hotel', - 'H8': 'hotel', - 'H9': 'hotel', - 'HB': 'hotel', - 'HH': 'hotel', - 'HR': 'hotel', - 'HS': 'hotel', - 'I1': 'hospital', - 'I2': 'outpatient', - 'I3': 'outpatient', - 'I4': 'residential', - 'I5': 'outpatient', - 'I6': 'outpatient', - 'I7': 'outpatient', - 'I9': 'outpatient', - 'J1': 'large office', - 'J2': 'large office', - 'J3': 'large office', - 'J4': 'large office', - 'J5': 'large office', - 'J6': 'large office', - 'J7': 'large office', - 'J8': 'large office', - 'J9': 'large office', - 'K1': 'strip mall', - 'K2': 'strip mall', - 'K3': 'strip mall', - 'K4': 'residential', - 'K5': 'restaurant', - 'K6': 'commercial', - 'K7': 'commercial', - 'K8': 'commercial', - 'K9': 'commercial', - 'L1': 'residential', - 'L2': 'residential', - 'L3': 'residential', - 'L8': 'residential', - 'L9': 'residential', - 'M1': 'large office', - 'M2': 'large office', - 'M3': 'large office', - 'M4': 'large office', - 'M9': 'large office', - 'N1': 'residential', - 'N2': 'residential', - 'N3': 'residential', - 'N4': 'residential', - 'N9': 'residential', - 'O1': 'office', - 'O2': 'office', - 'O3': 'office', - 'O4': 'office', - 'O5': 'office', - 'O6': 'office', - 'O7': 'office', - 'O8': 'office', - 'O9': 'office', - 'P1': 'large office', - 'P2': 'hotel', - 'P3': 'office', - 'P4': 'office', - 'P5': 'office', - 'P6': 'office', - 'P7': 'large office', - 'P8': 'large office', - 'P9': 'office', - 'Q0': 'office', - 'Q1': 'office', - 'Q2': 'office', - 'Q3': 'office', - 'Q4': 'office', - 'Q5': 'office', - 'Q6': 'office', - 'Q7': 'office', - 'Q8': 'office', - 'Q9': 'office', - 'R0': 'residential', - 'R1': 'residential', - 'R2': 'residential', - 'R3': 'residential', - 'R4': 'residential', - 'R5': 'residential', - 'R6': 'residential', - 'R7': 'residential', - 'R8': 'residential', - 'R9': 'residential', - 'RA': 'residential', - 'RB': 'residential', - 'RC': 'residential', - 'RD': 'residential', - 'RG': 'residential', - 'RH': 'residential', - 'RI': 'residential', - 'RK': 'residential', - 'RM': 'residential', - 'RR': 'residential', - 'RS': 'residential', - 'RW': 'residential', - 'RX': 'residential', - 'RZ': 'residential', - 'S0': 'residential', - 'S1': 'residential', - 'S2': 'residential', - 'S3': 'residential', - 'S4': 'residential', - 'S5': 'residential', - 'S9': 'residential', - 'T1': 'na', - 'T2': 'na', - 'T9': 'na', - 'U0': 'warehouse', - 'U1': 'warehouse', - 'U2': 'warehouse', - 'U3': 'warehouse', - 'U4': 'warehouse', - 'U5': 'warehouse', - 'U6': 'warehouse', - 'U7': 'warehouse', - 'U8': 'warehouse', - 'U9': 'warehouse', - 'V0': 'na', - 'V1': 'na', - 'V2': 'na', - 'V3': 'na', - 'V4': 'na', - 'V5': 'na', - 'V6': 'na', - 'V7': 'na', - 'V8': 'na', - 'V9': 'na', - 'W1': 'primary school', - 'W2': 'primary school', - 'W3': 'secondary school', - 'W4': 'secondary school', - 'W5': 'secondary school', - 'W6': 'secondary school', - 'W7': 'secondary school', - 'W8': 'primary school', - 'W9': 'secondary school', - 'Y1': 'large office', - 'Y2': 'large office', - 'Y3': 'large office', - 'Y4': 'large office', - 'Y5': 'large office', - 'Y6': 'large office', - 'Y7': 'large office', - 'Y8': 'large office', - 'Y9': 'large office', - 'Z0': 'na', - 'Z1': 'large office', - 'Z2': 'na', - 'Z3': 'na', - 'Z4': 'na', - 'Z5': 'na', - 'Z6': 'na', - 'Z7': 'na', - 'Z8': 'na', - 'Z9': 'na' + 'A0': 'single family house', + 'A1': 'single family house', + 'A2': 'single family house', + 'A3': 'single family house', + 'A4': 'single family house', + 'A5': 'single family house', + 'A6': 'single family house', + 'A7': 'single family house', + 'A8': 'single family house', + 'A9': 'single family house', + 'B1': 'multifamily house', + 'B2': 'multifamily house', + 'B3': 'multifamily house', + 'B9': 'multifamily house', + 'C0': 'residential', + 'C1': 'residential', + 'C2': 'residential', + 'C3': 'residential', + 'C4': 'residential', + 'C5': 'residential', + 'C6': 'residential', + 'C7': 'residential', + 'C8': 'residential', + 'C9': 'residential', + 'D0': 'residential', + 'D1': 'residential', + 'D2': 'residential', + 'D3': 'residential', + 'D4': 'residential', + 'D5': 'residential', + 'D6': 'residential', + 'D7': 'residential', + 'D8': 'residential', + 'D9': 'residential', + 'E1': 'warehouse', + 'E3': 'warehouse', + 'E4': 'warehouse', + 'E5': 'warehouse', + 'E7': 'warehouse', + 'E9': 'warehouse', + 'F1': 'warehouse', + 'F2': 'warehouse', + 'F4': 'warehouse', + 'F5': 'warehouse', + 'F8': 'warehouse', + 'F9': 'warehouse', + 'G0': 'office', + 'G1': 'office', + 'G2': 'office', + 'G3': 'office', + 'G4': 'office', + 'G5': 'office', + 'G6': 'office', + 'G7': 'office', + 'G8': 'office', + 'G9': 'office', + 'H1': 'hotel', + 'H2': 'hotel', + 'H3': 'hotel', + 'H4': 'hotel', + 'H5': 'hotel', + 'H6': 'hotel', + 'H7': 'hotel', + 'H8': 'hotel', + 'H9': 'hotel', + 'HB': 'hotel', + 'HH': 'hotel', + 'HR': 'hotel', + 'HS': 'hotel', + 'I1': 'hospital', + 'I2': 'outpatient', + 'I3': 'outpatient', + 'I4': 'residential', + 'I5': 'outpatient', + 'I6': 'outpatient', + 'I7': 'outpatient', + 'I9': 'outpatient', + 'J1': 'large office', + 'J2': 'large office', + 'J3': 'large office', + 'J4': 'large office', + 'J5': 'large office', + 'J6': 'large office', + 'J7': 'large office', + 'J8': 'large office', + 'J9': 'large office', + 'K1': 'strip mall', + 'K2': 'strip mall', + 'K3': 'strip mall', + 'K4': 'residential', + 'K5': 'restaurant', + 'K6': 'commercial', + 'K7': 'commercial', + 'K8': 'commercial', + 'K9': 'commercial', + 'L1': 'residential', + 'L2': 'residential', + 'L3': 'residential', + 'L8': 'residential', + 'L9': 'residential', + 'M1': 'large office', + 'M2': 'large office', + 'M3': 'large office', + 'M4': 'large office', + 'M9': 'large office', + 'N1': 'residential', + 'N2': 'residential', + 'N3': 'residential', + 'N4': 'residential', + 'N9': 'residential', + 'O1': 'office', + 'O2': 'office', + 'O3': 'office', + 'O4': 'office', + 'O5': 'office', + 'O6': 'office', + 'O7': 'office', + 'O8': 'office', + 'O9': 'office', + 'P1': 'large office', + 'P2': 'hotel', + 'P3': 'office', + 'P4': 'office', + 'P5': 'office', + 'P6': 'office', + 'P7': 'large office', + 'P8': 'large office', + 'P9': 'office', + 'Q0': 'office', + 'Q1': 'office', + 'Q2': 'office', + 'Q3': 'office', + 'Q4': 'office', + 'Q5': 'office', + 'Q6': 'office', + 'Q7': 'office', + 'Q8': 'office', + 'Q9': 'office', + 'R0': 'residential', + 'R1': 'residential', + 'R2': 'residential', + 'R3': 'residential', + 'R4': 'residential', + 'R5': 'residential', + 'R6': 'residential', + 'R7': 'residential', + 'R8': 'residential', + 'R9': 'residential', + 'RA': 'residential', + 'RB': 'residential', + 'RC': 'residential', + 'RD': 'residential', + 'RG': 'residential', + 'RH': 'residential', + 'RI': 'residential', + 'RK': 'residential', + 'RM': 'residential', + 'RR': 'residential', + 'RS': 'residential', + 'RW': 'residential', + 'RX': 'residential', + 'RZ': 'residential', + 'S0': 'residential', + 'S1': 'residential', + 'S2': 'residential', + 'S3': 'residential', + 'S4': 'residential', + 'S5': 'residential', + 'S9': 'residential', + 'T1': 'na', + 'T2': 'na', + 'T9': 'na', + 'U0': 'warehouse', + 'U1': 'warehouse', + 'U2': 'warehouse', + 'U3': 'warehouse', + 'U4': 'warehouse', + 'U5': 'warehouse', + 'U6': 'warehouse', + 'U7': 'warehouse', + 'U8': 'warehouse', + 'U9': 'warehouse', + 'V0': 'na', + 'V1': 'na', + 'V2': 'na', + 'V3': 'na', + 'V4': 'na', + 'V5': 'na', + 'V6': 'na', + 'V7': 'na', + 'V8': 'na', + 'V9': 'na', + 'W1': 'primary school', + 'W2': 'primary school', + 'W3': 'secondary school', + 'W4': 'secondary school', + 'W5': 'secondary school', + 'W6': 'secondary school', + 'W7': 'secondary school', + 'W8': 'primary school', + 'W9': 'secondary school', + 'Y1': 'large office', + 'Y2': 'large office', + 'Y3': 'large office', + 'Y4': 'large office', + 'Y5': 'large office', + 'Y6': 'large office', + 'Y7': 'large office', + 'Y8': 'large office', + 'Y9': 'large office', + 'Z0': 'na', + 'Z1': 'large office', + 'Z2': 'na', + 'Z3': 'na', + 'Z4': 'na', + 'Z5': 'na', + 'Z6': 'na', + 'Z7': 'na', + 'Z8': 'na', + 'Z9': 'na' } @staticmethod - def function(pluto): - return UsPlutoToFunction.building_function[pluto] + def function(building_pluto_function): + """ + Get nrel function from the given pluto function + :param building_pluto_function: str + :return: str + """ + return UsPlutoToFunction.building_function[building_pluto_function] diff --git a/usage/usage_feeders/helpers/us_function_to_usage.py b/usage/usage_feeders/helpers/us_function_to_usage.py index ef9816b1..4f42ec40 100644 --- a/usage/usage_feeders/helpers/us_function_to_usage.py +++ b/usage/usage_feeders/helpers/us_function_to_usage.py @@ -6,28 +6,34 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc class UsFunctionToUsage: - building_usage = { - 'full service restaurant': 'restaurant', - 'highrise apartment': 'residential', - 'hospital': 'health care', - 'large hotel': 'hotel', - 'large office': 'office and administration', - 'medium office': 'office and administration', - 'midrise apartment': 'residential', - 'outpatient healthcare': 'health care', - 'primary school': 'education', - 'quick service restaurant': 'restaurant', - 'secondary school': 'education', - 'small hotel': 'hotel', - 'small office': 'office and administration', - 'stand alone retail': 'retail', - 'strip mall': 'hall', - 'supermarket': 'retail', - 'warehouse': 'industry' + """ + UsFunctionToUsage class + """ + _building_usage = { + 'full service restaurant': 'restaurant', + 'highrise apartment': 'residential', + 'hospital': 'health care', + 'large hotel': 'hotel', + 'large office': 'office and administration', + 'medium office': 'office and administration', + 'midrise apartment': 'residential', + 'outpatient healthcare': 'health care', + 'primary school': 'education', + 'quick service restaurant': 'restaurant', + 'secondary school': 'education', + 'small hotel': 'hotel', + 'small office': 'office and administration', + 'stand alone retail': 'retail', + 'strip mall': 'hall', + 'supermarket': 'retail', + 'warehouse': 'industry' } @staticmethod def usage(building_function): - return UsFunctionToUsage.building_usage[building_function] - - + """ + Get the usage for the given building function + :param building_function: str + :return: str + """ + return UsFunctionToUsage._building_usage[building_function] diff --git a/usage/usage_feeders/helpers/us_pluto_to_usage.py b/usage/usage_feeders/helpers/us_pluto_to_usage.py index f5cf1702..4e860f24 100644 --- a/usage/usage_feeders/helpers/us_pluto_to_usage.py +++ b/usage/usage_feeders/helpers/us_pluto_to_usage.py @@ -7,230 +7,237 @@ from usage.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage class UsPlutoToUsage: - building_function = { - 'A0': 'single family house', - 'A1': 'single family house', - 'A2': 'single family house', - 'A3': 'single family house', - 'A4': 'single family house', - 'A5': 'single family house', - 'A6': 'single family house', - 'A7': 'single family house', - 'A8': 'single family house', - 'A9': 'single family house', - 'B1': 'multifamily house', - 'B2': 'multifamily house', - 'B3': 'multifamily house', - 'B9': 'multifamily house', - 'C0': 'residential', - 'C1': 'residential', - 'C2': 'residential', - 'C3': 'residential', - 'C4': 'residential', - 'C5': 'residential', - 'C6': 'residential', - 'C7': 'residential', - 'C8': 'residential', - 'C9': 'residential', - 'D0': 'residential', - 'D1': 'residential', - 'D2': 'residential', - 'D3': 'residential', - 'D4': 'residential', - 'D5': 'residential', - 'D6': 'residential', - 'D7': 'residential', - 'D8': 'residential', - 'D9': 'residential', - 'E1': 'warehouse', - 'E3': 'warehouse', - 'E4': 'warehouse', - 'E5': 'warehouse', - 'E7': 'warehouse', - 'E9': 'warehouse', - 'F1': 'warehouse', - 'F2': 'warehouse', - 'F4': 'warehouse', - 'F5': 'warehouse', - 'F8': 'warehouse', - 'F9': 'warehouse', - 'G0': 'office', - 'G1': 'office', - 'G2': 'office', - 'G3': 'office', - 'G4': 'office', - 'G5': 'office', - 'G6': 'office', - 'G7': 'office', - 'G8': 'office', - 'G9': 'office', - 'H1': 'hotel', - 'H2': 'hotel', - 'H3': 'hotel', - 'H4': 'hotel', - 'H5': 'hotel', - 'H6': 'hotel', - 'H7': 'hotel', - 'H8': 'hotel', - 'H9': 'hotel', - 'HB': 'hotel', - 'HH': 'hotel', - 'HR': 'hotel', - 'HS': 'hotel', - 'I1': 'hospital', - 'I2': 'outpatient', - 'I3': 'outpatient', - 'I4': 'residential', - 'I5': 'outpatient', - 'I6': 'outpatient', - 'I7': 'outpatient', - 'I9': 'outpatient', - 'J1': 'large office', - 'J2': 'large office', - 'J3': 'large office', - 'J4': 'large office', - 'J5': 'large office', - 'J6': 'large office', - 'J7': 'large office', - 'J8': 'large office', - 'J9': 'large office', - 'K1': 'strip mall', - 'K2': 'strip mall', - 'K3': 'strip mall', - 'K4': 'residential', - 'K5': 'restaurant', - 'K6': 'commercial', - 'K7': 'commercial', - 'K8': 'commercial', - 'K9': 'commercial', - 'L1': 'residential', - 'L2': 'residential', - 'L3': 'residential', - 'L8': 'residential', - 'L9': 'residential', - 'M1': 'large office', - 'M2': 'large office', - 'M3': 'large office', - 'M4': 'large office', - 'M9': 'large office', - 'N1': 'residential', - 'N2': 'residential', - 'N3': 'residential', - 'N4': 'residential', - 'N9': 'residential', - 'O1': 'office', - 'O2': 'office', - 'O3': 'office', - 'O4': 'office', - 'O5': 'office', - 'O6': 'office', - 'O7': 'office', - 'O8': 'office', - 'O9': 'office', - 'P1': 'large office', - 'P2': 'hotel', - 'P3': 'office', - 'P4': 'office', - 'P5': 'office', - 'P6': 'office', - 'P7': 'large office', - 'P8': 'large office', - 'P9': 'office', - 'Q0': 'office', - 'Q1': 'office', - 'Q2': 'office', - 'Q3': 'office', - 'Q4': 'office', - 'Q5': 'office', - 'Q6': 'office', - 'Q7': 'office', - 'Q8': 'office', - 'Q9': 'office', - 'R0': 'residential', - 'R1': 'residential', - 'R2': 'residential', - 'R3': 'residential', - 'R4': 'residential', - 'R5': 'residential', - 'R6': 'residential', - 'R7': 'residential', - 'R8': 'residential', - 'R9': 'residential', - 'RA': 'residential', - 'RB': 'residential', - 'RC': 'residential', - 'RD': 'residential', - 'RG': 'residential', - 'RH': 'residential', - 'RI': 'residential', - 'RK': 'residential', - 'RM': 'residential', - 'RR': 'residential', - 'RS': 'residential', - 'RW': 'residential', - 'RX': 'residential', - 'RZ': 'residential', - 'S0': 'residential', - 'S1': 'residential', - 'S2': 'residential', - 'S3': 'residential', - 'S4': 'residential', - 'S5': 'residential', - 'S9': 'residential', - 'T1': 'na', - 'T2': 'na', - 'T9': 'na', - 'U0': 'warehouse', - 'U1': 'warehouse', - 'U2': 'warehouse', - 'U3': 'warehouse', - 'U4': 'warehouse', - 'U5': 'warehouse', - 'U6': 'warehouse', - 'U7': 'warehouse', - 'U8': 'warehouse', - 'U9': 'warehouse', - 'V0': 'na', - 'V1': 'na', - 'V2': 'na', - 'V3': 'na', - 'V4': 'na', - 'V5': 'na', - 'V6': 'na', - 'V7': 'na', - 'V8': 'na', - 'V9': 'na', - 'W1': 'primary school', - 'W2': 'primary school', - 'W3': 'secondary school', - 'W4': 'secondary school', - 'W5': 'secondary school', - 'W6': 'secondary school', - 'W7': 'secondary school', - 'W8': 'primary school', - 'W9': 'secondary school', - 'Y1': 'large office', - 'Y2': 'large office', - 'Y3': 'large office', - 'Y4': 'large office', - 'Y5': 'large office', - 'Y6': 'large office', - 'Y7': 'large office', - 'Y8': 'large office', - 'Y9': 'large office', - 'Z0': 'na', - 'Z1': 'large office', - 'Z2': 'na', - 'Z3': 'na', - 'Z4': 'na', - 'Z5': 'na', - 'Z6': 'na', - 'Z7': 'na', - 'Z8': 'na', - 'Z9': 'na' + """ + UsPlutoToUsage class + """ + _building_function = { + 'A0': 'single family house', + 'A1': 'single family house', + 'A2': 'single family house', + 'A3': 'single family house', + 'A4': 'single family house', + 'A5': 'single family house', + 'A6': 'single family house', + 'A7': 'single family house', + 'A8': 'single family house', + 'A9': 'single family house', + 'B1': 'multifamily house', + 'B2': 'multifamily house', + 'B3': 'multifamily house', + 'B9': 'multifamily house', + 'C0': 'residential', + 'C1': 'residential', + 'C2': 'residential', + 'C3': 'residential', + 'C4': 'residential', + 'C5': 'residential', + 'C6': 'residential', + 'C7': 'residential', + 'C8': 'residential', + 'C9': 'residential', + 'D0': 'residential', + 'D1': 'residential', + 'D2': 'residential', + 'D3': 'residential', + 'D4': 'residential', + 'D5': 'residential', + 'D6': 'residential', + 'D7': 'residential', + 'D8': 'residential', + 'D9': 'residential', + 'E1': 'warehouse', + 'E3': 'warehouse', + 'E4': 'warehouse', + 'E5': 'warehouse', + 'E7': 'warehouse', + 'E9': 'warehouse', + 'F1': 'warehouse', + 'F2': 'warehouse', + 'F4': 'warehouse', + 'F5': 'warehouse', + 'F8': 'warehouse', + 'F9': 'warehouse', + 'G0': 'office', + 'G1': 'office', + 'G2': 'office', + 'G3': 'office', + 'G4': 'office', + 'G5': 'office', + 'G6': 'office', + 'G7': 'office', + 'G8': 'office', + 'G9': 'office', + 'H1': 'hotel', + 'H2': 'hotel', + 'H3': 'hotel', + 'H4': 'hotel', + 'H5': 'hotel', + 'H6': 'hotel', + 'H7': 'hotel', + 'H8': 'hotel', + 'H9': 'hotel', + 'HB': 'hotel', + 'HH': 'hotel', + 'HR': 'hotel', + 'HS': 'hotel', + 'I1': 'hospital', + 'I2': 'outpatient', + 'I3': 'outpatient', + 'I4': 'residential', + 'I5': 'outpatient', + 'I6': 'outpatient', + 'I7': 'outpatient', + 'I9': 'outpatient', + 'J1': 'large office', + 'J2': 'large office', + 'J3': 'large office', + 'J4': 'large office', + 'J5': 'large office', + 'J6': 'large office', + 'J7': 'large office', + 'J8': 'large office', + 'J9': 'large office', + 'K1': 'strip mall', + 'K2': 'strip mall', + 'K3': 'strip mall', + 'K4': 'residential', + 'K5': 'restaurant', + 'K6': 'commercial', + 'K7': 'commercial', + 'K8': 'commercial', + 'K9': 'commercial', + 'L1': 'residential', + 'L2': 'residential', + 'L3': 'residential', + 'L8': 'residential', + 'L9': 'residential', + 'M1': 'large office', + 'M2': 'large office', + 'M3': 'large office', + 'M4': 'large office', + 'M9': 'large office', + 'N1': 'residential', + 'N2': 'residential', + 'N3': 'residential', + 'N4': 'residential', + 'N9': 'residential', + 'O1': 'office', + 'O2': 'office', + 'O3': 'office', + 'O4': 'office', + 'O5': 'office', + 'O6': 'office', + 'O7': 'office', + 'O8': 'office', + 'O9': 'office', + 'P1': 'large office', + 'P2': 'hotel', + 'P3': 'office', + 'P4': 'office', + 'P5': 'office', + 'P6': 'office', + 'P7': 'large office', + 'P8': 'large office', + 'P9': 'office', + 'Q0': 'office', + 'Q1': 'office', + 'Q2': 'office', + 'Q3': 'office', + 'Q4': 'office', + 'Q5': 'office', + 'Q6': 'office', + 'Q7': 'office', + 'Q8': 'office', + 'Q9': 'office', + 'R0': 'residential', + 'R1': 'residential', + 'R2': 'residential', + 'R3': 'residential', + 'R4': 'residential', + 'R5': 'residential', + 'R6': 'residential', + 'R7': 'residential', + 'R8': 'residential', + 'R9': 'residential', + 'RA': 'residential', + 'RB': 'residential', + 'RC': 'residential', + 'RD': 'residential', + 'RG': 'residential', + 'RH': 'residential', + 'RI': 'residential', + 'RK': 'residential', + 'RM': 'residential', + 'RR': 'residential', + 'RS': 'residential', + 'RW': 'residential', + 'RX': 'residential', + 'RZ': 'residential', + 'S0': 'residential', + 'S1': 'residential', + 'S2': 'residential', + 'S3': 'residential', + 'S4': 'residential', + 'S5': 'residential', + 'S9': 'residential', + 'T1': 'na', + 'T2': 'na', + 'T9': 'na', + 'U0': 'warehouse', + 'U1': 'warehouse', + 'U2': 'warehouse', + 'U3': 'warehouse', + 'U4': 'warehouse', + 'U5': 'warehouse', + 'U6': 'warehouse', + 'U7': 'warehouse', + 'U8': 'warehouse', + 'U9': 'warehouse', + 'V0': 'na', + 'V1': 'na', + 'V2': 'na', + 'V3': 'na', + 'V4': 'na', + 'V5': 'na', + 'V6': 'na', + 'V7': 'na', + 'V8': 'na', + 'V9': 'na', + 'W1': 'primary school', + 'W2': 'primary school', + 'W3': 'secondary school', + 'W4': 'secondary school', + 'W5': 'secondary school', + 'W6': 'secondary school', + 'W7': 'secondary school', + 'W8': 'primary school', + 'W9': 'secondary school', + 'Y1': 'large office', + 'Y2': 'large office', + 'Y3': 'large office', + 'Y4': 'large office', + 'Y5': 'large office', + 'Y6': 'large office', + 'Y7': 'large office', + 'Y8': 'large office', + 'Y9': 'large office', + 'Z0': 'na', + 'Z1': 'large office', + 'Z2': 'na', + 'Z3': 'na', + 'Z4': 'na', + 'Z5': 'na', + 'Z6': 'na', + 'Z7': 'na', + 'Z8': 'na', + 'Z9': 'na' } @staticmethod - def usage(pluto): - nrel_function = UsPlutoToUsage.building_function[pluto] - return UsFunctionToUsage.building_usage[nrel_function] + def usage(building_pluto_function): + """ + Get the nrel usage for the given building pluto function + :param building_pluto_function: str + :return: str + """ + return UsFunctionToUsage.usage(UsPlutoToUsage._building_function[building_pluto_function])