From a71443ef23ee05a23914621192f7d239c8a9dcfa Mon Sep 17 00:00:00 2001 From: Guille Date: Tue, 19 May 2020 12:18:15 -0400 Subject: [PATCH] integrate libs as submodule --- ...to_function.py => us_pluto_to_function.py} | 7 +- .../us_new_york_city_physics_parameters.py | 3 +- .../physics_feeders/us_physics_parameters.py | 3 +- .../helpers/us_function_to_usage.py | 229 +---------------- .../helpers/us_pluto_to_usage.py | 231 ++++++++++++++++++ .../us_new_york_city_usage_parameters.py | 6 +- usage/usage_feeders/us_usage_parameters.py | 2 +- 7 files changed, 242 insertions(+), 239 deletions(-) rename physics/physics_feeders/helpers/{pluto_to_function.py => us_pluto_to_function.py} (98%) create mode 100644 usage/usage_feeders/helpers/us_pluto_to_usage.py diff --git a/physics/physics_feeders/helpers/pluto_to_function.py b/physics/physics_feeders/helpers/us_pluto_to_function.py similarity index 98% rename from physics/physics_feeders/helpers/pluto_to_function.py rename to physics/physics_feeders/helpers/us_pluto_to_function.py index b97750e4..d2d917bb 100644 --- a/physics/physics_feeders/helpers/pluto_to_function.py +++ b/physics/physics_feeders/helpers/us_pluto_to_function.py @@ -1,5 +1,4 @@ -class PlutoToFunction: - +class UsPlutoToFunction: building_function = { 'A0': 'single family house', 'A1': 'single family house', @@ -222,7 +221,7 @@ class PlutoToFunction: 'Z8': 'na', 'Z9': 'na' } - + @staticmethod def function(pluto): - return PlutoToFunction.building_function[pluto] + return UsPlutoToFunction.building_function[pluto] diff --git a/physics/physics_feeders/us_new_york_city_physics_parameters.py b/physics/physics_feeders/us_new_york_city_physics_parameters.py index c253b5ab..7b9bfb3a 100644 --- a/physics/physics_feeders/us_new_york_city_physics_parameters.py +++ b/physics/physics_feeders/us_new_york_city_physics_parameters.py @@ -1,5 +1,5 @@ from physics.physics_feeders.us_base_physics_parameters import UsBasePhysicsParameters -from physics.physics_feeders.helpers.pluto_to_function import PlutoToFunction as Pf +from physics.physics_feeders.helpers.us_pluto_to_function import PlutoToFunction as Pf class UsNewYorkCityPhysicsParameters(UsBasePhysicsParameters): @@ -7,4 +7,3 @@ class UsNewYorkCityPhysicsParameters(UsBasePhysicsParameters): self._city = city climate_zone = 'ASHRAE_2004:4A' super().__init__(climate_zone, self._city.city_objects, Pf.function) - diff --git a/physics/physics_feeders/us_physics_parameters.py b/physics/physics_feeders/us_physics_parameters.py index 1a3c23e7..79946968 100644 --- a/physics/physics_feeders/us_physics_parameters.py +++ b/physics/physics_feeders/us_physics_parameters.py @@ -1,5 +1,4 @@ from physics.physics_feeders.us_base_physics_parameters import UsBasePhysicsParameters -from physics.physics_feeders.helpers.pluto_to_function import PlutoToFunction as Pf from physics.physics_feeders.helpers.us_to_library_types import UsToLibraryTypes @@ -7,5 +6,5 @@ class UsPhysicsParameters(UsBasePhysicsParameters): def __init__(self, city): self._city = city self._climate_zone = UsToLibraryTypes.city_to_climate_zone(city.city_name) - super().__init__(self._climate_zone, self._city.city_objects, Pf.building_type_to_nrel) + super().__init__(self._climate_zone, self._city.city_objects, lambda function: function) diff --git a/usage/usage_feeders/helpers/us_function_to_usage.py b/usage/usage_feeders/helpers/us_function_to_usage.py index fc3f3019..e8e46316 100644 --- a/usage/usage_feeders/helpers/us_function_to_usage.py +++ b/usage/usage_feeders/helpers/us_function_to_usage.py @@ -19,233 +19,8 @@ class UsFunctionToUsage: 'warehouse': 'industry' } - 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 function_to_usage(building_function): + def usage(building_function): return UsFunctionToUsage.building_usage[building_function] - @staticmethod - def pluto_to_function(pluto): - return UsFunctionToUsage.building_function[pluto] + diff --git a/usage/usage_feeders/helpers/us_pluto_to_usage.py b/usage/usage_feeders/helpers/us_pluto_to_usage.py new file mode 100644 index 00000000..48eb5295 --- /dev/null +++ b/usage/usage_feeders/helpers/us_pluto_to_usage.py @@ -0,0 +1,231 @@ +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' + } + + @staticmethod + def usage(pluto): + nrel_function = UsPlutoToUsage.building_function[pluto] + return UsFunctionToUsage.building_usage[nrel_function] diff --git a/usage/usage_feeders/us_new_york_city_usage_parameters.py b/usage/usage_feeders/us_new_york_city_usage_parameters.py index e93bbe56..71ef4629 100644 --- a/usage/usage_feeders/us_new_york_city_usage_parameters.py +++ b/usage/usage_feeders/us_new_york_city_usage_parameters.py @@ -1,7 +1,7 @@ from usage.usage_feeders.us_base_usage_parameters import UsBaseUsageParameters -from usage.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage +from usage.usage_feeders.helpers.us_pluto_to_usage import UsPlutoToUsage as Pu class UsNewYorkCityUsageParameters(UsBaseUsageParameters): - def __init_(self, city): - super().__init__(city, UsFunctionToUsage.function) \ No newline at end of file + def __init__(self, city): + super().__init__(city, Pu.usage) diff --git a/usage/usage_feeders/us_usage_parameters.py b/usage/usage_feeders/us_usage_parameters.py index bd645cd7..a5247369 100644 --- a/usage/usage_feeders/us_usage_parameters.py +++ b/usage/usage_feeders/us_usage_parameters.py @@ -4,4 +4,4 @@ from usage.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage class UsUsageParameters(UsBaseUsageParameters): def __init__(self, city): - super().__init__(city, UsFunctionToUsage.function_to_usage) + super().__init__(city, UsFunctionToUsage.usage)