From 9dd816ceb0eb19f91da1ba70b209778800793845 Mon Sep 17 00:00:00 2001 From: Alireza Adli Date: Thu, 18 Jul 2024 08:05:14 -0400 Subject: [PATCH] Add year to period of construction --- .../access_nrcan_catalogue.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/hub/city_model_structure/life_cycle_assessment/access_nrcan_catalogue.py b/hub/city_model_structure/life_cycle_assessment/access_nrcan_catalogue.py index 1f8b0230..3340d9f2 100644 --- a/hub/city_model_structure/life_cycle_assessment/access_nrcan_catalogue.py +++ b/hub/city_model_structure/life_cycle_assessment/access_nrcan_catalogue.py @@ -40,6 +40,40 @@ class AccessNrcanCatalog: constructions_path = (self._path / constructions).resolve() self._constructions = json.loads(constructions_path.read_text()) + @staticmethod + def year_to_period_of_construction(year_of_construction): + if 1000 <= year_of_construction <= 1900: + period_of_construction = '1000_1900' + elif 1901 <= year_of_construction <= 1910: + period_of_construction = '1901_1910' + elif 1911 <= year_of_construction <= 1920: + period_of_construction = '1911_1920' + elif 1921 <= year_of_construction <= 1930: + period_of_construction = '1921_1930' + elif 1931 <= year_of_construction <= 1940: + period_of_construction = '1931_1940' + elif 1941 <= year_of_construction <= 1950: + period_of_construction = '1941_1950' + elif 1951 <= year_of_construction <= 1960: + period_of_construction = '1951_1960' + elif 1961 <= year_of_construction <= 1970: + period_of_construction = '1961_1970' + elif 1971 <= year_of_construction <= 1980: + period_of_construction = '1971_1980' + elif 1981 <= year_of_construction <= 1990: + period_of_construction = '1981_1990' + elif 1991 <= year_of_construction <= 2000: + period_of_construction = '1991_2000' + elif 2001 <= year_of_construction <= 2010: + period_of_construction = '2001_2010' + elif 2011 <= year_of_construction <= 2016: + period_of_construction = '2011_2016' + elif 2017 <= year_of_construction <= 2019: + period_of_construction = '2017_2019' + elif 2020 <= year_of_construction <= 3000: + period_of_construction = '2020_3000' + return period_of_construction + def layers(self, opaque_surface_code, component_type): for opaque_surface in self.constructions['opaque_surfaces']: opaque_surface_key = list(opaque_surface)[0]